简体   繁体   English

C#如何从xml文件中删除签名?

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

I have an XML file that is digitally signed. 我有一个经过数字签名的XML文件。 Is there an easy way to remove this signature in C#? 有没有简单的方法可以在C#中删除此签名?

I am assuming it has a <Signature> Element 我假设它有一个<Signature>元素

You can just remove it using Linq and Resave. 您可以使用Linq和Resave删除它。

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

signElement.Remove();

doc.Save("NonSignedFile.xml");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM