如何在c#中进行数字签名时为证书添加私钥? [英] How to add private key to a certificate during digital signature in c#?

查看:223
本文介绍了如何在c#中进行数字签名时为证书添加私钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中的数字签名期间向证书添加私钥?



我在创建示例证书时尝试使用makecert工具,但它不起作用。

How to add private key to a certificate during digital signature in c#?

I tried using makecert tool while creating a sample certificate but it didn't work.

推荐答案

没有添加私钥这样的东西。如果您了解公钥加密的工作原理,您将会看到它。您只能使用唯一密钥对签署任何数据,如果是证书,则只能使用整个证书签署。两个键基本上以独特的方式相互连接,一个键在没有另一个键的情况下不起作用且无法替换。这是一个整体实体。请阅读:

https://en.wikipedia.org/wiki/Public-key_cryptography [ ^ ],

https://en.wikipedia.org/wiki/Digital_signature [ ^ ],

https://en.wikipedia.org/wiki/X.509 [ ^ ]。



Makecert.exe当然可行。我不知道你是怎么搞砸了这些步骤的。也许您需要更全面地阅读文档: https:// msdn。 microsoft.com/en-us/library/bfsktky3%28v=vs.110%29.aspx [ ^ ]。



如果你仍然迷路,您需要提供有关 您尝试过的内容 重现步骤的详细信息。< br $>


-SA
There is no such thing as "adding a private key". If you read on how public-key cryptography works, you will see it. You can only sign any data with a unique key pair, or, in case of certificates, with the whole certificate. Two keys are essentially connected to each other in a unique way, one key does not work without another one and cannot be replaced. This is a holistic entity, the pair. Please read:
https://en.wikipedia.org/wiki/Public-key_cryptography[^],
https://en.wikipedia.org/wiki/Digital_signature[^],
https://en.wikipedia.org/wiki/X.509[^].

And Makecert.exe quite certainly works. I have no idea how did you screw up the steps. Maybe you need to read the documentation more thoroughly: https://msdn.microsoft.com/en-us/library/bfsktky3%28v=vs.110%29.aspx[^].

If you are still lost, you will need to provide detailed information on what you have tried, steps to reproduce.

—SA


这篇关于如何在c#中进行数字签名时为证书添加私钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆