使用DSACryptoServiceProvider存储私钥 [英] Storing private keys using DSACryptoServiceProvider

查看:123
本文介绍了使用DSACryptoServiceProvider存储私钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将DSACryptoServiceProvider类与C#一起使用,以创建两个DLL:一个将具有验证和创建数字签名的能力,另一个将能够进行验证。基本上,我试图创建一个私钥/公钥对,并相应地将它们的密钥保存到文件中。

I'm trying to use the DSACryptoServiceProvider class with C# to create two DLLs: one will have the ability to verify and create digital signatures, the other will just be able to verify. Basically, I'm trying to create a private/public key pair and save they keys accordingly (to a file).

在使用ExportParameters()时遇到问题)。当我尝试导出包含私有信息的密钥(使用序列化)时,私有信息会自动消失。

I'm running into problems when using ExportParameters(). When I attempt to export the key containing the private information (using serialize), the private information is automatically nulled out.

是否有更好的存储密钥的方法?

Is there a better way to store the keys?

请先感谢。

推荐答案

查看此处:

http://msdn.microsoft.com/en-us/library/system.security .cryptography.dsacryptoserviceprovider.exportparameters(VS.80).aspx

我认为您想做的是:

ExportParameters(true)

true表示将导出私人零件

The 'true' means it'll export the private parts

这篇关于使用DSACryptoServiceProvider存储私钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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