Browse Source

paypro: fix browser paypro. TODO: fix parsing DER certs.

patch-2
Christopher Jeffrey 11 years ago
parent
commit
37f20f3268
  1. 12
      lib/browser/PayPro.js

12
lib/browser/PayPro.js

@ -4,7 +4,7 @@ var Key = require('./Key');
var KJUR = require('./x509'); var KJUR = require('./x509');
var assert = require('assert'); var assert = require('assert');
var PayPro = require('../PayPro'); var PayPro = require('../PayPro');
var Trusted = require('./Trusted'); var Trusted = require('../RootCerts');
// Use hash table for efficiency: // Use hash table for efficiency:
Trusted = Trusted.reduce(function(out, cert) { Trusted = Trusted.reduce(function(out, cert) {
@ -30,17 +30,17 @@ PayPro.sign = function(key) {
var buf = this.serializeForSig(); var buf = this.serializeForSig();
// TODO: parse all certs // TODO: parse all certs
var cert = pki_data.split(/-----BEGIN[^\n]*KEY-----/)[0].replace(/\s+/g, ''); // var cert = pki_data.split(/-----BEGIN[^\n]*KEY-----/)[0].replace(/\s+/g, '');
if (!Trusted[cert])) { // if (!Trusted[cert])) {
; // untrusted cert // ; // untrusted cert
} // }
var jsrsaSig = new KJUR.crypto.Signature({ var jsrsaSig = new KJUR.crypto.Signature({
alg: type + 'withRSA', alg: type + 'withRSA',
prov: 'cryptojs/jsrsa' prov: 'cryptojs/jsrsa'
}); });
jsrsaSig.initSign(pki_data); jsrsaSig.initSign(key);
jsrsaSig.updateHex(buf.toString('hex')); jsrsaSig.updateHex(buf.toString('hex'));

Loading…
Cancel
Save