goxmldsig
goxmldsig copied to clipboard
Support http://www.w3.org/2001/10/xml-exc-c14n#WithComments
Support for
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
Is now able to verify this:
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"/>
</ds:Transforms>
....
Maybe you should also add this part of code?
type CanonicalXML10ExclusiveComment struct{}
// MakeC14N11Canonicalizer constructs an inclusive canonicalizer.
func MakeCanonicalXML10ExclusiveComment() Canonicalizer {
return &CanonicalXML10ExclusiveComment{}
}
// Canonicalize transforms the input Element into a serialized XML document in canonical form.
func (c *CanonicalXML10ExclusiveComment) Canonicalize(el *etree.Element) ([]byte, error) {
scope := make(map[string]struct{})
return canonicalSerialize(canonicalPrep(el, scope))
}
func (c *CanonicalXML10ExclusiveComment) Algorithm() AlgorithmID {
return CanonicalXML10ExclusiveCommentAlgorithmId
}
@russellhaering Hey Russell, do you plan to proceed with this PR please? That would help us a lot! 🙇🏻
Anyway I think that this PR lacks one extra piece of code:
case CanonicalXML10ExclusiveCommentAlgorithmId:
canonicalSignedInfo = canonicalPrep(detachedSignedInfo, map[string]struct{}{})
in switch in findSignature
method in validate.go
Thanks in advance 🥇
I've just created updated PR (with master) and from my POV with all necessary changes https://github.com/russellhaering/goxmldsig/pull/74