Hi,

Thanks for the tip. Your code did not work, but it
work after being modified. Below is the modified code

fp = BIO_new_file("private.pem", "r");
pkey = PEM_read_bio_PrivateKey(fp, 0, 0, 0);
if (pkey != NULL)
        key = EVP_PKEY_get1_RSA(pkey);
EVP_PKEY_free(pkey);

The main problem is that you have forgotten to mention
what load_key does or the code in load_key. Anyways,
thanks a lot for the help. If it was not for your
code, I would not have been able to do it. I am new to
OpenSSL so let me know if I can improve the above
code.

On a slightly different note, I have never an API
documented worse than OpenSSL, especially one that is
so popular.

- Sid

--- El hallabi-Kettani Abderrahmane
<[EMAIL PROTECTED]> wrote:

> Use this :
>  
>  
> if ((bio_err=BIO_new(BIO_s_file())) != NULL)
>      
> BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
>   
>   pkey = load_key(bio_err,argv[1],FORMAT_PEM, 1,
>                 NULL, NULL, "Private Key");
>   
>   if (pkey != NULL)
>     rsa = pkey == NULL ? NULL :
> EVP_PKEY_get1_RSA(pkey);
>   EVP_PKEY_free(pkey);
> 
> where pkey is EVP_PKEY * key, and rsa is an RSA*
> key,
> and argv[1] is the file which you passed in your
> command line  .
> goog luck .
> Abdou,
> 
> 
>       
> 
>       
>               
> Vous manquez d�espace pour stocker vos mails ? 
> Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> Cr�ez votre Yahoo! Mail sur
> http://fr.benefits.yahoo.com/
> 
> Le nouveau Yahoo! Messenger est arriv� ! D�couvrez
> toutes les nouveaut�s pour dialoguer instantan�ment
> avec vos amis. A t�l�charger gratuitement sur
> http://fr.messenger.yahoo.com
>
______________________________________________________________________
> OpenSSL Project                                
> http://www.openssl.org
> User Support Mailing List                   
> [EMAIL PROTECTED]
> Automated List Manager                          
> [EMAIL PROTECTED]
> 



                
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to