Skip to content

Instantly share code, notes, and snippets.

@cosine
Created September 13, 2012 21:21
Show Gist options
  • Save cosine/3717769 to your computer and use it in GitHub Desktop.
Save cosine/3717769 to your computer and use it in GitHub Desktop.
How to make a self-signed certificate quickly.
# Change key values below for your certificate.
# Quickly create self-signed server cert.
(umask 077 && openssl genrsa -out config/cert.key 2048)
openssl req -new -key cert.key -out cert.crt -x509 -days 7305 -set_serial 01 -config /dev/fd/3 -extensions cert_server 3<<__EOF__
[ req ]
distinguished_name = req_dn
prompt = no
[ req_dn ]
C = US
ST = Illinois
L = Chicago
O = Big Mega Corp
OU = Security Development
CN = www.example.com
emailAddress = webmaster@example.com
[ cert_server ]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment, keyAgreement
extendedKeyUsage = serverAuth
nsCertType = server
nsComment = "Self-Signed Web Server Certificate"
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer:always
subjectAltName = email:copy
issuerAltName = issuer:copy
__EOF__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment