Am getting this error "error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt". when I encrypt a buffer and persist it to writing to disk and trying to read the value from disk by decrypting it. I made sure the key, IV are same in both cases. Tried disabling or enabling padding during encryption and decryption. But still getting same error.

The thing is when I try to decrypt the value before writing to extended attributes, the decryption was a success.

Am using AES256 symmetric cipher related EVP functions.

What other things that I need to verify here?

  • It seems pretty clear that the problem must lie in writing and reading extended attributes, which would probably be more appropriate for unix.stackexchange.com. Have you done a byte-by-byte comparison of the ciphertext before and after writing/reading the extended attribute? – AndrolGenhald Feb 21 '19 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.