@@ -22,9 +22,18 @@ describe("Signature unit tests", function () {
22
22
const sig = new SignedXml ( { idMode : mode } ) ;
23
23
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
24
24
25
- sig . addReference ( { xpath : "//*[local-name(.)='x']" } ) ;
26
- sig . addReference ( { xpath : "//*[local-name(.)='y']" } ) ;
27
- sig . addReference ( { xpath : "//*[local-name(.)='w']" } ) ;
25
+ sig . addReference ( {
26
+ xpath : "//*[local-name(.)='x']" ,
27
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
28
+ } ) ;
29
+ sig . addReference ( {
30
+ xpath : "//*[local-name(.)='y']" ,
31
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
32
+ } ) ;
33
+ sig . addReference ( {
34
+ xpath : "//*[local-name(.)='w']" ,
35
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
36
+ } ) ;
28
37
29
38
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
30
39
sig . computeSignature ( xml ) ;
@@ -57,7 +66,10 @@ describe("Signature unit tests", function () {
57
66
58
67
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
59
68
60
- sig . addReference ( { xpath : "//*[@wsu:Id]" } ) ;
69
+ sig . addReference ( {
70
+ xpath : "//*[@wsu:Id]" ,
71
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
72
+ } ) ;
61
73
62
74
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
63
75
sig . computeSignature ( xml , {
@@ -78,7 +90,10 @@ describe("Signature unit tests", function () {
78
90
const xml = `<x xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' ${ prefix } Id='_1'></x>` ;
79
91
const sig = new SignedXml ( { idMode } ) ;
80
92
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
81
- sig . addReference ( { xpath : "//*[local-name(.)='x']" } ) ;
93
+ sig . addReference ( {
94
+ xpath : "//*[local-name(.)='x']" ,
95
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
96
+ } ) ;
82
97
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
83
98
sig . computeSignature ( xml ) ;
84
99
const signedXml = sig . getOriginalXmlWithIds ( ) ;
@@ -108,7 +123,10 @@ describe("Signature unit tests", function () {
108
123
109
124
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
110
125
111
- sig . addReference ( { xpath : "//*[local-name(.)='name']" } ) ;
126
+ sig . addReference ( {
127
+ xpath : "//*[local-name(.)='name']" ,
128
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
129
+ } ) ;
112
130
113
131
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
114
132
sig . computeSignature ( xml , {
@@ -140,7 +158,10 @@ describe("Signature unit tests", function () {
140
158
const sig = new SignedXml ( ) ;
141
159
142
160
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
143
- sig . addReference ( { xpath : "//*[local-name(.)='name']" } ) ;
161
+ sig . addReference ( {
162
+ xpath : "//*[local-name(.)='name']" ,
163
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
164
+ } ) ;
144
165
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
145
166
sig . computeSignature ( xml ) ;
146
167
@@ -159,7 +180,10 @@ describe("Signature unit tests", function () {
159
180
const sig = new SignedXml ( ) ;
160
181
161
182
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
162
- sig . addReference ( { xpath : "//*[local-name(.)='repository']" } ) ;
183
+ sig . addReference ( {
184
+ xpath : "//*[local-name(.)='repository']" ,
185
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
186
+ } ) ;
163
187
164
188
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
165
189
sig . computeSignature ( xml , {
@@ -186,7 +210,10 @@ describe("Signature unit tests", function () {
186
210
const sig = new SignedXml ( ) ;
187
211
188
212
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
189
- sig . addReference ( { xpath : "//*[local-name(.)='repository']" } ) ;
213
+ sig . addReference ( {
214
+ xpath : "//*[local-name(.)='repository']" ,
215
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
216
+ } ) ;
190
217
191
218
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
192
219
sig . computeSignature ( xml , {
@@ -212,7 +239,10 @@ describe("Signature unit tests", function () {
212
239
const sig = new SignedXml ( ) ;
213
240
214
241
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
215
- sig . addReference ( { xpath : "//*[local-name(.)='repository']" } ) ;
242
+ sig . addReference ( {
243
+ xpath : "//*[local-name(.)='repository']" ,
244
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
245
+ } ) ;
216
246
217
247
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
218
248
sig . computeSignature ( xml , {
@@ -239,7 +269,10 @@ describe("Signature unit tests", function () {
239
269
const sig = new SignedXml ( ) ;
240
270
241
271
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
242
- sig . addReference ( { xpath : "//*[local-name(.)='repository']" } ) ;
272
+ sig . addReference ( {
273
+ xpath : "//*[local-name(.)='repository']" ,
274
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
275
+ } ) ;
243
276
244
277
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
245
278
sig . computeSignature ( xml , {
@@ -590,9 +623,18 @@ describe("Signature unit tests", function () {
590
623
const sig = new SignedXml ( ) ;
591
624
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
592
625
593
- sig . addReference ( { xpath : "//*[local-name(.)='x']" } ) ;
594
- sig . addReference ( { xpath : "//*[local-name(.)='y']" } ) ;
595
- sig . addReference ( { xpath : "//*[local-name(.)='w']" } ) ;
626
+ sig . addReference ( {
627
+ xpath : "//*[local-name(.)='x']" ,
628
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
629
+ } ) ;
630
+ sig . addReference ( {
631
+ xpath : "//*[local-name(.)='y']" ,
632
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
633
+ } ) ;
634
+ sig . addReference ( {
635
+ xpath : "//*[local-name(.)='w']" ,
636
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
637
+ } ) ;
596
638
597
639
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
598
640
sig . computeSignature ( xml ) ;
@@ -658,9 +700,18 @@ describe("Signature unit tests", function () {
658
700
sig . signatureAlgorithm = "http://dummySignatureAlgorithmAsync" ;
659
701
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
660
702
661
- sig . addReference ( { xpath : "//*[local-name(.)='x']" } ) ;
662
- sig . addReference ( { xpath : "//*[local-name(.)='y']" } ) ;
663
- sig . addReference ( { xpath : "//*[local-name(.)='w']" } ) ;
703
+ sig . addReference ( {
704
+ xpath : "//*[local-name(.)='x']" ,
705
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
706
+ } ) ;
707
+ sig . addReference ( {
708
+ xpath : "//*[local-name(.)='y']" ,
709
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
710
+ } ) ;
711
+ sig . addReference ( {
712
+ xpath : "//*[local-name(.)='w']" ,
713
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
714
+ } ) ;
664
715
665
716
sig . canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" ;
666
717
sig . computeSignature ( xml , function ( ) {
@@ -918,7 +969,10 @@ describe("Signature unit tests", function () {
918
969
const sig = new SignedXml ( ) ;
919
970
920
971
sig . privateKey = fs . readFileSync ( "./test/static/client.pem" ) ;
921
- sig . addReference ( { xpath : "//*[local-name(.)='repository']" } ) ;
972
+ sig . addReference ( {
973
+ xpath : "//*[local-name(.)='repository']" ,
974
+ digestAlgorithm : "http://www.w3.org/2000/09/xmldsig#sha1" ,
975
+ } ) ;
922
976
923
977
try {
924
978
sig . computeSignature ( xml , {
0 commit comments