keyUsage property
Gets a boolean array representing bits of the KeyUsage extension, (OID = 2.5.29.15).
KeyUsage ::= BIT STRING {
digitalSignature (0),
nonRepudiation (1),
keyEncipherment (2),
dataEncipherment (3),
keyAgreement (4),
keyCertSign (5),
cRLSign (6),
encipherOnly (7),
decipherOnly (8)
}
Implementation
List<bool> get keyUsage {
var result = <bool>[];
var oidBlock = block1?.findOid(oid: OID.keyUsage);
if (oidBlock != null) {
var sub = oidBlock.parent?.sub;
if (sub != null && sub.length > 0) {
var data = sub.last.subAtIndex(0)?.value;
int bits = (data is List<int> && data.length > 0) ? data.first : 0;
for (var index = 0; index < 8; index++) {
var value = bits & (1 << index).toUnsigned(8) != 0;
result.insert(0, value);
}
}
}
return result;
}