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

This commit is contained in:
Christopher Jeffrey 2014-07-16 17:22:35 -07:00
parent 4e606c7ed2
commit 37f20f3268
1 changed files with 6 additions and 6 deletions

View File

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