Digital Signature
Digital Signature
using System;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml; // Ensure this package is installed via NuGet
using System.Xml;
// Load the XML file (ensure that the XML file path is correct).
//xmlDoc.Load("test1.xml");
xmlDoc.Load(@"D:\xmllabwork\test1.xml");
// Sign the XML document.
SignXml(xmlDoc, rsaKey);
// Get the XML representation of the signature and save it to an XmlElement object.
XmlElement xmlDigitalSignature = signedXml.GetXml();
<root>
<creditcard>
<number>19834209</number>
<expiry>02/02/2002</expiry>
</creditcard>
</root>