Skip to content

Commit

Permalink
paypro: fix rsa+sha256 vs rsa+sha1.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Jul 21, 2014
1 parent 3fbe0a9 commit d6c32b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/PayPro.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ PayPro.prototype.sign = function(key) {
var crypto = require('crypto');
var pki_data = this.get('pki_data'); // contains one or more x509 certs
//var details = this.get('serialized_payment_details');
var signature = crypto.createSign('RSA-SHA256');
var type = pki_type.split('+').toUpperCase();
var verifier = crypto.createSign('RSA-' + type);
var buf = this.serializeForSig();
signature.update(buf);
//var pki_data = require('fs').readFileSync(__dirname + '/../test/data/x509.pem');
Expand Down Expand Up @@ -244,7 +245,8 @@ PayPro.prototype.verify = function() {
var pki_data = this.get('pki_data');
// var details = this.get('serialized_payment_details');
var buf = this.serializeForSig();
var verifier = crypto.createVerify('RSA-SHA256');
var type = pki_type.split('+').toUpperCase();
var verifier = crypto.createVerify('RSA-' + type);
verifier.update(buf);
return verifier.verify(pki_data, sig);
} else if (pki_type === 'none') {
Expand Down

0 comments on commit d6c32b4

Please sign in to comment.