Getting output of XmlDsigEnvelopedSignatureTransform

UnfasiaBags

New Member
I want to get direct output of an enveloped signature transform. This is the code how I do that:\[code\]private static void CheckTransform(){ XmlDocument document = new XmlDocument(); XmlDsigEnvelopedSignatureTransform envTransform = new XmlDsigEnvelopedSignatureTransform(); envTransform.Algorithm = SignedXml.XmlDsigEnvelopedSignatureTransformUrl; using (Stream s = new FileStream(_filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { document.Load(s); } envTransform.LoadInput(document); XmlDocument result = (XmlDocument)envTransform.GetOutput(typeof(XmlDocument)); result.Save(_outPath);}\[/code\]The file I'm applying the transform to is:\[code\]<?xml version="1.0" encoding="utf-8"?><root> <Data><![CDATA[123]]></Data> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI=""> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>...</DigestValue> </Reference> </SignedInfo> <SignatureValue>...</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>...</X509Certificate> </X509Data> </KeyInfo> </Signature></root>\[/code\]According to http://www.w3.org/2000/09/xmldsig#enveloped-signature, the transform should remove the signature from the resulting document. However, the resulting document is the same as the source one. What am I doing wrong?
 
Back
Top