Browse Source

paypro: temporarily disable untrusted cert error for tests. typo fix.

patch-2
Christopher Jeffrey 11 years ago
parent
commit
4dcdd3c091
  1. 6
      lib/PayPro.js
  2. 6
      lib/browser/PayPro.js

6
lib/PayPro.js

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

6
lib/browser/PayPro.js

@ -7,7 +7,7 @@ var PayPro = require('../PayPro');
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;
@ -38,7 +38,7 @@ PayPro.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 jsrsaSig = new KJUR.crypto.Signature({ var jsrsaSig = new KJUR.crypto.Signature({
@ -89,7 +89,7 @@ PayPro.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.');
} }
jsrsaSig.initVerifyByCertificatePEM(pem); jsrsaSig.initVerifyByCertificatePEM(pem);

Loading…
Cancel
Save