【问题标题】:UnknownError when trying to sign code in Powershell尝试在 Powershell 中签署代码时出现 UnknownError
【发布时间】:2020-05-05 17:45:35
【问题描述】:

我已经在 Cert:\LocalMachine\Root 中创建了一个用于代码签名的证书,但是当我尝试签署我的程序 (example.exe) 时,它给了我未知错误

我已经尝试了所有可以在互联网上找到的解决方案,但没有一个有效。

$cert = New-SelfSignedCertificate -Subject "Certificate" -Type CodeSigningCert -CertStoreLocation cert:\LocalMachine\My

然后我打开证书管理器并将其移至受信任的根权限

Set-AuthenticodeSignature -FilePath 'C:\programs\example.exe' -Certificate $cert

错误:

SignerCertificate                   Status                    Path
-----------------                   ------                    ----
                                    UnknownError              example.exe

【问题讨论】:

  • 您的问题中没有足够的信息来诊断问题。确切的错误信息是什么? Set-AuthenticodeSignature 的帮助指出:“[...] 向任何支持主题接口包 (SIP) 的文件添加 Authenticode 签名。”你的*.exe 文件是这样吗?请直接更新您的问题(不要回复评论)。

标签: powershell code-signing


【解决方案1】:

在 PS 中运行 GCI 证书:\LocalMachine\My -CodeSigningCert 这将显示代码签名证书是否可用(应该显示指纹)

如果没有显示任何内容,则将证书从 Root* 移动到 LM\Personal 再试一次....被列为可用的证书。

再次尝试签名。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-05
    • 2022-07-21
    • 1970-01-01
    • 1970-01-01
    • 2012-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多