From 97d4bd1c6786dfddc663b9e36ab164dc65a1911a Mon Sep 17 00:00:00 2001 From: dschenkelman Date: Fri, 20 Jan 2017 16:35:49 -0300 Subject: [PATCH] Fix for node 6.x. Be explicit about crypto update input encoding latin1 --- .travis.yml | 4 ++-- lib/passport-wsfed-saml2/saml.js | 2 +- lib/passport-wsfed-saml2/samlp.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b3d4c98..656ae12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js before_install: npm i -g npm@1.4.28 node_js: - - 0.8 - - 0.10 \ No newline at end of file + - 4 + - 6 \ No newline at end of file diff --git a/lib/passport-wsfed-saml2/saml.js b/lib/passport-wsfed-saml2/saml.js index af229ed..e3cb3dd 100644 --- a/lib/passport-wsfed-saml2/saml.js +++ b/lib/passport-wsfed-saml2/saml.js @@ -59,7 +59,7 @@ SAML.prototype.validateSignature = function (xml, options, callback) { var base64cer = embeddedSignature[0].firstChild.toString(); var shasum = crypto.createHash('sha1'); var der = new Buffer(base64cer, 'base64').toString('binary'); - shasum.update(der); + shasum.update(der, 'latin1'); self.calculatedThumbprint = shasum.digest('hex'); // using embedded cert, so options.cert is not used anymore diff --git a/lib/passport-wsfed-saml2/samlp.js b/lib/passport-wsfed-saml2/samlp.js index 98deff1..9a5f229 100644 --- a/lib/passport-wsfed-saml2/samlp.js +++ b/lib/passport-wsfed-saml2/samlp.js @@ -68,7 +68,7 @@ var removeHeaders = function (cert) { var sign = function (content, key, algorithm) { var signer = crypto.createSign(algorithm.toUpperCase()); - signer.update(content); + signer.update(content, 'latin1'); return signer.sign(key, 'base64'); };