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.

Dr Stephen N. Henson.
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Gemplus:
Core developer of the   OpenSSL project:
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
OpenSSL Project                       
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to