paypro: fix rsa+sha256 vs rsa+sha1.

This commit is contained in:
Christopher Jeffrey 2014-07-16 08:29:14 -07:00
parent 3dc7a4ab84
commit e4c4101b5f
1 changed files with 4 additions and 2 deletions

View File

@ -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');
@ -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') {