SignedXml CanonicalizationMethod - http://www.w3.org/2006/12/xml-c14n11

Is it possible to use http://www.w3.org/2006/12/xml-c14n11 CanonicalizationMethod with SignedXml?

SignedXml signedXml = new SignedXml(xmlDoc); signedXml.SignedInfo.CanonicalizationMethod = "http://www.w3.org/2006/12/xml-c14n11"; 

throws

 System.Security.Cryptography.CryptographicException: Could not create the XML tr ansformation identified by the URI http://www.w3.org/2006/12/xml-c14n11. 

Thanks!

+5
source share
1 answer

It looks like it is not yet implemented by .NET.

https://msdn.microsoft.com/en-us/library/system.security.cryptography.xml.signedinfo.canonicalizationmethod(v=vs.110).aspx

You may need to create your own Transform class as follows:

 public class XmlDsigC14N11Transform: XmlDsigC14NTransform { public override void LoadInput(object obj) { //do something here base.LoadInput(obj); } public override object GetOutput() { //do something here return base.GetOutput(); } } 

And convert the conversion to " http://www.w3.org/2006/12/xml-c14n11 ".

 CryptoConfig.AddAlgorithm(typeof(XmlDsigC14N11Transform), "http://www.w3.org/2006/12/xml-c14n11"); 
+1
source

Source: https://habr.com/ru/post/1207886/


All Articles