xml-crypto
Advanced tools
Comparing version 1.1.3 to 1.1.4
var xpath = require('xpath'); | ||
var utils = require('./utils'); | ||
@@ -8,5 +9,20 @@ exports.EnvelopedSignature = EnvelopedSignature; | ||
EnvelopedSignature.prototype.process = function (node) { | ||
var signature = xpath.select("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']", node)[0]; | ||
if (signature) signature.parentNode.removeChild(signature); | ||
EnvelopedSignature.prototype.process = function (node, options) { | ||
if (null == options.signatureNode) { | ||
// leave this for the moment... | ||
var signature = xpath.select("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']", node)[0]; | ||
if (signature) signature.parentNode.removeChild(signature); | ||
return node; | ||
} | ||
var signatureNode = options.signatureNode; | ||
var expectedSignatureValue = utils.findFirst(signatureNode, ".//*[local-name(.)='SignatureValue']/text()").data; | ||
var signatures = xpath.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']", node); | ||
for (var h in signatures) { | ||
if (!signatures.hasOwnProperty(h)) continue; | ||
var signature = signatures[h]; | ||
var signatureValue = utils.findFirst(signature, ".//*[local-name(.)='SignatureValue']/text()").data; | ||
if (expectedSignatureValue === signatureValue) { | ||
signature.parentNode.removeChild(signature); | ||
} | ||
} | ||
return node; | ||
@@ -13,0 +29,0 @@ }; |
@@ -818,2 +818,3 @@ var xpath = require('xpath') | ||
options.defaultNsForPrefix = options.defaultNsForPrefix || SignedXml.defaultNsForPrefix; | ||
options.signatureNode = this.signatureNode; | ||
@@ -820,0 +821,0 @@ var canonXml = node.cloneNode(true) // Deep clone |
{ | ||
"name": "xml-crypto", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Xml digital signature and encryption library for Node.js", | ||
@@ -5,0 +5,0 @@ "engines": { |
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
72663
1284