Skip to content

Instantly share code, notes, and snippets.

@evgeniidatsiuk
Forked from zthxxx/gen_ssl_cert.sh
Created February 27, 2021 20:27
Show Gist options
  • Save evgeniidatsiuk/fc8582d92966e06b54f6f978ddbd5faf to your computer and use it in GitHub Desktop.
Save evgeniidatsiuk/fc8582d92966e06b54f6f978ddbd5faf 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