Skip to content

Instantly share code, notes, and snippets.

@zdying
Created November 26, 2016 06:43
Show Gist options
  • Save zdying/d9d1e2b8c6e8e899cb180eec609c0116 to your computer and use it in GitHub Desktop.
Save zdying/d9d1e2b8c6e8e899cb180eec609c0116 to your computer and use it in GitHub Desktop.
利用CA根证书创建自签名证书
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create A Certificate ..."
openssl genrsa -out $DOMAIN.key 2048
echo "generate the certificate signing request ..."
#SUBJECT="/C=CN/ST=BeiJing/L=/O=hiipack/OU=DEV/CN=hiipack/[email protected]"
openssl req -new -key $DOMAIN.key -out $DOMAIN.csr
echo "sign the CSR, which requires the CA root key ..."
openssl x509 -req -in $DOMAIN.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out $DOMAIN.crt -days 500 -sha256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment