如何使用在另一台计算机上创建的 X.509 证书?
我需要在一台计算机上使用 x509 证书加密 XML 文件,并能够在另一台计算机上使用相同的证书对其进行解密。它似乎不像微软建议的那样对我有用:
http://msdn。 microsoft.com/en-us/library/ms229744.aspx
解密过程在另一台计算机上总是失败!
我使用以下命令创建证书:
makecert -r -pe -n "CN=DEEP_201X" -b 01/01/2011 -e 01/01/2014 -sky exchange -ss my deep.cer
然后使用以下命令安装它:
certmgr /add deep.cer /s root
和尝试使用 FindPrivateKey.exe 实用程序获取其私钥:
FindPrivateKey My CurrentUser -n "CN=DEEP_201X"
效果很好。但是,当我执行所有相同的操作在另一台计算机上安装证书时,FindPrivateKey 将失败并显示
在商店中找不到密钥为“CN=DEEP_201X”的证书。
当我使用时,
certmgr /add deep.cer /s my
错误消息将如下所示:
无法获取私钥文件名
有人可以给我一些如何使其工作的建议吗?
I need to encrypt an XML file with a x509 certificate on one computer and be able to decrypt it with the same certificate on another computer. It doesn't seem to work for me like Microsoft suggests:
http://msdn.microsoft.com/en-us/library/ms229744.aspx
The decryption process always fails on another computer!
I create a certificate by using the following command:
makecert -r -pe -n "CN=DEEP_201X" -b 01/01/2011 -e 01/01/2014 -sky exchange -ss my deep.cer
Then I install it by using:
certmgr /add deep.cer /s root
And try to get its private key with the FindPrivateKey.exe utility:
FindPrivateKey My CurrentUser -n "CN=DEEP_201X"
Works great. However, when I perform all the same actions to install the certificate on another computer FindPrivateKey will fail with
No certificates with key 'CN=DEEP_201X' found in the store.
when I use
certmgr /add deep.cer /s my
the error message will be like this:
Unable to obtain private key file name
Could someone please give me a piece of advice on how to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑您只需要解密计算机上的私钥。
但是...
如果您确实需要两台计算机上的私钥,请注意 .cer 文件不包含私钥。
(我认为)makecert 在生成证书时将其添加到本地计算机。您可以使用 -sv 选项将其写出。然后为包含它的证书构建一个 pfx 容器。
我无法说服 certmgr 从命令行导入私钥。在 GUI 模式下使用它或使用 certmgr.msc 管理单元。
I suspect that you only need the private key on the decrypting computer.
However...
If you really need the private key on both computers, be aware that The .cer file does not include the private key.
(I think) makecert adds it to the local machine when it generates the cert. You can write it out using the -sv option. Then build a pfx container for the certificate that contains it.
I haven't been able to convince certmgr to import private keys from the commandline. Use it in gui mode or use the certmgr.msc snap-in.