Last active
November 5, 2017 14:02
-
-
Save naveed-ahmad-biz/981bee0e019c59e13b76579bafa43b92 to your computer and use it in GitHub Desktop.
This file contains 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
#generate certificate | |
$thumbprint = (New-SelfSignedCertificate ` | |
-Subject "CN=$env:COMPUTERNAME @ Sitecore, Inc." ` | |
-Type SSLServerAuthentication ` | |
-FriendlyName "$env:USERNAME Certificate").Thumbprint | |
#export certificate with password | |
$certificateFilePath = "C:\Temp\$thumbprint.pfx" | |
Export-PfxCertificate ` | |
-cert cert:\LocalMachine\MY\$thumbprint ` | |
-FilePath "$certificateFilePath" ` | |
-Password (Read-Host -Prompt "Enter password that would protect the certificate" -AsSecureString) | |
#convert it to base64 string (blob) | |
$fileContentBytes = get-content $certificateFilePath -Encoding Byte | |
[System.Convert]::ToBase64String($fileContentBytes) | Out-File "C:\Temp\$thumbprint.txt" | |
Write-Host "Your secure certificate blob is located at C:\Temp\$thumbprint.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment