Created
January 23, 2017 05:03
-
-
Save jrotello/7b949683af4ece4ea451bdcb3f22ef13 to your computer and use it in GitHub Desktop.
Generate a new self-signed certificate using OpenSSL
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
"Generating new key pair..." | |
openssl.exe req -x509 -sha256 -newkey rsa:2048 -keyout cert.key -out cert.cer -days 365 | |
"Generating .pfx container..." | |
openssl.exe pkcs12 -export -in cert.cer -inkey cert.key -out cert.pfx | |
$x509 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 | |
$x509.Import((Resolve-Path .\cert.cer)) | |
$x509 | Format-List | |
[System.Convert]::ToBase64String($x509.GetRawCertData()) | |
Remove-Item .\cert.cer, .\cert.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment