我可以在没有代码签名 EKU 的情况下使用证书对自解压 exe 进行签名吗?

Can I sign a self-extracting exe with a certificate without the Code signing EKU?

我有一个使用 7zip (7z.sfx) 创建的自解压 .exe。我已经用 signtool 签名了。签名证书在我的本地机器存储中,它的根证书在 "Trusted root certificate authorities" 和 "Trusted publishers" 文件夹中。

我希望签名详细信息出现在 UAC 提示的发布者字段中,但它仍然显示 "Unknown Publisher"。有人知道发生了什么事吗?证书没有 "Code signing" EKU。这会导致问题吗?

This person had a similar problem, with no answers. This question 详细介绍了代码签名,但它仍然不适合我。

好吧,也许正如我所怀疑的那样,用于代码签名的 EKU 对于 UAC 来说是必不可少的。使用 vanilla 证书生成签名没有问题,但 UAC 将忽略使用非代码签名证书生成的签名,即使这些证书位于 Trusted Publisers、Trusted Root Authorities 等中。

用于代码签名的 eku 是 1.3.6.1.5.5.7.3.3

以下 PowerShell 命令可为您获取自签名代码签名证书...

New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname sby-port -type CodeSigningCert