由SelfSSL7生成的SSL证书失败。 有任何想法吗?

我有一个Web服务器(用于testing),我已经分配了3个IP地址。 目标是有3个SSL保护的网站。

我已经使用selfSSL7.exe工具来生成证书:

selfssl7 /N cn=app.test.local /v 3650 /Q /T /X /F app.test.local.pfx /W password selfssl7 /N cn=api.test.local /v 3650 /Q /T /X /F api.test.local.pfx /W password selfssl7 /N cn=www.test.local /v 3650 /Q /T /X /F www.test.local.pfx /W password 

这会将证书自动安装到用户个人证书存储(“我”)及其受信任的根证书颁发机构存储(“根”)中。

为了确定以前的尝试没有任何人工制品,我首先运行:

 certutil –delstore MY app.test.local certutil –delstore root app.test.local etc... for the other sites. 

从问题中删除两家商店的证书。

我的问题是,当我运行:

 certutil -store my OR certutil -store root 

validation证书是否正常,我的新证书(不是全部3个)显示以下错误:

 ERROR: Certificate public key does NOT match stored keyset 

我不明白为什么会这样。 有任何想法吗?

更新:

我注意到,在我逐步申请3份证书的时候,申请的最后一张证书是正确的,以前的任何证书都是无效的。 我也注意到,所有的证书都有相同的“唯一容器名称”。 这可能会导致我的问题? 我想知道在SelfSSL7中是否有修复这个问题?

完整的输出如下:

 ================ Certificate 2 ================ Serial Number: 152ac3a087bf4db944a57aae15b1567e Issuer: CN=www.test.local NotBefore: 30/09/2011 10:56 AM NotAfter: 27/09/2021 10:00 AM Subject: CN=www.test.local Signature matches Public Key Root Certificate: Subject matches Issuer Template: Cert Hash(sha1): 7f 6f e3 07 5d 29 e0 e7 24 4a 32 75 39 27 5c 71 ed 0f d6 e1 Key Container = my Unique container name: 85c14c8bb87418bd9929adba2a9e9412_2259fcf6-b658-4ba5-aac3-35980c9148c2 Provider = Microsoft RSA SChannel Cryptographic Provider Certificate Public Key: Version: 3 Public Key Algorithm: Algorithm ObjectId: 1.2.840.113549.1.1.1 RSA (RSA_SIGN) Algorithm Parameters: 05 00 Public Key Length: 1024 bits Public Key: UnusedBits = 0 0000 30 81 89 02 81 81 00 c2 00 ed 38 1b 8d 01 16 3f 0010 84 d2 97 7f 89 81 3f 19 c9 6b 8f d4 25 85 5d c8 0020 89 b7 46 de 4a 1e 4f b1 6f ae 89 02 15 53 7d 04 0030 d4 a6 98 7e 76 4b fc 31 02 3e 47 40 a3 d4 f6 6c 0040 8b 24 ab ff 26 d1 46 c8 1a c2 6c 67 b6 30 91 f8 0050 68 6f 95 c5 30 1a 38 49 77 6b 04 b7 8e 75 2e 8d 0060 2f 70 85 65 6d 87 3e 6b 4c 4c f5 51 26 44 8c 77 0070 51 dc e0 05 1d 48 9e 00 60 0e 45 19 ff 6f 44 77 0080 c2 ec 75 50 58 05 b1 02 03 01 00 01 Key Id Hash(rfc-sha1): 70 2f c9 e6 90 cb 24 97 94 b9 ae 22 ca 17 08 04 8e a4 e9 c6 Key Id Hash(sha1): c2 83 14 50 76 18 5b 89 f6 f8 e3 7c 1e 93 68 bb d9 9e d6 26 Container Public Key: Public Key Algorithm: Algorithm ObjectId: 1.2.840.113549.1.1.1 RSA (RSA_SIGN) Algorithm Parameters: NULL Public Key Length: 1024 bits Public Key: UnusedBits = 0 0000 30 81 89 02 81 81 00 af d3 6d e1 ac b7 f0 8a 9b 0010 fd eb 99 08 73 e1 f7 9c 41 a5 51 82 a5 f8 f7 93 0020 a8 0f 74 d6 74 a9 04 3e 1a d9 a6 7c 56 01 a0 e2 0030 2d 92 ec c5 13 c9 0e c7 27 79 3c 5d 4d 31 e4 0e 0040 0c 13 0e d0 b1 9d 2d 4d 8f c9 e8 8a 89 5b 9c 97 0050 9f 38 6e 02 f1 19 7c 6a 4a db e9 b6 d0 80 b7 d8 0060 ce a1 a3 13 3f e3 50 95 8e 02 75 73 94 5e 84 ed 0070 36 17 a5 c4 50 c2 23 bb 22 dc fd 39 57 ed bd f0 0080 9e eb da 15 d7 87 9d 02 03 01 00 01 Key Id Hash(rfc-sha1): 08 f4 65 d7 00 06 bb cd bb 37 1b e9 7d 48 17 18 cb 35 30 6d Key Id Hash(sha1): 03 45 68 3a 1d 60 a1 d6 f6 5b 34 98 23 b1 50 11 d6 2d 4e bd ERROR: Certificate public key does NOT match stored keyset Encryption test FAILED 

我没有使用SelfSSL7,而是尝试使用内部的“makecert”工具,我没有任何问题与它生成的证书。

这是创build证书的命令,​​仅将其安装到当前机器上的“我的”(个人)证书存储区,并将其输出到CER文件以供其他机器使用。

对于我的makecert实用程序可以在C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64

 makecert.exe -r -pe -a SHA256 -ss my -sr LocalMachine -n "CN="app.test.local -b 01/01/2011 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.1 -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 app.test.local.cer 

希望能帮助别人。

我注意到,在我逐步申请3份证书的时候,申请的最后一张证书是正确的,以前的任何证书都是无效的。 我也注意到,所有的证书都有相同的“唯一容器名称”。 这可能会导致我的问题?

我认为你已经在这里头了。 “唯一容器名称”是位于C:\ Documents and Settings \ All Users \ Application Data \ Microsoft \ Crypto \ RSA \ MachineKeys上的“密钥容器”的文件名。 据我所知,一个关键的容器是一个公钥/私钥的包装。 您可以在运行SelfSSL时检查此文件夹中的文件,并且每次运行SelfSSL时都会更新对应于“唯一容器名称”的文件的修改date。 (顺便说一句,用文本编辑器打开这个文件会让你看到容器的逻辑名,在这种情况下它是“SELFSSL”。

因此,SelfSSL似乎被写入每次运行时重新使用相同的密钥容器,这意味着创build一个新的公钥/私钥。 我认为这意味着任何在SelfSSL重新运行后留下的公钥都没有私钥(它可能认为它有一个私钥,但是密钥容器不再具有它的密码对应的私钥)。

在我的情况下,这导致所有的HTTPS请求绑定到这些先前的证书,以重置服务器连接失败。 在事件查看器中,我看到“致命的警报已生成并发送到远程端点,这可能导致连接终止,TLS协议定义的致命错误代码为20,Windows SChannel错误状态为960。

(我正在使用SelfSSL,但是看起来和你在SelfSSL7中看到的是一样的问题)