我在为开发人员提供许多服务器和个人电脑的公司工作。服务器是win2003,开发PC是Windows XP。
在名为 preiis01 的服务器 Win2003 中,在预生产环境中,公司其他人使用任何其他用户(对我来说未知用户)安装客户端证书用于登录服务器 preiis01。
我使用我的用户“domainCompany\myuser”登录服务器 preiis01(使用终端服务器、Windows XP 的远程桌面)。
在 preiis01 中,
我执行 mmc -> 管理单元 -> 本地计算机的证书。在节点 -> 个人 -> 证书中,我看到了客户端证书:
发给
ENTIDAD 公司保险 SA - CIF A93 - 姓名 1 姓名 1
由...发出
FNMT 2 类 CA
在证书的属性中,我看到指纹:“93 bc a4 ad 58 c9 3c af 8b eb 0b 2f 86 c7 9d 81 70 a6 c4 13”
现在,我执行以下命令:
1.) FindPrivateKey My LocalMachine -n "CN=ENTIDAD COMPANY INSURE SA - CIF A93 - NOMBRE SURNAME1 NAME1" -a
我收到此错误:
FindPrivateKey 失败的原因如下:
没有密钥为“CN=ENTIDAD COMPANY INSURE SA - CIF A93 - NOMBRE SURNAME1 NAME1”的证书
’在商店里发现的。
2.) FindPrivateKey 我的本地机器 -t "93 bc a4 ad 58 c9 3c af 8b eb 0b 2f 86 c7 9d 81 70 a6 c4 13" –c
我得到这个:
*FindPrivateKey帮助用户找到X.50的私钥文件的位置
9 证书。
用法:FindPrivateKey [{ {-n } | {-t } } [-f | -d | -A]]
<subjectName> subject name of the certificate
<thumbprint> thumbprint of the certificate (use certmgr.exe to get it)
-f output file name only
-d output directory only
-a output absolute file name
例如FindPrivateKey 我的当前用户 -n "CN=John Doe"
例如FindPrivateKey 我的本地机器 -t "03 33 98 63 d0 47 e7 48 71 33 62 64 76 5
c 4c 9d 42 1d 6b 52" -c*
3.) winhttpcertcfg.exe -l -c LOCAL_MACHINE\My -s "ENTIDAD COMPANY INSURE SA - CIF A93 - NOMBRE SURNAME1 NAME1"
我收到此错误:
Microsoft (R) WinHTTP 证书
配置工具版权所有(C)
Microsoft Corporation 2001. 匹配
证书:
CN=ENTIDAD 公司保险 SA - CIF A93 - 姓名 1 姓名 1
组织单位=700012436
OU=FNMT 2 类 CA
O=FNMT
C=ES
Error:
未成功获取私钥的访问权限。这只能由安装证书的用户来完成。
未成功获取私钥的访问权限。
有什么建议 ??
更新:作者:Marcel Roma(社交 msdn 论坛)
该证书很可能是由您公司中的其他人(例如管理员)安装的。只有该人才能访问证书的私钥。下载FindPrivateKey工具,让管理员执行它找出保存私钥文件的目录,并让他设置所需的权限,以便进程可以访问该文件。
还有一些关于 Windows XP 由于编码问题而无法从文件中提取私钥的报告:
http://blogs.msdn.com/b/alejacma/archive/2010/01/11/winhttpcertcfg-tool-cannot-access-private-key-of-a-certificate.aspx http://blogs.msdn.com/b/alejacma/archive/2010/01/11/winhttpcertcfg-tool-cannot-access-private-key-of-a-certificate.aspx
Update:
域“domainCompany\Pre_Certificado”中的用户在存储本地计算机中安装证书。
domainCompany\Pre_Certificado 是管理员,位于 IIS_WPG 组中,具有本地策略:“作为服务登录”
我在 IIS 6.0 中为以下内容配置 AppPool Identity:domainCompany\Pre_Certificado
ASP.NET 应用程序使用身份执行::domainCompany\Pre_Certificado
我回收 AppPool 并执行应用程序,我得到 System.Security.Cryptography.CryptographicException: Cannot find thecertificate and private key for解密
如果我再次测试,使用domainCompany\Pre_Certificado用户登录服务器IIS中的会话,我在ASP.NET应用程序中调用页面,一切正常。
(注:使用终端服务器登录服务器IIS)
但是,如果在服务器 IIS 中注销会话(用户:domainCompany\Pre_Certificado),我会收到相同的错误:
System.Security.Cryptography.CryptographicException:找不到用于解密的证书和私钥
有什么建议 ??