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