Class 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) }
     
    • 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)
      • 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