Share via


X509Certificate.GetKeyUsage Method

Definition

Gets a boolean array representing bits of the KeyUsage extension, (OID = 2.

[Android.Runtime.Register("getKeyUsage", "()[Z", "GetGetKeyUsageHandler")]
public abstract bool[]? GetKeyUsage ();
[<Android.Runtime.Register("getKeyUsage", "()[Z", "GetGetKeyUsageHandler")>]
abstract member GetKeyUsage : unit -> bool[]

Returns

the KeyUsage extension of this certificate, represented as an array of booleans. The order of KeyUsage values in the array is the same as in the above ASN.1 definition. The array will contain a value for each KeyUsage defined above. If the KeyUsage list encoded in the certificate is longer than the above list, it will not be truncated. Returns null if this certificate does not contain a KeyUsage extension.

Attributes

Remarks

Gets a boolean array representing bits of the KeyUsage extension, (OID = 2.5.29.15). The key usage extension defines the purpose (e.g., encipherment, signature, certificate signing) of the key contained in the certificate. The ASN.1 definition for this is:

KeyUsage ::= BIT STRING {
                digitalSignature        (0),
                nonRepudiation          (1),
                keyEncipherment         (2),
                dataEncipherment        (3),
                keyAgreement            (4),
                keyCertSign             (5),
                cRLSign                 (6),
                encipherOnly            (7),
                decipherOnly            (8) }

RFC 3280 recommends that when used, this be marked as a critical extension.

Java documentation for java.security.cert.X509Certificate.getKeyUsage().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to