Created
December 14, 2020 20:57
-
-
Save kjivan/fa08984994d2b9d27d5b684d43e5d170 to your computer and use it in GitHub Desktop.
Create self-signed cert and p12 private cert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# https://stackoverflow.com/a/41366949 | |
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ | |
-keyout example.key -out example.crt -extensions san -config \ | |
<(echo "[req]"; | |
echo distinguished_name=req; | |
echo "[san]"; | |
echo subjectAltName=DNS:example.com,DNS:www.example.net,IP:10.0.0.1 | |
) \ | |
-subj "/CN=example.com" | |
# https://stackoverflow.com/a/21144736 | |
openssl pkcs12 -export -out keyStore.p12 -inkey example.pem -in example.crt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment