Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract public key from certificate in DER format [closed]

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?

like image 807
marcolopes Avatar asked Nov 24 '12 08:11

marcolopes


People also ask

Can we extract public key from certificate?

You cannot export a certificate if you enabled the Do not allow private key to be exportable option while creating the certificate. Click Security > Certificates. On the Certificates page, click the certificate. On the Certificate Details page, click Export Private/Public Keypair.

How do I find the public key of a certificate?

Chrome 54 and below: If you're using Chrome then click on the green bar to the left of the 'https:' in the address bar, for the VeriSign website the green bar says Symantec Corperation [US] , this will open a pop up. On the pop up click 'Certificate Information'. This will open another pop up.

What is DER format key?

DER is the most popular encoding format to store data, like X. 509 certificates, and PKCS8 private keys in files. It's a binary encoding, and the resulting content can't be viewed with a text editor. PKCS8 is a standard syntax for storing private key information.

Is .pem a public key?

Privacy Enhanced Mail (PEM) files are a type of Public Key Infrastructure (PKI) file used for keys and certificates. PEM, initially invented to make e-mail secure, is now an Internet security standard.


1 Answers

Solved decoding the base64 PEM file:

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

Any other idea is welcome.

like image 119
marcolopes Avatar answered Sep 22 '22 09:09

marcolopes