Browse Source

paypro: refactor verification.

patch-2
Christopher Jeffrey 11 years ago
parent
commit
63b58fe477
  1. 32
      lib/PayPro.js

32
lib/PayPro.js

@ -198,28 +198,32 @@ PayPro.prototype.x509Verify = function() {
}
}
var rejectUnknown = !!extensions.unknown.filter(function(ext) {
var extensionsVerified = !extensions.unknown.filter(function(ext) {
return ext.critical;
}).length;
print(c);
print(nc);
print(extensions);
print('issuerVerified: %s', issuerVerified);
print('rejectUnknown: %s', rejectUnknown);
print('validityVerified: %s', validityVerified);
//
// Create a To-Be-Signed Certificate to verify using asn1.js:
//
var tbs = rfc3280.TBSCertificate.encode(c.tbsCertificate, 'der');
//
// Verify current certificate signature:
//
// Create a To-Be-Signed Certificate to verify using asn1.js:
var tbs = rfc3280.TBSCertificate.encode(c.tbsCertificate, 'der');
var verifier = crypto.createVerify('RSA-' + sigAlg);
verifier.update(tbs);
return verifier.verify(npubKey, sig) && issuerVerified;
var sigVerified = verifier.verify(npubKey, sig);
print(c);
print(nc);
print(extensions);
print('validityVerified: %s', validityVerified);
print('issuerVerified: %s', issuerVerified);
print('extensionsVerified: %s', extensionsVerified);
print('sigVerified: %s', validityVerified);
return validityVerified
&& issuerVerified
&& extensionsVerified
&& sigVerified;
});
return verified && chainVerified;

Loading…
Cancel
Save