moov-io / signedxml

pure go library for processing signed XML documents
MIT License
52 stars 44 forks source link

Misleading error "Unable to find Algorithm in CanonicalizationMethod element" #12

Closed ccuetoh closed 4 years ago

ccuetoh commented 4 years ago

I'm currently working on some rather old systems and was getting the "Unable to find Algorithm in CanonicalizationMethod element" error while signing an XML document. This error implies that signedxml is not able to find the element's attribute, yet this is also triggered by unsupported algorithms.

In the Sing method, if the check for the canonAlgoURI is successful, but the URI is not present in the CanonicalizationAlgorithms map, the error will default to the said error message.

The error was triggered by trying to use the now outdated ExclusiveCanonicalization 1.0 as the attribute for SignedInfo.CanonicalizationMethod (http://www.w3.org/TR/2001/REC-xml-c14n-20010315).

chenghonour commented 4 years ago

how to support old CanonicalizationMethod ? For some reasons, the following algorithm must be used in the project http://www.w3.org/TR/2001/REC-xml-c14n-20010315

ccuetoh commented 4 years ago

Will respond on error #14

chenghonour commented 4 years ago

@CamiloHernandez Can you use this algorithm? http://www.w3.org/TR/2001/REC-xml-c14n-20010315