In message <[EMAIL PROTECTED]> on Thu, 03 Aug 2006 09:03:42 +0200, Andreas von
Linden <[EMAIL PROTECTED]> said:
Buglist> i have a problem with the Blowfish algorithm. When i encrypt a long
Buglist> message i get the following error when i try to decrypt the message:
Buglist>
Buglist> 4156:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad
Buglist> decrypt:.\crypto\evp\evp_enc.c:454:
Your problem is at the end of blowencrypt() and blowdecrypt(). You're
assuming that the result is a \0-terminated character string, while in
reality, it's a binary blob that may *contain* \0.
Also, I fail to understand why on *earth* you're doing all this
copying to a C++ string just to copy back to a C character array, when
you could do something as simple as this:
(for blowencrypt)
EVP_CIPHER_CTX_cleanup(&ctx);
memcpy(output, encodebuffer, tmplen);
return tmplen;
(for blowdecrypt)
EVP_CIPHER_CTX_cleanup(&ctx);
memcpy(output, decodebuffer, tmplen);
Cheers,
Richard
-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.
--
Richard Levitte [EMAIL PROTECTED]
http://richard.levitte.org/
"When I became a man I put away childish things, including
the fear of childishness and the desire to be very grown up."
-- C.S. Lewis
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]