Hi,

One question regarding EVP_Encrypt APIs.


EVP_EncryptInit_ex(&ctx, cipher, NULL, (unsigned char *)enc_key, (unsigned
char *)iv))

Is there a way to pass the iv as NULL during the call to the above API, and
then update this later on.
I want to do this because of the following reason,

I want to initialize the context to use the same key for all calls to
encrypt but want to use a different IV value.
If I use this API as it is, then for achieving that, I need to call Init_ex
each time.

I want something like this->

Step-1 EVP_EncryptInit_ex(&ctx, cipher, NULL, (unsigned char *)enc_key->v,
NULL)

Step-2 EncryptData->  //Can call this many times
<Set the IV value>
EVP_EncryptUpdate();
EVP_EncrpyFinal();



One solution is to use the same IV for all calls to Encrypt, but I guess
this defeats the purpose of random IV.

Similarly case for for decrypt also.

Thanks,
Prashant.



-- 
Prashant Batra
Follow the dreams!!

Reply via email to