Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save christopher-baek/7a94ea1a9492cec7d908dc896ee551d1 to your computer and use it in GitHub Desktop.
Save christopher-baek/7a94ea1a9492cec7d908dc896ee551d1 to your computer and use it in GitHub Desktop.
.Certificate Management Examples
# Names
ORGANIZATION="MyOrganization"
# Files
CSR=${ORGANIZATION}.csr
KEY=${ORGANIZATION}.key
openssl req -new -newkey rsa:4096 -nodes -out ${CSR} -keyout ${KEY} -subj "/C=US/ST=Illinois/L=Chicago/O=${ORGANIZATION}/CN=myorganization.com"
OPENSSL_CMD=$(which openssl)
EXPIRATION_DAYS=365
RSA_BITS=2048
KEY_FILENAME=certificate.key
CERTIFICATE_FILENAME=certificate.pem
${OPENSSL_CMD} req -x509 -nodes -days ${EXPIRATION_DAYS} -newkey rsa:${RSA_BITS} -keyout ${KEY_FILENAME} -out ${CERTIFICATE_FILENAME}
openssl rsa -in ${ENCRYPTED_KEY} -out ${DECRYPTED_KEY}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment