diff --git a/lib/PayPro.js b/lib/PayPro.js index 2588e6d..73c0741 100644 --- a/lib/PayPro.js +++ b/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);