Skip to content

Instantly share code, notes, and snippets.

@h09shais
Last active November 13, 2018 11:21
Show Gist options
  • Save h09shais/da979558f5607c48c52576bb3a5d9f75 to your computer and use it in GitHub Desktop.
Save h09shais/da979558f5607c48c52576bb3a5d9f75 to your computer and use it in GitHub Desktop.
Generate a private key and a certificate
[1] Generate a private key and a certificate
Ref: https://web.archive.org/web/20120203022122/http://www.silassewell.com/blog/2010/06/03/node-js-https-ssl-server-example/
openssl genrsa -out privatekey.pem 1024
openssl req -new -key privatekey.pem -out certrequest.csr
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
[2] Convert PEM to DER
Ref: https://www.sslshopper.com/ssl-converter.html
openssl x509 -outform der -in certificate.pem -out certificate.der
[3] View PEM encoded certificate
Ref: https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them
openssl x509 -in certificate.pem -text -noout
[4] View DER encoded Certificate
openssl x509 -in certificate.der -inform der -text -noout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment