Last active
July 11, 2021 01:00
-
-
Save selfagency/4a122019335703f4d90d3adacaf2ead4 to your computer and use it in GitHub Desktop.
[generate ssl certs]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Generate a new private key and Certificate Signing Request | |
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key | |
#Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info) | |
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt | |
#Generate a certificate signing request (CSR) for an existing private key | |
openssl req -out CSR.csr -key privateKey.key -new | |
#Generate a certificate signing request based on an existing certificate | |
openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key | |
#Remove a passphrase from a private key | |
openssl rsa -in privateKey.pem -out newPrivateKey.pem | |
#Convert x509 to PEM | |
openssl x509 -in certificatename.cer -outform PEM -out certificatename.pem | |
#Convert PEM to DER | |
openssl x509 -outform der -in certificatename.pem -out certificatename.der | |
#Convert DER to PEM | |
openssl x509 -inform der -in certificatename.der -out certificatename.pem | |
#Convert PEM to P7B | |
openssl crl2pkcs7 -nocrl -certfile certificatename.pem -out certificatename.p7b -certfile CACert.cer | |
#Convert PKCS7 to PEM | |
openssl pkcs7 -print_certs -in certificatename.p7b -out certificatename.pem | |
#Convert PFX to PEM | |
openssl pkcs12 -in certificatename.pfx -nocerts -nodes -out certificatename.pem | |
#Convert PEM to PKCS8 | |
openSSL pkcs8 -in certificatename.pem -topk8 -nocrypt -out certificatename.pk8 | |
#Convert P7B to CER | |
openssl pkcs7 -print_certs -in certificatename.p7b -out certificatename.cer | |
#Convert CER and Private Key to PFX | |
openssl pkcs12 -export -in certificatename.cer -inkey privateKey.key -out certificatename.pfx -certfile cacert.cer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment