Well, using EVP functions is not too difficult
(http://www.openssl.org/docs/crypto/EVP_EncryptInit.html#):
1) init context
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);
2) init cipher
EVP_CipherInit(&ctx, EVP_des_ede3_cbc(), key, iv, encrypt);
3) encrypt/decrypt data while available
EVP_CipherUpdate(&ctx, out, &outLen, in, inLen);
4) encrypt/decrypt the last block
EVP_CipherFinal(&ctx, out, &outLen);
5) cleanup context
EVP_CIPHER_CTX_cleanup(&ctx);
You can also take a look at test/evp_test.c file in OpenSSL package.
Aleksey Sanin.
Stella Power wrote:
>I'm afraid that I couldn't find any examples on how to use the EVP functions, and
>still do not know how I would go about implementing it. The only restriction I have
>on my code is that the encrypted input file is 3DES ECB encrypted.
>
>Stella
>
>On Wed, May 01, 2002 at 09:03:42AM -0700, Aleksey Sanin wrote:
>
>>Do you have any reason to do not use EVP_Cipher*() functions instead of
>>low-level des_ecb3_encrypt()? EVP functions provide very good abstraction
>>layer and hide many algorithm specific details.
>>
>>Aleksey Sanin.
>>
>>Stella Power wrote:
>>
>>>hi,
>>>
>>>I'm trying to use the crypto library to decrypt a file which has been
>>>encrypted using triple-DES.
>>>
>>>I have the following declarations:
>>>char *temp;
>>>char **elines;
>>>des_cblock *input;
>>>
>>>I have a function which parses the file and grabs the encrypted strings
>>> temp = parse_file(&mapped_file);
>>>I then set elines[i] = temp;
>>>However I can't pass elines[i] to des_ecb3_encrypt() as it is not declared
>>>as des_cblock.
>>>Is there any way of casting it, passing it, some way of passing the data
>>>returned by the parse_file() function to des_ecb3_encrypt()?
>>>
>>>Also, am I right in thinking that des_cblock being defined the way it is ,
>>>that you can only decrypt in batches of 8 characters??
>>>
>>>Thanks!
>>>Stella
>>>
>>>______________________________________________________________________
>>>OpenSSL Project http://www.openssl.org
>>>User Support Mailing List [EMAIL PROTECTED]
>>>Automated List Manager [EMAIL PROTECTED]
>>>
>>
>>______________________________________________________________________
>>OpenSSL Project http://www.openssl.org
>>User Support Mailing List [EMAIL PROTECTED]
>>Automated List Manager [EMAIL PROTECTED]
>>
>______________________________________________________________________
>OpenSSL Project http://www.openssl.org
>User Support Mailing List [EMAIL PROTECTED]
>Automated List Manager [EMAIL PROTECTED]
>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]