Hi,

The PKCS#1 encoding is dedicated to RSA keys and consists of an ASN.1 collection of the RSA key components (a description can be found on the PKCS#1 spec from RSA, section A.1.1 and A.1.2, ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf).

SubjectPublicKeyInfo is more generic: it can hold any public key (RSA, DSA, ECC) as it contains a field indentifing the corresponding algorithm. It's described in the PKCS#6 spec from RSA, section A.1, ftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-6.asc.

Hope this will help.

Mounir IDRASSI
IDRIX
http://www.idrix.fr

Sébastien Hinderer wrote:
Hi Mounir,

Your file pk.der contains a public key encoded as a SubjectPublicKeyInfo
and NOT as a PKCS#1 encoding. So, you should use the function
d2i_RSA_PUBKEY instead of d2i_RSAPublicKey in order to read the public
key.

Ah I thought I tried this one but apparently I did not. It works indeed,
thanks !!
Could someone please explain to me the difference between these two
encodings ? I know almost nothing about these things.
A pointer to a good documentatiion would be enough !

Cheers, and thanks for helping MOuunir,
Sébastien.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org


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

Reply via email to