Chris Plant wrote:
> 
> I've compiled the attached code, and it doesn't decrypt the text
> correctly.  If anyone could explain why to me, or point out a nice
> tutorial about using these routines, it would be much appreciated.
> 
> ircd_malloc() is basically malloc() with memset().
> 

There's an example in the EVP_EncryptInit manual page. It also includes
the comment:

>         /* Need binary mode for fopen because encrypted data is
>          * binary data. Also cannot use strlen() on it because
>          * it wont be null terminated and may contain embedded
>          * nulls.
>          */

This is one problem with your code: you are using strncpy and strncat.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Gemplus: http://www.gemplus.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to