I have a code to sign a string with A1 certificate successfull usin C#. I need to add a TimeStamp to this signature. This TimeStamp need went from a TimeStamp server like http://www.cryptopro.ru/tsp/tsp.srf I can't figure out how to put the TimeStamp to the signature. It's not a PDF sign, it's string sign. Anyone can help me please?
Code used to sign:
private byte[] Sign(string text)
{
// Find the certificate we’ll use to sign
X509Certificate2 cert = new X509Certificate2(@"C:\Users\1000084016.pfx", "Password");
RSACryptoServiceProvider csp = null;
// Get its associated CSP and private key
csp = (RSACryptoServiceProvider)cert.PrivateKey;
// Hash the data
SHA1Managed sha1 = new SHA1Managed();
UnicodeEncoding encoding = new UnicodeEncoding();
byte[] data;
data = encoding.GetBytes(text);
byte[] hash = sha1.ComputeHash(data);
// Sign the hash
return csp.SignHash(hash, CryptoConfig.MapNameToOID("SHA1"));
}