Skip to content

Commit ffd9d9a

Browse files
rowland66adamdecaf
andauthored
Add support for corrected C14N10 REC canonicalization algorithm (moov-io#31)
* Added ProcessElement() method to CanonicalizationAlgorithm interface. This method supports passing an element within a larger xml document to the canonicalization algorithm. Some canonicalization algorithms require information from outside the element being canonicalized in order to perform correct canonicalization. * Added ProcessDocument() method to CanonicalizationAlgorithm interface. This method improves performance for transformations. --------- Co-authored-by: Adam Shannon <[email protected]>
1 parent bd11d2e commit ffd9d9a

11 files changed

+290
-68
lines changed

canonicalization.go

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package signedxml
2+
3+
import (
4+
"github.com/beevik/etree"
5+
dsig "github.com/russellhaering/goxmldsig"
6+
)
7+
8+
type c14N10RecCanonicalizer struct {
9+
WithComments bool
10+
}
11+
12+
func (c *c14N10RecCanonicalizer) ProcessElement(inputXML *etree.Element, transformXML string) (outputXML string, err error) {
13+
transformedXML, err := c.processElement(inputXML, transformXML)
14+
if err != nil {
15+
return "", err
16+
}
17+
return transformedXML, nil
18+
}
19+
20+
func (c *c14N10RecCanonicalizer) ProcessDocument(doc *etree.Document, transformXML string) (outputXML string, err error) {
21+
22+
transformedXML, err := c.processElement(doc.Root(), transformXML)
23+
if err != nil {
24+
return "", err
25+
}
26+
return transformedXML, nil
27+
}
28+
29+
func (c c14N10RecCanonicalizer) Process(inputXML string, transformXML string) (outputXML string, err error) {
30+
doc := etree.NewDocument()
31+
err = doc.ReadFromString(inputXML)
32+
if err != nil {
33+
return "", err
34+
}
35+
return c.ProcessDocument(doc, transformXML)
36+
}
37+
38+
func (c *c14N10RecCanonicalizer) processElement(inputXML *etree.Element, transformXML string) (outputXML string, err error) {
39+
var canon dsig.Canonicalizer
40+
if c.WithComments {
41+
canon = dsig.MakeC14N10WithCommentsCanonicalizer()
42+
} else {
43+
canon = dsig.MakeC14N10RecCanonicalizer()
44+
}
45+
46+
out, err := canon.Canonicalize(inputXML)
47+
if err != nil {
48+
return "", err
49+
}
50+
return string(out), nil
51+
}
52+
53+
type c14N11Canonicalizer struct {
54+
WithComments bool
55+
}
56+
57+
func (c *c14N11Canonicalizer) ProcessElement(inputXML *etree.Element, transformXML string) (outputXML string, err error) {
58+
transformedXML, err := c.processElement(inputXML, transformXML)
59+
if err != nil {
60+
return "", err
61+
}
62+
return transformedXML, nil
63+
}
64+
65+
func (c *c14N11Canonicalizer) ProcessDocument(doc *etree.Document, transformXML string) (outputXML string, err error) {
66+
67+
transformedXML, err := c.processElement(doc.Root(), transformXML)
68+
if err != nil {
69+
return "", err
70+
}
71+
return transformedXML, nil
72+
}
73+
74+
func (c c14N11Canonicalizer) Process(inputXML string, transformXML string) (outputXML string, err error) {
75+
doc := etree.NewDocument()
76+
err = doc.ReadFromString(inputXML)
77+
if err != nil {
78+
return "", err
79+
}
80+
return c.ProcessDocument(doc, transformXML)
81+
}
82+
83+
func (c *c14N11Canonicalizer) processElement(inputXML *etree.Element, transformXML string) (outputXML string, err error) {
84+
var canon dsig.Canonicalizer
85+
if c.WithComments {
86+
canon = dsig.MakeC14N11WithCommentsCanonicalizer()
87+
} else {
88+
canon = dsig.MakeC14N11Canonicalizer()
89+
}
90+
91+
out, err := canon.Canonicalize(inputXML)
92+
if err != nil {
93+
return "", err
94+
}
95+
return string(out), nil
96+
}

envelopedsignature.go

+46-13
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,61 @@ import (
1212
// algorithm
1313
type EnvelopedSignature struct{}
1414

15-
// Process is called to transfrom the XML using the EnvelopedSignature
16-
// algorithm
17-
func (e EnvelopedSignature) Process(inputXML string,
18-
transformXML string) (outputXML string, err error) {
15+
// see CanonicalizationAlgorithm.ProcessElement
16+
func (e EnvelopedSignature) ProcessElement(inputXML *etree.Element, transformXML string) (outputXML string, err error) {
17+
transformedXML, err := e.processElement(inputXML.Copy(), transformXML)
18+
if err != nil {
19+
return "", err
20+
}
1921

2022
doc := etree.NewDocument()
21-
doc.ReadFromString(inputXML)
22-
sig := doc.FindElement(".//Signature")
23-
if sig == nil {
24-
return "", errors.New("signedxml: unable to find Signature node")
23+
doc.SetRoot(transformedXML)
24+
docString, err := doc.WriteToString()
25+
if err != nil {
26+
return "", err
2527
}
28+
//logger.Println(docString)
29+
return docString, nil
30+
}
2631

27-
sigParent := sig.Parent()
28-
elem := sigParent.RemoveChild(sig)
29-
if elem == nil {
30-
return "", errors.New("signedxml: unable to remove Signature element")
31-
}
32+
// see CanonicalizationAlgorithm.ProcessDocument
33+
func (e EnvelopedSignature) ProcessDocument(doc *etree.Document,
34+
transformXML string) (outputXML string, err error) {
3235

36+
transformedRoot, err := e.processElement(doc.Root().Copy(), transformXML)
37+
if err != nil {
38+
return "", err
39+
}
40+
doc.SetRoot(transformedRoot)
3341
docString, err := doc.WriteToString()
3442
if err != nil {
3543
return "", err
3644
}
3745
//logger.Println(docString)
3846
return docString, nil
3947
}
48+
49+
// see CanonicalizationAlgorithm.Process
50+
func (e EnvelopedSignature) Process(inputXML string, transformXML string) (outputXML string, err error) {
51+
doc := etree.NewDocument()
52+
err = doc.ReadFromString(inputXML)
53+
if err != nil {
54+
return "", err
55+
}
56+
return e.ProcessDocument(doc, transformXML)
57+
}
58+
59+
func (e EnvelopedSignature) processElement(inputXML *etree.Element, transformXML string) (outputXML *etree.Element, err error) {
60+
sig := inputXML.FindElement(".//Signature")
61+
if sig == nil {
62+
return nil, errors.New("signedxml: unable to find Signature node")
63+
}
64+
65+
sigParent := sig.Parent()
66+
elem := sigParent.RemoveChild(sig)
67+
if elem == nil {
68+
return nil, errors.New("signedxml: unable to remove Signature element")
69+
}
70+
71+
return inputXML, nil
72+
}

examples/examples.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func testValidator() {
2929
} else {
3030
err = validator.Validate()
3131
if err != nil {
32-
fmt.Printf("Validation Error: %s", err)
32+
fmt.Printf("Validation Error: %s\n", err)
3333
} else {
3434
fmt.Println("Example Validation Succeeded")
3535
}
@@ -59,7 +59,7 @@ func testExclCanon() {
5959
resultXML, err := transform.Process(input, "")
6060

6161
if err != nil {
62-
fmt.Printf("Transformation Error: %s", err)
62+
fmt.Printf("Transformation Error: %s\n", err)
6363
} else {
6464
if resultXML == output {
6565
fmt.Println("Example Tranformation Succeeded")

exclusivecanonicalization.go

+25-12
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,36 @@ type ExclusiveCanonicalization struct {
4949
namespaces map[string]string
5050
}
5151

52-
// Process is called to transfrom the XML using the ExclusiveCanonicalization
53-
// algorithm
54-
func (e ExclusiveCanonicalization) Process(inputXML string,
52+
// see CanonicalizationAlgorithm.ProcessElement
53+
func (e ExclusiveCanonicalization) ProcessElement(inputXML *etree.Element, transformXML string) (outputXML string, err error) {
54+
doc := etree.NewDocument()
55+
doc.SetRoot(inputXML.Copy())
56+
return e.processDocument(doc, transformXML)
57+
}
58+
59+
// see CanonicalizationAlgorithm.ProcessDocument
60+
func (e ExclusiveCanonicalization) ProcessDocument(doc *etree.Document,
5561
transformXML string) (outputXML string, err error) {
5662

57-
e.namespaces = make(map[string]string)
63+
return e.processDocument(doc.Copy(), transformXML)
64+
}
5865

66+
// see CanonicalizationAlgorithm.Process
67+
func (e ExclusiveCanonicalization) Process(inputXML string, transformXML string) (outputXML string, err error) {
5968
doc := etree.NewDocument()
60-
doc.WriteSettings.CanonicalEndTags = true
61-
doc.WriteSettings.CanonicalText = true
62-
doc.WriteSettings.CanonicalAttrVal = true
63-
6469
err = doc.ReadFromString(inputXML)
6570
if err != nil {
6671
return "", err
6772
}
73+
return e.ProcessDocument(doc, transformXML)
74+
}
75+
76+
func (e ExclusiveCanonicalization) processDocument(doc *etree.Document, transformXML string) (outputXML string, err error) {
77+
e.namespaces = make(map[string]string)
78+
79+
doc.WriteSettings.CanonicalEndTags = true
80+
doc.WriteSettings.CanonicalText = true
81+
doc.WriteSettings.CanonicalAttrVal = true
6882

6983
e.loadPrefixList(transformXML)
7084
e.processDocLevelNodes(doc)
@@ -151,7 +165,7 @@ func (e ExclusiveCanonicalization) processRecursive(node *etree.Element,
151165
for _, child := range node.Child {
152166
oldNamespaces := e.namespaces
153167
e.namespaces = copyNamespace(oldNamespaces)
154-
168+
155169
switch child := child.(type) {
156170
case *etree.Comment:
157171
if !e.WithComments {
@@ -160,7 +174,7 @@ func (e ExclusiveCanonicalization) processRecursive(node *etree.Element,
160174
case *etree.Element:
161175
e.processRecursive(child, newPrefixesInScope, newDefaultNS)
162176
}
163-
177+
164178
e.namespaces = oldNamespaces
165179
}
166180
}
@@ -209,7 +223,7 @@ func (e ExclusiveCanonicalization) renderAttributes(node *etree.Element,
209223
attr.Space != "xmlns" &&
210224
!contains(prefixesInScope, attr.Space) {
211225

212-
if attr.Space != "xml"{
226+
if attr.Space != "xml" {
213227
nsListToRender["xmlns:"+attr.Space] = e.namespaces[attr.Space]
214228
}
215229

@@ -316,4 +330,3 @@ func copyNamespace(namespaces map[string]string) map[string]string {
316330
}
317331
return newVersion
318332
}
319-

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ go 1.20
44

55
require (
66
github.com/beevik/etree v1.1.0
7+
github.com/russellhaering/goxmldsig v1.4.0
78
github.com/smartystreets/goconvey v1.7.2
89
)
910

1011
require (
1112
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
13+
github.com/jonboulle/clockwork v0.2.2 // indirect
1214
github.com/jtolds/gls v4.20.0+incompatible // indirect
1315
github.com/smartystreets/assertions v1.2.0 // indirect
1416
)

go.sum

+32
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
11
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
22
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
3+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
4+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
5+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
36
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
47
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
8+
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
9+
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
510
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
611
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
12+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
13+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
14+
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
15+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
16+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
17+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
18+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
19+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
20+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
21+
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
22+
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
23+
github.com/russellhaering/goxmldsig v1.3.0 h1:DllIWUgMy0cRUMfGiASiYEa35nsieyD3cigIwLonTPM=
24+
github.com/russellhaering/goxmldsig v1.3.0/go.mod h1:gM4MDENBQf7M+V824SGfyIUVFWydB7n0KkEubVJl+Tw=
25+
github.com/russellhaering/goxmldsig v1.3.1-0.20230419164806-1bb67cd2d6cf h1:6N2wmur1VIIKc8BxzgoY1xvvkkMn0hUE2rdx1pUGjCk=
26+
github.com/russellhaering/goxmldsig v1.3.1-0.20230419164806-1bb67cd2d6cf/go.mod h1:gM4MDENBQf7M+V824SGfyIUVFWydB7n0KkEubVJl+Tw=
27+
github.com/russellhaering/goxmldsig v1.4.0 h1:8UcDh/xGyQiyrW+Fq5t8f+l2DLB1+zlhYzkPUJ7Qhys=
28+
github.com/russellhaering/goxmldsig v1.4.0/go.mod h1:gM4MDENBQf7M+V824SGfyIUVFWydB7n0KkEubVJl+Tw=
729
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
830
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
931
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
1032
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
33+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
34+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
35+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1136
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
1237
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
1338
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
1439
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
1540
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
41+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
42+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
43+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
44+
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
45+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
46+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
47+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

signedxml.go

+22-9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414

1515
"github.com/beevik/etree"
16+
dsig "github.com/russellhaering/goxmldsig"
1617
)
1718

1819
var logger = log.New(os.Stdout, "DEBUG-SIGNEDXML: ", log.Ldate|log.Ltime|log.Lshortfile)
@@ -47,6 +48,10 @@ func init() {
4748
"http://www.w3.org/2000/09/xmldsig#enveloped-signature": EnvelopedSignature{},
4849
"http://www.w3.org/2001/10/xml-exc-c14n#": ExclusiveCanonicalization{},
4950
"http://www.w3.org/2001/10/xml-exc-c14n#WithComments": ExclusiveCanonicalization{WithComments: true},
51+
dsig.CanonicalXML11AlgorithmId.String(): &c14N11Canonicalizer{},
52+
dsig.CanonicalXML11WithCommentsAlgorithmId.String(): &c14N11Canonicalizer{WithComments: true},
53+
dsig.CanonicalXML10RecAlgorithmId.String(): &c14N10RecCanonicalizer{},
54+
dsig.CanonicalXML10WithCommentsAlgorithmId.String(): &c14N10RecCanonicalizer{WithComments: true},
5055
}
5156
}
5257

@@ -60,6 +65,18 @@ func init() {
6065
// no child elements in Transform (or CanonicalizationMethod), then an empty
6166
// string will be passed through.
6267
type CanonicalizationAlgorithm interface {
68+
// ProcessElement is called to transform an XML Element within an XML Document
69+
// using the implementing algorithm
70+
ProcessElement(inputXML *etree.Element, transformXML string) (outputXML string, err error)
71+
72+
// ProcessDocument is called to transform an XML Document using the implementing
73+
// algorithm.
74+
ProcessDocument(doc *etree.Document, transformXML string) (outputXML string, err error)
75+
76+
// Process is called to transform a string containing XML text using the implementing
77+
// algorithm. The inputXML parameter should contain a complete XML Document. It is not
78+
// correct to use this function on XML fragments. Retained for backward compatability.
79+
// Use ProcessElement or ProcessDocument if possible.
6380
Process(inputXML string, transformXML string) (outputXML string, err error)
6481
}
6582

@@ -68,9 +85,10 @@ type CanonicalizationAlgorithm interface {
6885
// CanonicalizationAlgorithm interface.
6986
//
7087
// Implementations are provided for the following transforms:
71-
// http://www.w3.org/2001/10/xml-exc-c14n# (ExclusiveCanonicalization)
72-
// http://www.w3.org/2001/10/xml-exc-c14n#WithComments (ExclusiveCanonicalizationWithComments)
73-
// http://www.w3.org/2000/09/xmldsig#enveloped-signature (EnvelopedSignature)
88+
//
89+
// http://www.w3.org/2001/10/xml-exc-c14n# (ExclusiveCanonicalization)
90+
// http://www.w3.org/2001/10/xml-exc-c14n#WithComments (ExclusiveCanonicalizationWithComments)
91+
// http://www.w3.org/2000/09/xmldsig#enveloped-signature (EnvelopedSignature)
7492
//
7593
// Custom implementations can be added to the map
7694
var CanonicalizationAlgorithms map[string]CanonicalizationAlgorithm
@@ -280,12 +298,7 @@ func processTransform(transform *etree.Element,
280298
}
281299
}
282300

283-
docString, err := docIn.WriteToString()
284-
if err != nil {
285-
return nil, err
286-
}
287-
288-
docString, err = transformAlgo.Process(docString, transformContent)
301+
docString, err := transformAlgo.ProcessDocument(docIn, transformContent)
289302
if err != nil {
290303
return nil, err
291304
}

0 commit comments

Comments
 (0)