Package org.bouncycastle.asn1.x509
Class KeyUsage
java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.x509.KeyUsage
- All Implemented Interfaces:
ASN1Encodable
,Encodable
The KeyUsage object.
id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } KeyUsage ::= BIT STRING { digitalSignature (0), nonRepudiation (1), keyEncipherment (2), dataEncipherment (3), keyAgreement (4), keyCertSign (5), cRLSign (6), encipherOnly (7), decipherOnly (8) }
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyUsage
fromExtensions
(Extensions extensions) byte[]
getBytes()
static KeyUsage
getInstance
(Object obj) int
boolean
hasUsages
(int usages) Return true if a given usage bit is set, false otherwise.Method providing a primitive representation of this object suitable for encoding.toString()
Methods inherited from class org.bouncycastle.asn1.ASN1Object
encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode
-
Field Details
-
digitalSignature
public static final int digitalSignature- See Also:
-
nonRepudiation
public static final int nonRepudiation- See Also:
-
keyEncipherment
public static final int keyEncipherment- See Also:
-
dataEncipherment
public static final int dataEncipherment- See Also:
-
keyAgreement
public static final int keyAgreement- See Also:
-
keyCertSign
public static final int keyCertSign- See Also:
-
cRLSign
public static final int cRLSign- See Also:
-
encipherOnly
public static final int encipherOnly- See Also:
-
decipherOnly
public static final int decipherOnly- See Also:
-
-
Constructor Details
-
KeyUsage
public KeyUsage(int usage) Basic constructor.- Parameters:
usage
- - the bitwise OR of the Key Usage flags giving the allowed uses for the key. e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
-
-
Method Details
-
getInstance
-
fromExtensions
-
hasUsages
public boolean hasUsages(int usages) Return true if a given usage bit is set, false otherwise.- Parameters:
usages
- combination of usage flags.- Returns:
- true if all bits are set, false otherwise.
-
getBytes
public byte[] getBytes() -
getPadBits
public int getPadBits() -
toString
-
toASN1Primitive
Description copied from class:ASN1Object
Method providing a primitive representation of this object suitable for encoding.- Specified by:
toASN1Primitive
in interfaceASN1Encodable
- Specified by:
toASN1Primitive
in classASN1Object
- Returns:
- a primitive representation of this object.
-