I have a requirement to extract the public key (RSA) from a *.cer file. I want to extract a key and save it in a .pem file .pem that I can use its value to encrypt values ββwith jsencrypt .
The following command converts .cer to .pem :
openssl x509 -inform der -in certificate.cer -out certificate.pem
However, it does not create a file with the public key, but a file with the contents of the *.cer file.
-----BEGIN CERTIFICATE----- MIICPDCCAamgAwIBAg............ *lots of extra contents* -----END CERTIFICATE-----
Which command should be used to extract the public key and save it in a .pem file?
source share