Class ExtendedKeyUsage

java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.x509.ExtendedKeyUsage
All Implemented Interfaces:
ASN1Encodable, Encodable

public class ExtendedKeyUsage extends ASN1Object
The extendedKeyUsage object.
      extendedKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
 
  • Constructor Details

    • ExtendedKeyUsage

      public ExtendedKeyUsage(KeyPurposeId usage)
      Base constructor, from a single KeyPurposeId.
      Parameters:
      usage - the keyPurposeId to be included.
    • ExtendedKeyUsage

      public ExtendedKeyUsage(KeyPurposeId[] usages)
      Base constructor, from multiple KeyPurposeIds.
      Parameters:
      usages - an array of KeyPurposeIds.
    • ExtendedKeyUsage

      public ExtendedKeyUsage(Vector usages)
      Deprecated.
      use KeyPurposeId[] constructor.
  • Method Details

    • getInstance

      public static ExtendedKeyUsage getInstance(ASN1TaggedObject obj, boolean explicit)
      Return an ExtendedKeyUsage from the passed in tagged object.
      Parameters:
      obj - the tagged object containing the ExtendedKeyUsage
      explicit - true if the tagged object should be interpreted as explicitly tagged, false if implicit.
      Returns:
      the ExtendedKeyUsage contained.
    • getInstance

      public static ExtendedKeyUsage getInstance(Object obj)
      Return an ExtendedKeyUsage from the passed in object.
      Parameters:
      obj - an ExtendedKeyUsage, some form or encoding of one, or null.
      Returns:
      an ExtendedKeyUsage object, or null if null is passed in.
    • fromExtensions

      public static ExtendedKeyUsage fromExtensions(Extensions extensions)
      Retrieve an ExtendedKeyUsage for a passed in Extensions object, if present.
      Parameters:
      extensions - the extensions object to be examined.
      Returns:
      the ExtendedKeyUsage, null if the extension is not present.
    • hasKeyPurposeId

      public boolean hasKeyPurposeId(KeyPurposeId keyPurposeId)
      Return true if this ExtendedKeyUsage object contains the passed in keyPurposeId.
      Parameters:
      keyPurposeId - the KeyPurposeId of interest.
      Returns:
      true if the keyPurposeId is present, false otherwise.
    • getUsages

      public KeyPurposeId[] getUsages()
      Returns all extended key usages.
      Returns:
      An array with all key purposes.
    • size

      public int size()
      Return the number of KeyPurposeIds present in this ExtendedKeyUsage.
      Returns:
      the number of KeyPurposeIds
    • toASN1Primitive

      public ASN1Primitive toASN1Primitive()
      Return the ASN.1 primitive form of this object.
      Specified by:
      toASN1Primitive in interface ASN1Encodable
      Specified by:
      toASN1Primitive in class ASN1Object
      Returns:
      an ASN1Sequence.