paypro: parse keyUsage bit string properly.
This commit is contained in:
parent
eedf71a749
commit
83286113ff
|
@ -221,9 +221,22 @@ PayPro.prototype.x509Verify = function() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (extensions.keyUsage) {
|
if (extensions.keyUsage) {
|
||||||
extensions.keyUsage = rfc5280.KeyUsage.decode(
|
data = rfc5280.KeyUsage.decode(
|
||||||
extensions.keyUsage,
|
extensions.keyUsage,
|
||||||
'der');
|
'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);
|
print(extensions.keyUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,19 +294,19 @@ rfc5280.KeyUsage = asn1.define('KeyUsage', function() {
|
||||||
this.bitstr();
|
this.bitstr();
|
||||||
});
|
});
|
||||||
|
|
||||||
rfc5280.KeyUsage = asn1.define('KeyUsage', function() {
|
// rfc5280.KeyUsage = asn1.define('KeyUsage', function() {
|
||||||
this.seq().obj(
|
// this.seq().obj(
|
||||||
this.key('digitalSignature').bitstr(),
|
// this.key('digitalSignature').bitstr(),
|
||||||
this.key('nonRepudiation').bitstr(),
|
// this.key('nonRepudiation').bitstr(),
|
||||||
this.key('keyEncipherment').bitstr(),
|
// this.key('keyEncipherment').bitstr(),
|
||||||
this.key('dataEncipherment').bitstr(),
|
// this.key('dataEncipherment').bitstr(),
|
||||||
this.key('keyAgreement').bitstr(),
|
// this.key('keyAgreement').bitstr(),
|
||||||
this.key('keyCertSign').bitstr(),
|
// this.key('keyCertSign').bitstr(),
|
||||||
this.key('cRLSign').bitstr(),
|
// this.key('cRLSign').bitstr(),
|
||||||
this.key('encipherOnly').bitstr(),
|
// this.key('encipherOnly').bitstr(),
|
||||||
this.key('decipherOnly').bitstr()
|
// this.key('decipherOnly').bitstr()
|
||||||
);
|
// );
|
||||||
});
|
// });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug
|
* Debug
|
||||||
|
|
Loading…
Reference in New Issue