Created
September 20, 2023 18:27
-
-
Save keyan1603/b9b75d72e369b854492633180217678b to your computer and use it in GitHub Desktop.
Create SSL – Self signed certificate for your localhost website
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
$dnsname = "mysite.com" | |
$pwd = ConvertTo-SecureString -String "123456" -Force -AsPlainText | |
$print = (New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname $dnsname).Thumbprint | |
$path = "c:\Windows\temp\cert.pfx" | |
Export-PfxCertificate -cert cert:\localMachine\my\$print -FilePath $path -Password $pwd | |
$file = ( Get-ChildItem -Path $path ) | |
$file | Import-PfxCertificate -CertStoreLocation cert:\LocalMachine\Root -Password $pwd | |
Remove-Item $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment