JL.
JL.

Reputation: 81342

C# how to remove a signature from an xml file?

I have an XML file that is digitally signed. Is there an easy way to remove this signature in C#?

Upvotes: 1

Views: 1815

Answers (1)

David Basarab
David Basarab

Reputation: 73351

I am assuming it has a <Signature> Element

You can just remove it using Linq and Resave.

// Find the <Signature> Element
XElement signElement = doc.Descendants("Signature").FirstOrDefault<XElement>();

signElement.Remove();

doc.Save("NonSignedFile.xml");

Upvotes: 3

Related Questions