Generate self-signed certificates
You can use PowerShell to generate self-signed certificates. The PKI Client can be used to generate a self-signed certificate.
PowerShell
$cert = New-SelfSignedCertificate -DnsName @("contoso.com", "www.contoso.com") -CertStoreLocation "cert:LocalMachineMy"
The certificate will be generated, but for the purposes of testing, should be placed in a cert store for testing in a browser.
PowerShell
$certKeyPath = "c:certscontoso.com.pfx"
$password = ConvertTo-SecureString 'password' -AsPlainText -Force
$cert | Export-PfxCertificate -FilePath $certKeyPath -Password $password
$rootCert = $(Import-PfxCertificate -FilePath $certKeyPath -CertStoreLocation 'Cert:LocalMachineRoot' -Password $password)
At this point, the certificates should be viewable from an MMC snap-in.
可以直接win+R,输入certmgr.msc
Clean up
PowerShell
$cert | Remove-Item
Get-ChildItem $certFilePath | Remove-Item
$rootCert | Remove-item