|
@ -163,6 +163,14 @@ PayPro.prototype.x509Verify = function() { |
|
|
eid = ext.extnID; |
|
|
eid = ext.extnID; |
|
|
if (eid.length === 4 && eid[0] === 2 && eid[1] === 5 && eid[2] === 29) { |
|
|
if (eid.length === 4 && eid[0] === 2 && eid[1] === 5 && eid[2] === 29) { |
|
|
switch (eid[3]) { |
|
|
switch (eid[3]) { |
|
|
|
|
|
// Authority Key Identifier
|
|
|
|
|
|
case 35: |
|
|
|
|
|
extensions.authorityKeyIdentifier = ext.extnValue; |
|
|
|
|
|
break; |
|
|
|
|
|
// Subject Key Identifier
|
|
|
|
|
|
case 14: |
|
|
|
|
|
extensions.subjectKeyIdentifier = ext.extnValue; |
|
|
|
|
|
break; |
|
|
// Basic Constraints
|
|
|
// Basic Constraints
|
|
|
case 19: |
|
|
case 19: |
|
|
extensions.basicConstraints = ext.extnValue; |
|
|
extensions.basicConstraints = ext.extnValue; |
|
@ -171,14 +179,6 @@ PayPro.prototype.x509Verify = function() { |
|
|
case 15: |
|
|
case 15: |
|
|
extensions.keyUsage = ext.extnValue; |
|
|
extensions.keyUsage = ext.extnValue; |
|
|
break; |
|
|
break; |
|
|
// Subject Key Identifier
|
|
|
|
|
|
case 14: |
|
|
|
|
|
extensions.subjectKeyIdentifier = ext.extnValue; |
|
|
|
|
|
break; |
|
|
|
|
|
// Authority Key Identifier
|
|
|
|
|
|
case 35: |
|
|
|
|
|
extensions.authorityKeyIdentifier = ext.extnValue; |
|
|
|
|
|
break; |
|
|
|
|
|
// CRL Distribution Points
|
|
|
// CRL Distribution Points
|
|
|
case 31: |
|
|
case 31: |
|
|
extensions.CRLDistributionPoints = ext.extnValue; |
|
|
extensions.CRLDistributionPoints = ext.extnValue; |
|
@ -274,20 +274,50 @@ PayPro.prototype.x509Verify = function() { |
|
|
|
|
|
|
|
|
var rfc5280 = {}; |
|
|
var rfc5280 = {}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* # AuthorityKeyIdentifier |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var AuthorityKeyIdentifier = |
|
|
var AuthorityKeyIdentifier = |
|
|
rfc5280.AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() { |
|
|
rfc5280.AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() { |
|
|
this.seq().obj( |
|
|
this.seq().obj( |
|
|
this.key('keyIdentifier').optional().octstr(), |
|
|
this.key('keyIdentifier').optional().use(KeyIdentifier), |
|
|
this.key('authorityCertIssuer').optional().octstr(), |
|
|
this.key('authorityCertIssuer').optional().use(GeneralNames), |
|
|
this.key('authorityCertSerialNumber').optional().octstr() |
|
|
this.key('authorityCertSerialNumber').optional().use(CertificateSerialNumber) |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ## KeyIdentifier |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
var KeyIdentifier = |
|
|
|
|
|
rfc5280.KeyIdentifier = asn1.define('KeyIdentifier', function() { |
|
|
|
|
|
this.octstr(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ## CertificateSerialNumber |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
var CertificateSerialNumber = |
|
|
|
|
|
rfc5280.CertificateSerialNumber = asn1.define('CertificateSerialNumber', function() { |
|
|
|
|
|
this.int(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ## GeneralNames |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var GeneralNames = |
|
|
var GeneralNames = |
|
|
rfc5280.GeneralNames = asn1.define('GeneralNames', function() { |
|
|
rfc5280.GeneralNames = asn1.define('GeneralNames', function() { |
|
|
this.seqof(GeneralName); |
|
|
this.seqof(GeneralName); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ### GeneralName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var GeneralName = |
|
|
var GeneralName = |
|
|
rfc5280.GeneralName = asn1.define('GeneralName', function() { |
|
|
rfc5280.GeneralName = asn1.define('GeneralName', function() { |
|
|
this.choice({ |
|
|
this.choice({ |
|
@ -303,6 +333,10 @@ rfc5280.GeneralName = asn1.define('GeneralName', function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* #### OtherName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var OtherName = |
|
|
var OtherName = |
|
|
rfc5280.OtherName = asn1.define('OtherName', function() { |
|
|
rfc5280.OtherName = asn1.define('OtherName', function() { |
|
|
this.seq().obj( |
|
|
this.seq().obj( |
|
@ -311,6 +345,10 @@ rfc5280.OtherName = asn1.define('OtherName', function() { |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* #### ORAddress |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var ORAddress = |
|
|
var ORAddress = |
|
|
rfc5280.ORAddress = asn1.define('ORAddress', function() { |
|
|
rfc5280.ORAddress = asn1.define('ORAddress', function() { |
|
|
this.seq().obj( |
|
|
this.seq().obj( |
|
@ -320,6 +358,10 @@ rfc5280.ORAddress = asn1.define('ORAddress', function() { |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ##### BuiltInStandardAttributes |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var BuiltInStandardAttributes = |
|
|
var BuiltInStandardAttributes = |
|
|
rfc5280.BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes', function() { |
|
|
rfc5280.BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes', function() { |
|
|
this.seq().obj( |
|
|
this.seq().obj( |
|
@ -336,7 +378,7 @@ rfc5280.BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes', fun |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* For BuiltInStandardAttributes |
|
|
* ###### CountryName |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var CountryName = |
|
|
var CountryName = |
|
@ -347,6 +389,10 @@ rfc5280.CountryName = asn1.define('CountryName', function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### AdministrationDomainName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var AdministrationDomainName = |
|
|
var AdministrationDomainName = |
|
|
rfc5280.AdministrationDomainName = asn1.define('AdministrationDomainName', function() { |
|
|
rfc5280.AdministrationDomainName = asn1.define('AdministrationDomainName', function() { |
|
|
this.choice({ |
|
|
this.choice({ |
|
@ -355,21 +401,37 @@ rfc5280.AdministrationDomainName = asn1.define('AdministrationDomainName', funct |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### NetworkAddress |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var NetworkAddress = |
|
|
var NetworkAddress = |
|
|
rfc5280.NetworkAddress = asn1.define('NetworkAddress', function() { |
|
|
rfc5280.NetworkAddress = asn1.define('NetworkAddress', function() { |
|
|
this.use(X121Address); |
|
|
this.use(X121Address); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### X121Address |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var X121Address = |
|
|
var X121Address = |
|
|
rfc5280.X121Address = asn1.define('X121Address', function() { |
|
|
rfc5280.X121Address = asn1.define('X121Address', function() { |
|
|
this.numstr(); |
|
|
this.numstr(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### TerminalIdentifier |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var TerminalIdentifier = |
|
|
var TerminalIdentifier = |
|
|
rfc5280.TerminalIdentifier = asn1.define('TerminalIdentifier', function() { |
|
|
rfc5280.TerminalIdentifier = asn1.define('TerminalIdentifier', function() { |
|
|
this.printstr(); |
|
|
this.printstr(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### PrivateDomainName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var PrivateDomainName = |
|
|
var PrivateDomainName = |
|
|
rfc5280.PrivateDomainName = asn1.define('PrivateDomainName', function() { |
|
|
rfc5280.PrivateDomainName = asn1.define('PrivateDomainName', function() { |
|
|
this.choice({ |
|
|
this.choice({ |
|
@ -378,16 +440,28 @@ rfc5280.PrivateDomainName = asn1.define('PrivateDomainName', function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### OrganizationName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var OrganizationName = |
|
|
var OrganizationName = |
|
|
rfc5280.OrganizationName = asn1.define('OrganizationName', function() { |
|
|
rfc5280.OrganizationName = asn1.define('OrganizationName', function() { |
|
|
this.printstr(); |
|
|
this.printstr(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### NumericUserIdentifier |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var NumericUserIdentifier = |
|
|
var NumericUserIdentifier = |
|
|
rfc5280.NumericUserIdentifier = asn1.define('NumericUserIdentifier', function() { |
|
|
rfc5280.NumericUserIdentifier = asn1.define('NumericUserIdentifier', function() { |
|
|
this.numstr(); |
|
|
this.numstr(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### PersonalName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var PersonalName = |
|
|
var PersonalName = |
|
|
rfc5280.PersonalName = asn1.define('PersonalName', function() { |
|
|
rfc5280.PersonalName = asn1.define('PersonalName', function() { |
|
|
this.set().obj( |
|
|
this.set().obj( |
|
@ -398,18 +472,26 @@ rfc5280.PersonalName = asn1.define('PersonalName', function() { |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ###### OrganizationalUnitNames |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var OrganizationalUnitNames = |
|
|
var OrganizationalUnitNames = |
|
|
rfc5280.OrganizationalUnitNames = asn1.define('OrganizationalUnitNames', function() { |
|
|
rfc5280.OrganizationalUnitNames = asn1.define('OrganizationalUnitNames', function() { |
|
|
this.seqof(OrganizationalUnitName); |
|
|
this.seqof(OrganizationalUnitName); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ####### OrganizationalUnitName |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var OrganizationalUnitName = |
|
|
var OrganizationalUnitName = |
|
|
rfc5280.OrganizationalUnitName = asn1.define('OrganizationalUnitName', function() { |
|
|
rfc5280.OrganizationalUnitName = asn1.define('OrganizationalUnitName', function() { |
|
|
this.printstr(); |
|
|
this.printstr(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* BuiltInDomainDefinedAttributes |
|
|
* ##### BuiltInDomainDefinedAttributes |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var BuiltInDomainDefinedAttributes = |
|
|
var BuiltInDomainDefinedAttributes = |
|
@ -418,7 +500,7 @@ rfc5280.BuiltInDomainDefinedAttributes = asn1.define('BuiltInDomainDefinedAttrib |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* For BuiltInDomainDefinedAttribute |
|
|
* ###### BuiltInDomainDefinedAttribute |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var BuiltInDomainDefinedAttribute = |
|
|
var BuiltInDomainDefinedAttribute = |
|
@ -430,7 +512,7 @@ rfc5280.BuiltInDomainDefinedAttribute = asn1.define('BuiltInDomainDefinedAttribu |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* ExtensionAttributes |
|
|
* # ExtensionAttributes |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var ExtensionAttributes = |
|
|
var ExtensionAttributes = |
|
@ -439,7 +521,7 @@ rfc5280.ExtensionAttributes = asn1.define('ExtensionAttributes', function() { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* For ExtensionAttributes |
|
|
* ## ExtensionAttribute |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var ExtensionAttribute = |
|
|
var ExtensionAttribute = |
|
@ -451,7 +533,7 @@ rfc5280.ExtensionAttribute = asn1.define('ExtensionAttribute', function() { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* EDIPartyName |
|
|
* #### EDIPartyName |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var EDIPartyName = |
|
|
var EDIPartyName = |
|
@ -469,6 +551,10 @@ rfc5280.EDIPartyName = asn1.define('EDIPartyName', function() { |
|
|
// https://www.google.com/search?q=TeletexString
|
|
|
// https://www.google.com/search?q=TeletexString
|
|
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb540814(v=vs.85).aspx
|
|
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb540814(v=vs.85).aspx
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* ##### DirectoryString |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var DirectoryString = |
|
|
var DirectoryString = |
|
|
rfc5280.DirectoryString = asn1.define('DirectoryString', function() { |
|
|
rfc5280.DirectoryString = asn1.define('DirectoryString', function() { |
|
|
this.choice({ |
|
|
this.choice({ |
|
@ -480,6 +566,10 @@ rfc5280.DirectoryString = asn1.define('DirectoryString', function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* # KeyUsage |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
var KeyUsage = |
|
|
var KeyUsage = |
|
|
rfc5280.KeyUsage = asn1.define('KeyUsage', function() { |
|
|
rfc5280.KeyUsage = asn1.define('KeyUsage', function() { |
|
|
this.bitstr(); |
|
|
this.bitstr(); |
|
|