Click here to Skip to main content
14,640,669 members
Rate this:
Please Sign up or sign in to vote.
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:

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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100