Skip to content

Instantly share code, notes, and snippets.

@kjivan
Created December 14, 2020 20:57
Show Gist options
  • Save kjivan/fa08984994d2b9d27d5b684d43e5d170 to your computer and use it in GitHub Desktop.
Save kjivan/fa08984994d2b9d27d5b684d43e5d170 to your computer and use it in GitHub Desktop.
Create self-signed cert and p12 private cert
#!/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