Bouncy Castle Cryptography Library 1.77.0

org.bouncycastle.asn1.x509
Class KeyUsage

java.lang.Object
  |
  +--org.bouncycastle.asn1.ASN1Object
        |
        +--org.bouncycastle.asn1.x509.KeyUsage
All Implemented Interfaces:
ASN1Encodable, Encodable

public class KeyUsage
extends ASN1Object

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
static int cRLSign
           
static int dataEncipherment
           
static int decipherOnly
           
static int digitalSignature
           
static int encipherOnly
           
static int keyAgreement
           
static int keyCertSign
           
static int keyEncipherment
           
static int nonRepudiation
           
 
Constructor Summary
KeyUsage(int usage)
          Basic constructor.
 
Method Summary
static KeyUsage fromExtensions(Extensions extensions)
           
 byte[] getBytes()
           
static KeyUsage getInstance(java.lang.Object obj)
           
 int getPadBits()
           
 boolean hasUsages(int usages)
          Return true if a given usage bit is set, false otherwise.
 ASN1Primitive toASN1Primitive()
          Method providing a primitive representation of this object suitable for encoding.
 java.lang.String toString()
           
 
Methods inherited from class org.bouncycastle.asn1.ASN1Object
encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

digitalSignature

public static final int digitalSignature

nonRepudiation

public static final int nonRepudiation

keyEncipherment

public static final int keyEncipherment

dataEncipherment

public static final int dataEncipherment

keyAgreement

public static final int keyAgreement

keyCertSign

public static final int keyCertSign

cRLSign

public static final int cRLSign

encipherOnly

public static final int encipherOnly

decipherOnly

public static final int decipherOnly
Constructor Detail

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 Detail

getInstance

public static KeyUsage getInstance(java.lang.Object obj)

fromExtensions

public static KeyUsage fromExtensions(Extensions extensions)

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

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toASN1Primitive

public ASN1Primitive toASN1Primitive()
Description copied from class: ASN1Object
Method providing a primitive representation of this object suitable for encoding.
Overrides:
toASN1Primitive in class ASN1Object
Following copied from class: org.bouncycastle.asn1.ASN1Object
Returns:
a primitive representation of this object.

Bouncy Castle Cryptography Library 1.77.0