xml-crypto
Advanced tools
Comparing version 0.8.5 to 0.9.0
@@ -59,3 +59,14 @@ /* jshint laxcomma: true */ | ||
function isPrefixInScope(prefixesInScope, prefix, namespaceURI) | ||
{ | ||
var ret = false; | ||
prefixesInScope.forEach(function (pf) { | ||
if (pf.prefix === prefix && pf.namespaceURI === namespaceURI) { | ||
ret = true; | ||
} | ||
}) | ||
return ret; | ||
} | ||
/** | ||
@@ -80,5 +91,5 @@ * Create the string of all namespace declarations that should appear on this element | ||
if (node.prefix) { | ||
if (prefixesInScope.indexOf(node.prefix)==-1) { | ||
if (!isPrefixInScope(prefixesInScope, node.prefix, node.namespaceURI || defaultNsForPrefix[node.prefix])) { | ||
nsListToRender.push({"prefix": node.prefix, "namespaceURI": node.namespaceURI || defaultNsForPrefix[node.prefix]}); | ||
prefixesInScope.push(node.prefix); | ||
prefixesInScope.push({"prefix": node.prefix, "namespaceURI": node.namespaceURI || defaultNsForPrefix[node.prefix]}); | ||
} | ||
@@ -99,5 +110,5 @@ } | ||
//the prefix is not defined already | ||
if (attr.prefix && prefixesInScope.indexOf(attr.localName) === -1 && inclusiveNamespacesPrefixList.indexOf(attr.localName) >= 0) { | ||
if (attr.prefix && !isPrefixInScope(prefixesInScope, attr.localName, attr.value) && inclusiveNamespacesPrefixList.indexOf(attr.localName) >= 0) { | ||
nsListToRender.push({"prefix": attr.localName, "namespaceURI": attr.value}); | ||
prefixesInScope.push(attr.localName); | ||
prefixesInScope.push({"prefix": attr.localName, "namespaceURI": attr.value}); | ||
} | ||
@@ -107,5 +118,5 @@ | ||
//the prefix is not defined already | ||
if (attr.prefix && prefixesInScope.indexOf(attr.prefix)==-1 && attr.prefix!="xmlns" && attr.prefix!="xml") { | ||
if (attr.prefix && !isPrefixInScope(prefixesInScope, attr.prefix, attr.namespaceURI) && attr.prefix!="xmlns" && attr.prefix!="xml") { | ||
nsListToRender.push({"prefix": attr.prefix, "namespaceURI": attr.namespaceURI}); | ||
prefixesInScope.push(attr.prefix); | ||
prefixesInScope.push({"prefix": attr.prefix, "namespaceURI": attr.namespaceURI}); | ||
} | ||
@@ -112,0 +123,0 @@ } |
var select = require('xpath.js') | ||
, Dom = require('xmldom').DOMParser | ||
, utils = require('./utils') | ||
, ExclusiveCanonicalization = require('./exclusive-canonicalization').ExclusiveCanonicalization | ||
, ExclusiveCanonicalizationWithComments = require('./exclusive-canonicalization').ExclusiveCanonicalizationWithComments | ||
, c14n = require('./c14n-canonicalization') | ||
, execC14n = require('./exclusive-canonicalization') | ||
, EnvelopedSignature = require('./enveloped-signature').EnvelopedSignature | ||
@@ -204,2 +204,3 @@ , crypto = require('crypto') | ||
* @param {string} idMode. Value of "wssecurity" will create/validate id's with the ws-security namespace | ||
* @param {object} options. Initial configurations | ||
*/ | ||
@@ -214,3 +215,3 @@ function SignedXml(idMode, options) { | ||
this.keyInfoProvider = null | ||
this.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#" | ||
this.canonicalizationAlgorithm = this.options.canonicalizationAlgorithm || "http://www.w3.org/2001/10/xml-exc-c14n#" | ||
this.signedXml = "" | ||
@@ -228,4 +229,6 @@ this.signatureXml = "" | ||
SignedXml.CanonicalizationAlgorithms = { | ||
'http://www.w3.org/2001/10/xml-exc-c14n#': ExclusiveCanonicalization, | ||
'http://www.w3.org/2001/10/xml-exc-c14n#WithComments': ExclusiveCanonicalizationWithComments, | ||
'http://www.w3.org/TR/2001/REC-xml-c14n-20010315': c14n.C14nCanonicalization, | ||
'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments': c14n.C14nCanonicalizationWithComments, | ||
'http://www.w3.org/2001/10/xml-exc-c14n#': execC14n.ExclusiveCanonicalization, | ||
'http://www.w3.org/2001/10/xml-exc-c14n#WithComments': execC14n.ExclusiveCanonicalizationWithComments, | ||
'http://www.w3.org/2000/09/xmldsig#enveloped-signature': EnvelopedSignature | ||
@@ -232,0 +235,0 @@ } |
{ | ||
"name": "xml-crypto", | ||
"version": "0.8.5", | ||
"version": "0.9.0", | ||
"description": "Xml digital signature and encryption library for Node.js", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -20,2 +20,4 @@ ## xml-crypto | ||
* Canonicalization http://www.w3.org/TR/2001/REC-xml-c14n-20010315 | ||
* Canonicalization with comments http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments | ||
* Exclusive Canonicalization http://www.w3.org/2001/10/xml-exc-c14n# | ||
@@ -22,0 +24,0 @@ * Exclusive Canonicalization with comments http://www.w3.org/2001/10/xml-exc-c14n#WithComments |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61518
15
1060
421