19

I have a .cer certificate file, and need to extract the Public Key. I can only extract to PEM format. The "outform" parameter does nothing.

openssl x509 -inform PEM -in certificate.cer -outform DER -pubkey -noout > publickey.der

Is it possible to extract in DER format?

jww
  • 97,681
  • 90
  • 411
  • 885
marcolopes
  • 9,232
  • 14
  • 54
  • 65
  • 4
    My question is not very different from other similar questions... http://stackoverflow.com/questions/8774574/how-can-i-convert-a-pfx-certificate-file-for-use-with-apache-on-a-linux-server – marcolopes Dec 04 '12 at 00:22
  • 4
    I find this question relevant and informative. – Pedro Perez Dec 10 '14 at 10:50

1 Answers1

19

Solved decoding the base64 PEM file:

openssl x509 -in certificate.cer -pubkey -noout | openssl enc -base64 -d > publickey.der

Any other idea is welcome.

marcolopes
  • 9,232
  • 14
  • 54
  • 65