Package org.bouncycastle.jce

## Class X509KeyUsage

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.jce.X509KeyUsage

- All Implemented Interfaces:
    `ASN1Encodable`, `Encodable`

      public class X509KeyUsage
      extends ASN1Object

  A holding class for constructing an X509 Key Usage extension.

          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

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `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

    Constructors
    Constructor | Description
    --- | ---
    `X509KeyUsage​(int usage)` | Basic constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ASN1Primitive` | `toASN1Primitive()` | Method providing a primitive representation of this object suitable for encoding.

    - ### 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, toString, wait, wait, wait`

- - ### Field Detail

    - #### digitalSignature

          public static final int digitalSignature

      See Also:
        Constant Field Values

    - #### nonRepudiation

          public static final int nonRepudiation

      See Also:
        Constant Field Values

    - #### keyEncipherment

          public static final int keyEncipherment

      See Also:
        Constant Field Values

    - #### dataEncipherment

          public static final int dataEncipherment

      See Also:
        Constant Field Values

    - #### keyAgreement

          public static final int keyAgreement

      See Also:
        Constant Field Values

    - #### keyCertSign

          public static final int keyCertSign

      See Also:
        Constant Field Values

    - #### cRLSign

          public static final int cRLSign

      See Also:
        Constant Field Values

    - #### encipherOnly

          public static final int encipherOnly

      See Also:
        Constant Field Values

    - #### decipherOnly

          public static final int decipherOnly

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### X509KeyUsage

          public X509KeyUsage​(int usage)

      Basic constructor.
      Parameters:
        `usage` - - the bitwise OR of the Key Usage flags giving the allowed uses for the key. e.g. (X509KeyUsage.keyEncipherment | X509KeyUsage.dataEncipherment)

  - ### Method Detail

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Description copied from class: `ASN1Object`
      Method providing a primitive representation of this object suitable for encoding.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.