我尝试通过powershell创建一个自签名代码签名证书,通过VisualStudio2017对.NET程序集进行签名,然后将它作为pfx进行签名。pfx使用-ProtectTo参数作为受域保护的证书导出.守则如下:
$pfxLocation = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("Desktop"),"Certificates\")
New-Item -ItemType Directory -Path $pfxLocation -Force
$certificate = New-SelfSignedCertificate `
-CertStoreLocation "Cert:\LocalMachine" `
-FriendlyName "This is a code-signing certificate" `
-Subject "CN=Me" `
-Type CodeSigningCert `
-NotBefore ([System.DateTime]::Today) `
-NotAfter ([System.DateTime]::Today.AddMonths(6).AddDays(1)) `
-KeyExportPolicy Exportable
Move-Item -Destination "Cert:\LocalMachine\Root" -Path $certificate.PSPath
$newCertificateLocation = "Cert:\LocalMachine\Root\" + $certificate.Thumbprint
Get-ChildItem $newCertificateLocation | Export-PfxCertificate -FilePath ([System.IO.Path]::Combine($pfxLocation,"certificate.pfx")) -ProtectTo "Domain\Domain group 1", "Domain\Domain group 2"但是,Visual仍然需要一个不存在的密码.

拒绝来自使用-ProtectTo参数指定的某个域组的域用户的密码:

那么,它要求什么密码,为什么需要任何密码呢?因为它是受域名保护的,它不应该有,这正是我的目标。
更新
基本上,我们的想法是使用输出pfx与自动构建代理进行代码签名,对于这些代理来说,没有密码是必须的。
发布于 2021-02-16 17:13:42
此导出PFX没有密码。当通过GUI导入时,您可以使用空密码。
$cert = @(Get-ChildItem -Path 'Cert:\CurrentUser\My\07BAE0886EECC2019F0AE6CC68FE5C3EA98308F8')[0]
$certBytes = $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pfx)
[System.IO.File]::WriteAllBytes('S:\cert.pfx', $certBytes)发布于 2019-02-14 03:26:31
这个对你有用吗?
& certutil -v -privatekey certificate.pfx | ? {$_ -match "^PFX protected password: ""(?<password>.*)""$"} | % { $matches.password }https://stackoverflow.com/questions/51498409
复制相似问题