Creating a .pem File for SSL Certificate Installations

March 2, 2023 . 1 MIN READ

Reference:

https://www.digicert.com/kb/ssl-support/pem-ssl-creation.htm

 

https://www.digicert.com/kb/ssl-support/pem-ssl-creation.htm

 

https://cheapsslsecurity.com/p/convert-a-certificate-to-pem-crt-to-pem-cer-to-pem-der-to-pem/

 

https://medium.com/@sevcsik/authentication-using-https-client-certificates-3c9d270e8326

https://stackoverflow.com/questions/19014541/curl-to-pass-ssl-certifcate-and-password

 

So export the keys into .p12

keytool -importkeystore -srckeystore $jksfile -destkeystore $p12file \

        -srcstoretype JKS -deststoretype PKCS12 \

        -srcstorepass $jkspassword -deststorepass $p12password  

        -srcalias $myalias -destalias $myalias \

        -srckeypass $keypass -destkeypass $keypass -noprompt

And generate the pem file that holds only the key

 echo making ${fileroot}.key.pem

 openssl pkcs12 -in $p12 -out ${fileroot}.key.pem  \

         -passin pass:$p12password  \

         -passout pass:$p12password  -nocerts

  • Make an empty keystore:

mkdir ~/nss

chmod 700 ~/nss

certutil -N -d ~/nss

Leave a Reply

Your email address will not be published. Required fields are marked *