Skip to content

Instantly share code, notes, and snippets.

@georgechang
Last active April 3, 2021 15:46
Show Gist options
  • Save georgechang/4e233ce3e5005dfb3309a27ab0d2f0c3 to your computer and use it in GitHub Desktop.
Save georgechang/4e233ce3e5005dfb3309a27ab0d2f0c3 to your computer and use it in GitHub Desktop.
Create crt/key files
New-SelfSignedCertificate -DnsName domain.com -CertStoreLocation Cert:\LocalMachine\My -KeyExportPolicy Exportable -NotAfter (Get-Date).AddYears(3) | Export-PfxCertificate -FilePath .\cert.pfx -Password (ConvertTo-SecureString -String "secret" -AsPlainText -Force)
openssl pkcs12 -in cert.pfx -nocerts -out cert.key
openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment