On Fri, Jan 22, 2010, Douglas Gemignani wrote:

> Hello,
> 
> I'm using PKCS#7 for generating an enveloped certificated, but after
> openssl generating a random TDES key and encrypts it with my pub exp,
> sometimes the resulting data is bigger than my module / prv exp.
> 
> Something is wrong, this should never happen...
> 
> There is my snippet
> 
> p7 = PKCS7_new());
> PKCS7_set_type(p7, NID_pkcs7_enveloped);
> PKCS7_content_new( p7, NID_pkcs7_data);
> PKCS7_add_recipient(p7, *recipient);
> PKCS7_set_cipher(p7, EVP_des_ede3_cbc());
> p7bio = PKCS7_dataInit (p7,NULL);
> BIO_write(p7bio, Data, DataLenght);
> BIO_flush(p7bio);
> PKCS7_dataFinal(p7, p7bio);
> 

I'd suggest using PKCS7_encrypt() instead of all that low level stuff.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to