> From: owner-openssl-us...@openssl.org On Behalf Of Dr. Stephen Henson
> Sent: Tuesday, 27 August, 2013 08:10

Adding a little:

> On Tue, Aug 27, 2013, Cyberman Wu wrote:
> 
> > I've tried both to load public key from PEM file, but
> > PEM_read_RSAPublicKey() failed.
> > 
> 
> It would help if you said what error you get or posted the file.
> 
> See also:
> 
> http://www.openssl.org/support/faq.html#PROG6
> 
Preferably #PROG7 also, although that's not vital.

> > I can't get any information from manual
> 
> The pem manual pages gives information:
> 
> http://www.openssl.org/docs/crypto/pem.html
> 
>  The RSAPublicKey functions process an RSA public key using 
> an RSA structure.
>  The public key is encoded using a PKCS#1 RSAPublicKey structure.
> 
>  The RSA_PUBKEY functions also process an RSA public key using an RSA
>  structure. However the public key is encoded using a 
> SubjectPublicKeyInfo
>  structure and an error occurs if the public key is not RSA. 
> 
And PEM can easily be distinguished by the dash lines:
RSAPublicKey is "BEGIN/END RSA PUBLIC KEY" while RSA_PUBKEY 
(and also DSA_PUBKEY etc) is "BEGIN/END PUBLIC KEY".

The same two structures are supported in DER, and there if 
you lose track which is which you have to asn1parse and grovel.

Usually PUBKEY is more likely because it is the default for 
commandline utilities like rsa -pubout and x509 -pubout .
Though >=1.0.0 rsa has undocumented options for RSAPublicKey.


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

Reply via email to