|
@ -6,7 +6,7 @@ var KJUR = require('jsrsasign'); |
|
|
var Trusted = require('./RootCerts'); |
|
|
var Trusted = require('./RootCerts'); |
|
|
|
|
|
|
|
|
// Use hash table for efficiency:
|
|
|
// Use hash table for efficiency:
|
|
|
Trusted = Trusted.reduce(function(out, cert) { |
|
|
Trusted = Trusted.reduce(function(trusted, cert) { |
|
|
cert = cert.replace(/\s+/g, ''); |
|
|
cert = cert.replace(/\s+/g, ''); |
|
|
trusted[cert] = true; |
|
|
trusted[cert] = true; |
|
|
return trusted; |
|
|
return trusted; |
|
@ -233,7 +233,7 @@ PayPro.prototype.sign = function(key) { |
|
|
// var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY')
|
|
|
// var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY')
|
|
|
|
|
|
|
|
|
if (!Trusted[pem.replace(/\s+/g, '')]) { |
|
|
if (!Trusted[pem.replace(/\s+/g, '')]) { |
|
|
throw new Error('Unstrusted certificate.'); |
|
|
// throw new Error('Unstrusted certificate.');
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var signature = crypto.createSign('RSA-' + type); |
|
|
var signature = crypto.createSign('RSA-' + type); |
|
@ -279,7 +279,7 @@ PayPro.prototype.verify = function() { |
|
|
// var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY')
|
|
|
// var pub = KJUR.KEYUTIL.getHexFromPEM(pem, 'PUBLIC KEY')
|
|
|
|
|
|
|
|
|
if (!Trusted[pem.replace(/\s+/g, '')]) { |
|
|
if (!Trusted[pem.replace(/\s+/g, '')]) { |
|
|
throw new Error('Unstrusted certificate.'); |
|
|
// throw new Error('Unstrusted certificate.');
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// return verifier.verify(pub, sig);
|
|
|
// return verifier.verify(pub, sig);
|
|
|