Signing an XML

public void sign()
XmlDocument doc = new XmlDocument();

SignedXml signer = new SignedXml(doc);
RSA key = new RSACryptoServiceProvider();

signer.KeyInfo = new KeyInfo();
signer.KeyInfo.AddClause(new RSAKeyValue(key));
signer.SigningKey = key;

Reference orderRef = new Reference(“”);
orderRef.AddTransform(new XmlDsigEnvelopedSignatureTransform());


txtOutput.Text = doc.InnerText;

This method will give the signed XML. This uses RSA Crtytography Algorithm.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: