Storing private keys using DSACryptoServiceProvider

泄露秘密 提交于 2019-12-12 02:57:17

问题


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).

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?

Thanks in advance.


回答1:


Look here:

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

I think what you want to do is:

ExportParameters(true)

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



来源:https://stackoverflow.com/questions/1603801/storing-private-keys-using-dsacryptoserviceprovider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!