paypro: fix browser paypro. TODO: fix parsing DER certs.
This commit is contained in:
parent
4e606c7ed2
commit
37f20f3268
@ -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…
Reference in New Issue
Block a user