Skip to content

Instantly share code, notes, and snippets.

@codeprimate
Last active July 22, 2016 20:04
Show Gist options
  • Save codeprimate/48a229bf7bce6aaa7e43 to your computer and use it in GitHub Desktop.
Save codeprimate/48a229bf7bce6aaa7e43 to your computer and use it in GitHub Desktop.
SSL Key Generation
#!/bin/bash
[ -z "$DOMAIN" ] && DOMAIN=test.example.com
[ -z "$DOMAIN_FILE" ] && DOMAIN_FILE=$DOMAIN
# Generate Key
openssl genrsa -out $DOMAIN_FILE.key 2048
# Generate Certificate Signing Request
openssl req -new -sha256 -key $DOMAIN_FILE.key -out $DOMAIN_FILE.csr
#Check a Certificate Signing Request (CSR)
openssl req -text -noout -verify -in $DOMAIN_FILE.csr
#Check a private key
openssl rsa -in $DOMAIN_FILE.key -check
#Check a certificate
openssl x509 -in $DOMAIN_FILE.crt -text -noout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment