Dr. Stephen Henson wrote:
On Mon, Jul 27, 2009, Neil Dugan wrote:
Hi,
I have been trying to read the keys generated by "openssl genrsa ..." and
"openssl rsa -pubout ..." commands.
I successfully (according to the return code) read the private key with
if (in = BIO_new_file("rsakey.pem", "r")) {
int ok;
printf ("Created private BIO\n");
ok = (PEM_read_bio_RSAPrivateKey(in, &rsa, NULL, NULL) != NULL);
printf ("ok = %s\n", (ok != 0) ? "true":"false");
BIO_free(in);
}
but the similar code using PEM_read_bio_RSAPublicKey() doesn't want to
work.
Use PEM_read_bio_RSA_PUBKEY() instead.
Steve.
Thanks that seemed to work.
But the "PEM_write_RSAPublicKey(stdout, rsa);" call doesn't output the
same data as what is in the key file. So did it get read properly?
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majord...@openssl.org