Title: Problem loading public key

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?

Thank you!

--
Filipe Cust�dio
Technical Architect
e-Trust Unit
Novabase

Reply via email to