Encrypt/decrypt file problem

https://bpaste.net/show/154725ec827d
So I have 2 functions for encrypting/decrypting files. Encryption works, decryption does not for some reason. Any ideas?

What error do you get?

panic: illegal base64 data at input byte 344

Can you please put the stack trace of that panic?

goroutine 1 [running]:
main.decodeBase64(0x10e11010, 0x3f0, 0x3f0, 0x10, 0x10e113f0, 0x10)
C:/Dev/golang/src/test/endcrypt_decrypt.go:144 +0x96
main.decrypt(0x111fffa0, 0x20, 0x20, 0x10e11010, 0x3f0, 0x3f0, 0x0, 0x2f4, 0x2f4)
C:/Dev/golang/src/test/endcrypt_decrypt.go:178 +0xfe
main.decryptFile(0x111fffa0, 0x20, 0x20, 0x4ba035, 0xa, 0x4bc223, 0x14)
C:/Dev/golang/src/test/endcrypt_decrypt.go:130 +0x19d
main.main()
C:/Dev/golang/src/test/endcrypt_decrypt.go:52 +0xc3

I think I get it. The problem is that encrypted blocks is slightly bigger than 1024 bytes. I think i need to add some marker to the end of encrypted blocks, and then move along the marker during decryption. How can I search for blocks though?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.