Click here to Skip to main content
15,938,218 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
Hi,

I have generated a key in XML format:

RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
string RSAXml = RSA.ToXmlString(true);

After having the key i used this key to SIGN the data as below:

C#
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024);
rsa.FromXmlString(RSAXml);
byte[] DataToSign = Encoding.UTF8.GetBytes("Some Date");
byte[] signByte = rsa.SignData(DataToSign, new SHA1CryptoServiceProvider());
string encodedDititalSign = Convert.ToBase64String(signByte);

The above code show error on line:
byte[] signByte = rsa.SignData(DataToSign, new SHA1CryptoServiceProvider());

Error Message:
---Keyset does not exist <br />
-mscorlib<br />

Please guide, how to resolve this issue.
Posted
Updated 9-Mar-13 11:32am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900