Class KeyUsage

java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.x509.KeyUsage
All Implemented Interfaces:
ASN1Encodable

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 Details

  • 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

      public static KeyUsage getInstance​(Object obj)
    • fromExtensions

      public static KeyUsage fromExtensions​(Extensions extensions)
    • getBytes

      public byte[] getBytes()
    • getPadBits

      public int getPadBits()
    • toString

      public String toString()
      Description copied from class: Object
      Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
         getClass().getName() + '@' + Integer.toHexString(hashCode())

      See Writing a useful toString method if you intend implementing your own toString method.

      Overrides:
      toString in class Object
      Returns:
      a printable representation of this object.
    • toASN1Primitive

      public ASN1Primitive toASN1Primitive()
      Specified by:
      toASN1Primitive in interface ASN1Encodable
      Specified by:
      toASN1Primitive in class ASN1Object