On Mon, May 17, 2004, Carlos Roberto Zainos H wrote:

> Hi all !
>  
> I'm writing an application that needs write out a RSA private key password based 
> encryption in DER format but I'm getting error from functions used for, follows my 
> code and error codes:
>  
> ERR_load_crypto_strings ();
>  out = BIO_new(BIO_s_file());
>  
> rsa = RSA_generate_key (bits, e_value, i_progreso, NULL ); /*ok */
> clave = EV_PKEY_new();
> EVP_PKEY_assign_RSA (clave, rsa); /*rsa in EVP_PKEY structure */
>  
> res = PEM_write_bio_RSAPrivateKey (out, rsa, EVP_des_cbc(), NULL, 0, NULL, 
> password); /*this works fine */
>  
> res = PEM_write_bio_PKCS8PrivateKey(out, clave, EVP_des_cbc(), NULL, 0, NULL, 
> password); /*this breaks with follow error code:
> error:06074079:digital envelope routines:EVP_PBE_CipherInit:unknown pbe algorith
> merror:23077073:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 algor cipherinit errorer
> ror:2306C067:PKCS12 routines:PKCS12_i2d_encrypt:encrypt errorerror:2307D067:PKCS
> 12 routines:PKCS8_encrypt:encrypt error0 */
>  
> res = i2d_PKCS8PrivateKey_bio (out, clave, EVP_des_cbc(), NULL, 0, NULL, password); 
> /*this is the function that interest to me but also breaks with follow error code:
> error:06074079:digital envelope routines:EVP_PBE_CipherInit:unknown pbe algorith
> merror:23077073:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 algor cipherinit errorer
> ror:2306C067:PKCS12 routines:PKCS12_i2d_encrypt:encrypt errorerror:2307D067:PKCS
> 12 routines:PKCS8_encrypt:encrypt errorerror:0D074041:asn1 encoding routines:ASN
> 1_i2d_bio:malloc failure0 */
>  
> What's the problem with the two last functions ??
> Do I making something erroneous??
>  
> Thanks in advance for your replies.
>  

You need OpenSSL_add_all_algorithm() to add the necessary PBE algorithms to
the internal tables.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to