c# - Sign XML with digital signature -
i'm working web-service requires digitally signed xml posted via http post request.
gave me 1 file (key.dat) should apply xml.
how can it?
you can take on here:
private static xmlelement getxmldigitalsignature(xmldocument x, asymmetricalgorithm key) { var signedxml = new signedxml(x) { signingkey = key }; var reference = new reference { uri = "", transformchain = new transformchain(), }; reference.addtransform(new xmldsigenvelopedsignaturetransform()); signedxml.addreference(reference); signedxml.computesignature(); return signedxml.getxml(); } var signature = getxmldigitalsignature(xmldocument, algorithm); xmldocument.firstchild.appendchild(xmldocument.importnode(signature, true));
Comments
Post a Comment