How to extract the public key from a .pem certificate with OpenSSL

0

The following command generates a .pem certificate (same as the one used by AWS):

openssl genrsa -des3 -out chaveprivada.pem 2048

However, the public and private keys are stored together in the file. How to extract the public key from the file .pem ?

    
asked by anonymous 16.05.2018 / 22:35

1 answer

0

To extract the key from a file .pem use the command below:

openssl rsa -in chaveprivada.pem -pubout > chavepublica.pub

The public key will be written to the file chavepublica.pub .

    
16.05.2018 / 22:35