Browse Source

paypro: more debugging.

patch-2
Christopher Jeffrey 11 years ago
parent
commit
b406eeadff
  1. 8
      lib/PayPro.js

8
lib/PayPro.js

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

Loading…
Cancel
Save