Hello!
What means can you canonize XML by http://www.w3.org/2001/10/xml-exc-c14n# ?
If not difficult, with an example ...
- @VladD Then I do not understand the problem. Lead to another canonical form and sign, why is it necessary to xml-exc-c14n? (By the way, do you not confuse cache and hash?) The problem is that XML is already being checked by a third-party service, and it just needs xml-exc-c14n, otherwise I would not create three questions here with the hope that at least one will have an answer that will give the ability to at least manually generate the XML of the desired type. - t1nk
- @ t1nk: But you already have a class that can generate the necessary XML. (SignedXML?) - VladD
- He signs XML without changing it. All the necessary manipulations are performed in it and I cannot get to them because it simply has neither properties, nor methods to look at canonized XML. What it gives out are the three tags that need to be inserted into the header of the original XML, that's all. - t1nk
- [XmlDsigC14NTransform Class] [1] is similar to what you need, but it seems not quite ... [1]: msdn.microsoft.com/en-us/library/… - t1nk
- Don't you think that this third-party service rejects your file, not because it is not in the correct xml-exc-c14n, but simply in its bug? Try to send guaranteed correct xml-exc-c14n and check the result. - VladD
|
2 answers
Here is the program:
using System.Xml.Linq; class Program { static void Main(string[] args) { XDocument doc = XDocument.Load(@"in.xml"); doc.Save(@"out.xml"); } }
turns the file
<?xml version="1.0" encoding="utf-8" ?><directorylist><dir>/dev/null</dir><dir>/dev/zero</dir></directorylist>
in this:
<?xml version="1.0" encoding="utf-8"?> <directorylist> <dir>/dev/null</dir> <dir>/dev/zero</dir> </directorylist>
Not sure about the standard, but maybe it will suit you.
- And not vice versa? By the way according to [xml-exc-c14n] [1] [1]: w3.org/2001/10/xml-exc-c14n - t1nk
- As for the contrary, I don’t know, I haven’t studied a specific format. And where did the cache in question come from? - VladD
- one@klopp: that is, you need not a "canonical representation", but a "representation by xml-exc-c14n"? Was misled by the question heading. Why then not to use this very "SignedXML class"? - VladD
- one@ t1nk: Still, explain what you need. Hope not to compare XML as strings? - VladD
- one@ t1nk: Then I do not understand the problem. Lead to another canonical form and sign, why is it necessary to xml-exc-c14n? (By the way, do you confuse cache and hash ?) - VladD
|