是否可以使用通配符 ssl 证书进行代码签名?

Is it possible to use a wildcard ssl certificate for code signing?

我有我公司 (*.mycompany.com) 的通配符证书,现在得到了对安装程序可执行文件进行数字签名的任务。 我将 Signtool.exe 与包含私钥和证书文件(包括中间证书)的生成的 pfx 文件一起使用,但它总是告诉我没有证书满足所有给定条件。 (在调试输出中我可以看到通配符证书被 EKU 过滤器过滤,中间证书和根证书被私钥过滤器过滤)。

windows 证书管理器说通配符证书只能用于服务器和客户端身份验证。我无法将代码签名添加到中间证书所具有的目的。

是否可以使用此通配符证书进行代码签名?我错过了什么吗?

如果您可以访问密钥,则始终可以使用该密钥。但在那种情况下,必须告知用于签名的代码忽略扩展密钥的使用。而且 - 更有问题 - 验证程序也必须跳过此检查。

但是由于您的证书缺少用于代码签名的扩展密钥用法,并且由于存在扩展密钥用法,因此X.509 v3 certificate specs 的以下部分有效:

If the extension is present, then the certificate MUST only be used for one of the purposes indicated. If multiple purposes are indicated the application need not recognize all purposes indicated, as long as the intended purpose is present. Certificate using applications MAY require that the extended key usage extension be present and that a particular purpose be indicated in order for the certificate to be acceptable to that application.

现在 id-kp-serverAuth 可能存在,而 id-kp-codeSigning 不存在,因此无法使用证书。

由于这些扩展由证书颁发机构签名,因此您不能简单地更改证书。如果您确实更改了扩展密钥的用法,那么证书中的签名验证将失败。


请注意,通常密钥和证书是单一用途。如果您需要代码签名证书,您可能必须创建新的密钥对和证书请求才能购买新证书。