Hello, I'm having difficulty signing a string using the RSA cryptography algorithm. I've search here in this forum for sample code, but I guess, signing is not that popular. Anyway, any help would be greatly appreciated. here is my code.
public static string SignMyData(string data2Sign)
{
AssignPr(); //assigning the parameter, container, etc
byte[] byte2Sign = System.Text.Encoding.UTF8.GetBytes(data2Sign);
StreamReader reader = new StreamReader(@"C:\MyPrivateKey.xml");
string pubPriKeyXML = reader.ReadToEnd();
rsa.FromXmlString(pubPriKeyXML); //(I'm getting error "Invalid syntax on line 1".)
reader.Close();
byte[] byteSig = rsa.SignData(byte2Sign, "SHA1");
return System.Text.Encoding.UTF8.GetString(ByteSig);
}
If anyone knows of a simple tutorial or can guide me through this, that would be great Thanks JC