Op woensdag 13 april 2005 om 09:14 uur schreef Rafael Cividanes het volgende:

>     Hi,
> 
>   I'm trying to make a function to get a file in word format (.doc) , 
> encrypt and decrypt it. I'm using symetric encryption with EVP API. When 
> I use .txt files, everything works properly, but with .doc files it fails.

Be careful that under Windows file descriptors are standard opened in
"text" mode for certain extensions (including .txt) and "binary" for
certain others. This might explain the difference.

If you use something like (note the "b" for binary), does it work?

FILE *fp = fopen("word.doc", "rb");

And your code should be 8-bit clean.

>    Can EVP API be used to encrypt a .pdf file or an excel file? I can't 
> imagine how to do this, once EVP_EncryptUpdate and EVP_EncryptFinal_ex 
> get the input in unsigned char* format. How can I make this conversion?

Yes the encryption should work on any binary data. But be careful how
you read and write blocks of data. The routines you use should be 8-bit
clean, so be able to deal with '\0' characters.
-- 
Marco Roeland
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to