转自:https://www.cnblogs.com/nuomibaibai/p/16706959.html
1.使用管理员打开PowerShell
2.输入命令New-SelfSignedCertificate -Type Custom -Subject "CN=发行者, O=公司名称, C=CN, L=省, S=市" -KeyUsage DigitalSignature -FriendlyName "ExeToolName" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") -NotAfter (Get-Date).AddYears(10)
记住此编码,下面会用到
3.输入命令$password = ConvertTo-SecureString -String 123456 -Force -AsPlainText
4.输入命令Export-PfxCertificate -cert "Cert:\CurrentUser\My\29725D1D72B137A2B5282AC31E2D3409F0294446" -FilePath E:\Desktop\自签名证书\Test\test.pfx -Password $password
上述会使用到的编码
5.查看证书
E:\Desktop\自签名证书\Test 这个路径下查看