Skip to content

Commit

Permalink
Fix for node 6.x. Be explicit about crypto update input encoding latin1
Browse files Browse the repository at this point in the history
  • Loading branch information
dschenkelman committed Jan 20, 2017
1 parent 3df3060 commit e11daba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ language: node_js
before_install: npm i -g [email protected]
node_js:
- 0.8
- 0.10
- 0.10
- 4
- 6
2 changes: 1 addition & 1 deletion lib/passport-wsfed-saml2/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/passport-wsfed-saml2/samlp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};

Expand Down

0 comments on commit e11daba

Please sign in to comment.