diff --git a/lib/PayPro.js b/lib/PayPro.js index 857d789..a27ce0f 100644 --- a/lib/PayPro.js +++ b/lib/PayPro.js @@ -128,6 +128,46 @@ PayPro.prototype.x509Verify = function() { }); }); + // + // Handle Cert Extensions + // http://tools.ietf.org/html/rfc5280#section-4.2 + // + + // Basic Constraints + var basicConstraints = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 19; + })[0]; + + // Key Usage + var keyUsage = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 15; + })[0]; + + // Subject Key Identifier + var authKeyIdentifier = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 14; + })[0]; + + // Authority Key Identifier + var authKeyIdentifier = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 35; + })[0]; + + // Unknown Extension (not documented anywhere, probably non-standard) + var unknown = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 1; + })[0]; + + // CRL Distribution Points + var CRLDistributionPoints = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 31; + })[0]; + + // Certificate Policies + var certPolicies = nc.tbsCertificate.extensions.filter(function(ext) { + return ext.extnID[3] === 32; + })[0]; + // // Create a To-Be-Signed Certificate to verify using asn1.js: //