On Tue, Jul 28, 2009, Bizhan Gholikhamseh (bgholikh) wrote:

> Hi All,
> In our development enviroment we have an image signing system. Through
> some configuration we can create a pair of rsa public/private key by the
> system.
>  
> The private key are kept by the system and never are release, however,
> through some HTTPS API we are able to recieve public key in binary
> format.
>  

Depends on what you mean by "binary format".

> I need to convert this binary format to PEM format so I can verify the
> images signed by system is working correctly.
> I have been trying to use base64 to convert the binary format to PEM, 
> openssl enc -base64 -in key.bin -out key.pem
> Then I added the following header and trailer to the file:
> -----BEGIN PUBLIC KEY-----
> .......
> -----END PUBLIC KEY-----
> However, when I use this key for any openssl operation I get an error.
> "unable to load key file" 
> I also ran this command on the binary file containing public key and I
> got the following error:
> openssl rsa -in key.pem -text -pubin
> unable to load Public Key
> 18936:error:0906D06C:PEM routines:PEM_read_bio:no start
> line:pem_lib.c:647:Expecting: PUBLIC KEY
>  

If it is a DER format SubjectPublicKeyInfo structure then doing:

openssl rsa -in key.der -inform DER -pubin -text

should work. There is no need to manually add the headers and base64 encode. I
suspect it probably wont be in that format though and you'd have to convert.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.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