Julien,

Not sure about PEM_read_RSAPublicKey, but the following call to 
PEM_read_bio_RSAPublicKey works for me:

    BIO * bio  = NULL;
    RSA * rsa  = NULL;

    bio = BIO_new (BIO_s_file ());

    if (!bio)
    {
        // Handle error here.
    }

    if (BIO_read_filename (bio, publicKeyFile) <= 0)
    {
        // Handle error here.
    }

    rsa = PEM_read_bio_RSAPublicKey (bio, NULL, NULL, NULL);

where publicKeyFile is a const char *.

Frank


---------------------------------------- Message History 
----------------------------------------


From:  julien Bournelle <[EMAIL PROTECTED]>@openssl.org on 06/11/2002 11:51 AM ZE2

Please respond to [EMAIL PROTECTED]

DELEGATED - Sent by:    [EMAIL PROTECTED]


To:    [EMAIL PROTECTED]
cc:
Subject:    Read private key


Hi all,

 my question is very basic but I didn't find any answer.
I create a pair of public/private RSA key with the following commands:

openssl genrsa -out priv.pem
openssl rsa -in priv.pem -pubout -out pub.pem

and then I try to extract the public key with the follwoing code :


"
char *path ="pub.pem";

fp = fopen(path, "r");

rsa = PEM_read_RSAPublicKey(fp, &rsa, NULL, NULL);
"

and while fp is not NULL
�I get nothing in rsa...

so if anynone has an idea it would be very great :-)

Thanks a lot,

[EMAIL PROTECTED]


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]



--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to