Skip to content

Commit

Permalink
feat(xml/sign): unsigned assertions should have whitespace removed as…
Browse files Browse the repository at this point in the history
… well
  • Loading branch information
luuuis committed Sep 14, 2020
1 parent b48516a commit 968d0e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/xml/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports.fromSignXmlOptions = function (options) {
* @return {string}
*/
return function signXmlDocument(doc, callback) {
var token = utils.removeWhitespace(doc.toString());
var unsigned = exports.unsigned(doc);
var cert = utils.pemToCert(pem);

var sig = new SignedXml(null, { signatureAlgorithm: algorithms.signature[signatureAlgorithm], idAttribute: idAttribute });
Expand All @@ -56,7 +56,7 @@ exports.fromSignXmlOptions = function (options) {
}
};

sig.computeSignature(token, {
sig.computeSignature(unsigned, {
location: { reference: xpathToNodeBeforeSignature, action: 'after' },
prefix: signatureNamespacePrefix
});
Expand All @@ -76,7 +76,7 @@ exports.fromSignXmlOptions = function (options) {
* @return {string}
*/
exports.unsigned = function (doc, callback) {
var xml = doc.toString();
var xml = utils.removeWhitespace(doc.toString());
if (callback) {
setImmediate(callback, null, xml)
} else {
Expand Down

0 comments on commit 968d0e7

Please sign in to comment.