paypro: more debugging.

This commit is contained in:
Christopher Jeffrey 2014-08-22 12:50:22 -07:00
parent e9b0e7b969
commit b406eeadff
1 changed files with 8 additions and 0 deletions

View File

@ -98,6 +98,7 @@ PayPro.prototype.x509Verify = function() {
// Get signature from current certificate:
var data = new Buffer(der, 'hex');
var c = rfc3280.Certificate.decode(data, 'der');
console.log(c.tbsCertificate);
var sig = c.signature.data;
var verifier = crypto.createVerify('RSA-' + type);
@ -105,6 +106,13 @@ PayPro.prototype.x509Verify = function() {
// Create a To-Be-Signed Certificate to verify using asn1.js:
// Fails at Issuer:
var tbs = rfc3280.TBSCertificate.encode(c.tbsCertificate, 'der');
var tbsd = rfc3280.TBSCertificate.decode(tbs, 'der');
console.log(tbsd);
console.log('original cert:');
console.log(data.toString('hex'));
console.log('encoded tbs:');
console.log(tbs.toString('hex'));
console.log(data.toString('hex').indexOf(tbs.toString('hex')));
verifier.update(tbs);
return verifier.verify(npubKey, sig);