|
|
@ -179,14 +179,42 @@ PayPro.prototype.x509Verify = function() { |
|
|
|
// Authority Key Identifier
|
|
|
|
case 35: |
|
|
|
extensions.authorityKeyIdentifier = ext.extnValue; |
|
|
|
// parse
|
|
|
|
extensions.authorityKeyIdentifier = rfc5280.AuthorityKeyIdentifier.decode( |
|
|
|
extensions.authorityKeyIdentifier, |
|
|
|
'der'); |
|
|
|
print(extensions.authorityKeyIdentifier); |
|
|
|
break; |
|
|
|
// Subject Key Identifier
|
|
|
|
case 14: |
|
|
|
extensions.subjectKeyIdentifier = ext.extnValue; |
|
|
|
// parse
|
|
|
|
// extensions.subjectKeyIdentifier = rfc5280.SubjectKeyIdentifier.decode(
|
|
|
|
// extensions.subjectKeyIdentifier,
|
|
|
|
// 'der');
|
|
|
|
// print(extensions.subjectKeyIdentifier);
|
|
|
|
break; |
|
|
|
// Key Usage
|
|
|
|
case 15: |
|
|
|
extensions.keyUsage = ext.extnValue; |
|
|
|
// parse
|
|
|
|
data = rfc5280.KeyUsage.decode( |
|
|
|
extensions.keyUsage, |
|
|
|
'der').data[0]; |
|
|
|
extensions.keyUsage = { |
|
|
|
digitalSignature: !!((data >> 0) & 1), |
|
|
|
nonRepudiation: !!((data >> 1) & 1), |
|
|
|
// nonRepudiation renamed to contentCommitment:
|
|
|
|
contentCommitment: !!((data >> 1) & 1), |
|
|
|
keyEncipherment: !!((data >> 2) & 1), |
|
|
|
dataEncipherment: !!((data >> 3) & 1), |
|
|
|
keyAgreement: !!((data >> 4) & 1), |
|
|
|
keyCertSign: !!((data >> 5) & 1), |
|
|
|
cRLSign: !!((data >> 6) & 1), |
|
|
|
encipherOnly: !!((data >> 7) & 1), |
|
|
|
decipherOnly: !!((data >> 8) & 1) |
|
|
|
}; |
|
|
|
print(extensions.keyUsage); |
|
|
|
break; |
|
|
|
// Certificate Policies
|
|
|
|
case 32: |
|
|
@ -281,44 +309,6 @@ PayPro.prototype.x509Verify = function() { |
|
|
|
return ext.critical; |
|
|
|
}).length; |
|
|
|
|
|
|
|
//
|
|
|
|
// Execute Extension Behavior
|
|
|
|
//
|
|
|
|
|
|
|
|
if (extensions.authorityKeyIdentifier) { |
|
|
|
extensions.authorityKeyIdentifier = rfc5280.AuthorityKeyIdentifier.decode( |
|
|
|
extensions.authorityKeyIdentifier, |
|
|
|
'der'); |
|
|
|
print(extensions.authorityKeyIdentifier); |
|
|
|
} |
|
|
|
|
|
|
|
// if (extensions.subjectKeyIdentifier) {
|
|
|
|
// extensions.subjectKeyIdentifier = rfc5280.SubjectKeyIdentifier.decode(
|
|
|
|
// extensions.subjectKeyIdentifier,
|
|
|
|
// 'der');
|
|
|
|
// print(extensions.subjectKeyIdentifier);
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (extensions.keyUsage) { |
|
|
|
data = rfc5280.KeyUsage.decode( |
|
|
|
extensions.keyUsage, |
|
|
|
'der').data[0]; |
|
|
|
extensions.keyUsage = { |
|
|
|
digitalSignature: !!((data >> 0) & 1), |
|
|
|
nonRepudiation: !!((data >> 1) & 1), |
|
|
|
// nonRepudiation renamed to contentCommitment:
|
|
|
|
contentCommitment: !!((data >> 1) & 1), |
|
|
|
keyEncipherment: !!((data >> 2) & 1), |
|
|
|
dataEncipherment: !!((data >> 3) & 1), |
|
|
|
keyAgreement: !!((data >> 4) & 1), |
|
|
|
keyCertSign: !!((data >> 5) & 1), |
|
|
|
cRLSign: !!((data >> 6) & 1), |
|
|
|
encipherOnly: !!((data >> 7) & 1), |
|
|
|
decipherOnly: !!((data >> 8) & 1) |
|
|
|
}; |
|
|
|
print(extensions.keyUsage); |
|
|
|
} |
|
|
|
|
|
|
|
//
|
|
|
|
// Verify current certificate signature
|
|
|
|
//
|
|
|
|