Extracting public key from certificate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Extracting public key from certificate

Arsen Hayrapetyan-2
Hello,
I have the public key certificate in cert.pem and I want to extract the public key and store it in file pubkey.pem. I did it with the following command: (openssl v.0.9.7a)

openssl x509 -in cert.pem -pubkey -noout > pubkey.pem

However the following command did the strange things:
openssl x509 -in cert.pem -pubkey -noout -out pubkey.pem

It  ignored the "-out pubkey" and printed the public key to STDOUT.

Also, the -pubkey option hasn't been listed in the list of options of x509 command (http://www.openssl.org/docs/apps/x509.html#). Maybe it corresponds to the latest openssl v.0.9.8, but that option hasn't been listed also in "man page" for openssl v.0.9.7a.

Can anybody explain this behaviour?

Thanks,
Arsen.

smime.p7s (4K) Download Attachment