Skip to content

Instantly share code, notes, and snippets.

@PierBover
Last active April 2, 2025 05:35
Show Gist options
  • Save PierBover/fb1674b41233714bbf3adb950b2752d9 to your computer and use it in GitHub Desktop.
Save PierBover/fb1674b41233714bbf3adb950b2752d9 to your computer and use it in GitHub Desktop.
Bash script to create SSL certs for dotnet in macOS
# create the pem files
openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -keyout mydomain-key.pem -out mydomain-cert.pem
mkcert -install
mkcert -key-file mydomain-key.pem -cert-file mydomain-cert.pem 127.0.0.1 localhost "*.mydomain.dev" mydomain.dev
echo "Certs created!"
# Convert PEM files to PFX format
openssl pkcs12 -export \
-out mydomain.pfx \
-inkey mydomain-key.pem \
-in mydomain-cert.pem \
-password pass:"secretpassword"
echo "Conversion complete! Created mydomain.pfx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment