> Filipe Cust�dio wrote:
> 
> Hi!
> 
> I've been having some problems trying to load a PEM formated public
> key into an RSA structure. The key I want to load is:
> 
> -----BEGIN PUBLIC KEY-----
> MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7514kyrphs8TdJIh9KqUpgWSZ
> M17LcfJMLaJxLP/Dglf4vkFNyOZkAug1fhP+pXxR+AecWUFifg3bVt+JJz3MkSr9
> uXaBD4CScBUHzUqtcVENdjX4JkP+FzatVARN5QjnLFjif+G5Wltk5Ek7i2wfGZ8z
> zAise955pM3h7yNmyQIDAQAB
> -----END PUBLIC KEY-----
> 
> To read the key I'm using the PEM_read_RSAPublicKey() function.
> 
> The first problem I ran into was a "no start line" error. I tracked
> this to the check_pem() function at pem_lib.c failing to recognize the
> start line as it was written by "openssl -pubout".
> 
> I changed the start and end line to read "BEGIN RSA PUBLIC KEY" and
> "END RSA PUBLIC KEY". Now the errors I am receiving are:
> 
> error:0D118071:asn1 encoding routines:d2i_ASN1_UINTEGER:expecting an
> integer
> error:0D09E082:asn1 encoding routines:d2i_RSAPublicKey:parsing
> error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib
> 
> What am I doing wrong? Can anyone point me to a working example?
> 

You are using the wrong function: use PEM_read_RSA_PUBKEY instead.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Gemplus: http://www.gemplus.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.

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

Reply via email to