Top Description Fields Constructors Methods
org.bouncycastle.asn1.x509

public Class KeyUsage

extends ASN1Object
Class Inheritance
Imports
org.bouncycastle.asn1.ASN1Object, .ASN1Primitive, .DERBitString

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

Modifier and TypeField and Description
private DERBitString
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public
KeyUsage(int
- the bitwise OR of the Key Usage flags giving the allowed uses for the key. e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
usage
)

Basic constructor.

private

Method Summary

Modifier and TypeMethod and Description
public static KeyUsage
public byte[]
public static KeyUsage
public int
public boolean

Returns:

true if all bits are set, false otherwise.
hasUsages
(int
combination of usage flags.
usages
)

Return true if a given usage bit is set, false otherwise.

public ASN1Primitive
toASN1Primitive()

Implements abstract org.bouncycastle.asn1.ASN1Object.toASN1Primitive.

Implements org.bouncycastle.asn1.ASN1Encodable.toASN1Primitive.

Method providing a primitive representation of this object suitable for encoding.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.bouncycastle.asn1.ASN1Object:
equalsgetEncodedgetEncodedhasEncodedTagValuehashCode

Field Detail

bitStringback to summary
private DERBitString bitString
cRLSignback to summary
public static final int cRLSign
dataEnciphermentback to summary
public static final int dataEncipherment
decipherOnlyback to summary
public static final int decipherOnly
digitalSignatureback to summary
public static final int digitalSignature
encipherOnlyback to summary
public static final int encipherOnly
keyAgreementback to summary
public static final int keyAgreement
keyCertSignback to summary
public static final int keyCertSign
keyEnciphermentback to summary
public static final int keyEncipherment
nonRepudiationback to summary
public static final int nonRepudiation

Constructor Detail

KeyUsageback to summary
public KeyUsage(int usage)

Basic constructor.

Parameters
usage:int

- the bitwise OR of the Key Usage flags giving the allowed uses for the key. e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)

KeyUsageback to summary
private KeyUsage(DERBitString bitString)

Method Detail

fromExtensionsback to summary
public static KeyUsage fromExtensions(Extensions extensions)
getBytesback to summary
public byte[] getBytes()
getInstanceback to summary
public static KeyUsage getInstance(Object obj)
getPadBitsback to summary
public int getPadBits()
hasUsagesback to summary
public boolean hasUsages(int usages)

Return true if a given usage bit is set, false otherwise.

Parameters
usages:int

combination of usage flags.

Returns:boolean

true if all bits are set, false otherwise.

toASN1Primitiveback to summary
public ASN1Primitive toASN1Primitive()

Implements abstract org.bouncycastle.asn1.ASN1Object.toASN1Primitive.

Implements org.bouncycastle.asn1.ASN1Encodable.toASN1Primitive.

Doc from org.bouncycastle.asn1.ASN1Object.toASN1Primitive.

Method providing a primitive representation of this object suitable for encoding.

Returns:ASN1Primitive

a primitive representation of this object.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object