diff --git a/lib/PayPro.js b/lib/PayPro.js index d775d22fe..c991921a3 100644 --- a/lib/PayPro.js +++ b/lib/PayPro.js @@ -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') {