I've tried both to load public key from PEM file, but
PEM_read_RSAPublicKey() failed.

I can't get any information from manual, so I've googled a lot, and
got that opnion:

You might try PEM_read_RSA_PUBKEY() instead of PEM_read_RSAPublicKey().

This is all about formats.

The default public key file format generated by openssl is the PEM format.

PEM_read_RSA_PUBKEY() reads the PEM format. PEM_read_RSAPublicKey()
reads the PKCS#1 format.

So if you want to stick to PEM_read_RSAPublicKey() you could generate
the public key file using the PKCS#1 format by specifying the -outform
DER option when generating the public key.

But it's PEM_xxx, why it used to read from DER format? Then I tried it
on DER format, but it still failed.

So, where should I use that it?

BTW: where is the source code of that two APIs? I've grep all the
files under openssl, but only doc and./util/libeay.num.

Cyberman Wu
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to