paypro: start handling certificate extensions.

This commit is contained in:
Christopher Jeffrey 2014-08-24 13:02:07 -07:00
parent 18d72309eb
commit 95a75a6ee4
1 changed files with 40 additions and 0 deletions

View File

@ -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:
//