On Mar 8, 2014, at 11:23 AM, Larry Bugbee <bug...@mac.com> wrote: > On Mar 7, 2014, at 11:42 AM, "Li, David" <l...@cloudshield.com> wrote: > >> Hi, >> >> I am new to openssl C APIs. So I wrote a simple test to encrypt and decrypt >> a 15 byte ASCII string using AES128. The encryption seems OK and the >> encrypted length is 16. But the decryption always failed at >> EVP_DecryptFinal_ex(). The error code is 0 and means padding error. I have >> been searching on the web but so far nothing worked. Can anyone here suggest >> how to debug this error? >> >> Thanks! >> >> [ Code fragment] >> =================
[ snip ] > It is not clear your encryption is valid, and as you suspect padding may be > the cause. > > In cases such as this I recommend firing up another crypto lib to encrypt on > one and decrypt on the other, and visa versa. You should be able to close in > on the cause a lot faster than continually futzing with only the one lib. Besides, you can be better assured you have interoperability and not a case of two compensating errors.