Skip to content

Instantly share code, notes, and snippets.

@voicon
Forked from zthxxx/gen_ssl_cert.sh
Created February 8, 2021 07:58
Show Gist options
  • Save voicon/7b3737f5a998bb2cbc7b05152569806c to your computer and use it in GitHub Desktop.
Save voicon/7b3737f5a998bb2cbc7b05152569806c to your computer and use it in GitHub Desktop.
function gen_ssl_cert {
local prefix="${1}"
openssl genrsa -des3 -out "${prefix}.lock.key" 1024
openssl rsa -in "${prefix}.lock.key" -out "${prefix}.key"
rm "${prefix}.lock.key"
openssl req -new -key "${prefix}.key" -out "${prefix}.csr"
openssl x509 -req -days 3650 -in "${prefix}.csr" -signkey "${prefix}.key" -out "${prefix}.crt"
openssl pkcs12 -export -inkey "${prefix}.key" -in "${prefix}.crt" -out "${prefix}.pfx"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment