@@ -185,9 +185,8 @@ SignedXml.prototype.checkSignature = function(xml) {
185
185
if ( ! this . validateReferences ( doc ) ) {
186
186
return false ;
187
187
}
188
-
189
-
190
- if ( ! this . validateSignatureValue ( doc ) ) {
188
+
189
+ if ( ! this . validateSignatureValue ( doc ) ) {
191
190
return false ;
192
191
}
193
192
@@ -197,8 +196,8 @@ SignedXml.prototype.checkSignature = function(xml) {
197
196
SignedXml . prototype . validateSignatureValue = function ( doc ) {
198
197
var signedInfo = utils . findChilds ( this . signatureXmlDoc . documentElement , "SignedInfo" )
199
198
if ( signedInfo . length == 0 ) throw new Error ( "could not find SignedInfo element in the message" )
200
- var signedInfoCanon = this . getCanonXml ( [ this . canonicalizationAlgorithm ] , signedInfo [ 0 ] )
201
- var signer = this . findSignatureAlgorithm ( this . signatureAlgorithm )
199
+ var signedInfoCanon = this . getCanonXml ( [ this . canonicalizationAlgorithm ] , signedInfo [ 0 ] )
200
+ var signer = this . findSignatureAlgorithm ( this . signatureAlgorithm )
202
201
var res = signer . verifySignature ( signedInfoCanon , this . signingKey , this . signatureValue )
203
202
if ( ! res ) this . validationErrors . push ( "invalid signature: the signature value " +
204
203
this . signatureValue + " is incorrect" )
@@ -251,6 +250,10 @@ SignedXml.prototype.validateReferences = function(doc) {
251
250
252
251
var hash = this . findHashAlgorithm ( ref . digestAlgorithm )
253
252
var digest = hash . getHash ( canonXml )
253
+
254
+ //console.log(digest)
255
+ //console.log(ref.digestValue)
256
+
254
257
if ( digest != ref . digestValue ) {
255
258
this . validationErrors . push ( "invalid signature: for uri " + ref . uri +
256
259
" calculated digest is " + digest +
@@ -321,7 +324,7 @@ SignedXml.prototype.loadReference = function(ref) {
321
324
}
322
325
}
323
326
324
- //workaround for validating windows mobile store signatures - it uses c14n but does not state it in the transforms
327
+ //*** workaround for validating windows mobile store signatures - it uses c14n but does not state it in the transforms
325
328
//transforms.push("http://www.w3.org/2001/10/xml-exc-c14n#")
326
329
327
330
this . addReference ( null , transforms , digestAlgo , utils . findAttr ( ref , "URI" ) . value , digestValue )
0 commit comments