2007/10/30, Alex Queiroz <[EMAIL PROTECTED]>: > > Hallo, > > I am using the symmetric cypher functions to encrypt and then > decrypt a string. The cipher is "aes-256-cbc". When I try to decrypt > the string, I get this error: > > error 06065064: digital envelope routines: EVP_DecryptFinal_ex: bad > decrypt > > I am using the same key and same iv. The string is the same > because it has a hmac field, which is checked. The string to be > decrypted is padded to 48 bytes by the encryption routine, so I guess > it's not a padding error. The call to EVP_CipherUpdate runs fine, but > the error occurs in the EVP_CipherFinal_ex function. I don't know what > else may be going wrong. Any help is appreciated. > Make sure you use the same iv that you used when encrypting. You should make a copy of the iv vector, since the encrypting process overwrites the buffer of the iv that you pass.
Bye, -- Jorge Fernandez