问题
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