> From: owner-openssl-us...@openssl.org On Behalf Of Mark Bishop
> Sent: Tuesday, 06 July, 2010 12:09

> When I execute:
> 
> //Convert public key from PEM to DER
> openssl rsa -inform PEM -in public_key.pem -out public_key.der  
> -outform DER -pubin -pubout
> 
> I get a 162 byte file.
> 
> When I execute:
> 
> //Create public key in DER format
> openssl rsa -in private_key.pem -pubout -outform DER -out 
> public_key.der
> 
> I get a 160 byte file.
> 
> Any ideas why?

They aren't the same keypair; if you think they are, 
you've got your files mixed up. 

If you are using conventional power-of-two modulus sizes, 
the likely case is that a PubKeyInfo containing RSA 1k 
with e=3 encodes to 160 bytes while e=x10001=F4 gives 162.
(Other e are possible but not generated by commandline. 
'Odd' modulus sizes are possible but rarely chosen.)

To see, display with: openssl rsa -in file -inform DER -text -noout
or: openssl asn1parse -in file -inform DER ; get the offset from 
the last item (BITSTRING, should be 18 for these sizes) and: 
openssl asn1parse -in file -inform DER -strparse offset


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

Reply via email to