org.bouncycastle.asn1.x509

## Class Extensions

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.x509.Extensions

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class Extensions
      extends ASN1Object

           Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension

           Extension         ::=   SEQUENCE {
              extnId            EXTENSION.&id ({ExtensionSet}),
              critical          BOOLEAN DEFAULT FALSE,
              extnValue         OCTET STRING }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Extensions(Extension extension)` Base Constructor
    `Extensions(Extension[] extensions)` Base Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equivalent(Extensions other)`
    `ASN1ObjectIdentifier[]` | `getCriticalExtensionOIDs()`
    `Extension` | `getExtension(ASN1ObjectIdentifier oid)` return the extension represented by the object identifier passed in.
    `static Extension` | `getExtension(Extensions extensions, ASN1ObjectIdentifier oid)`
    `ASN1ObjectIdentifier[]` | `getExtensionOIDs()`
    `ASN1Encodable` | `getExtensionParsedValue(ASN1ObjectIdentifier oid)` return the parsed value of the extension represented by the object identifier passed in.
    `static ASN1Encodable` | `getExtensionParsedValue(Extensions extensions, ASN1ObjectIdentifier oid)`
    `ASN1OctetString` | `getExtensionValue(ASN1ObjectIdentifier oid)` return the value of the extension represented by the object identifier passed in.
    `static ASN1OctetString` | `getExtensionValue(Extensions extensions, ASN1ObjectIdentifier oid)`
    `static Extensions` | `getInstance(ASN1TaggedObject obj, boolean explicit)`
    `static Extensions` | `getInstance(java.lang.Object obj)`
    `ASN1ObjectIdentifier[]` | `getNonCriticalExtensionOIDs()`
    `boolean` | `hasAnyCriticalExtensions()`
    `java.util.Enumeration` | `oids()` return an Enumeration of the extension field's object ids.
    `static java.util.List` | `reviewStructure(ASN1Sequence seq)` Re-run the parse of a candidate Extensions SEQUENCE collecting every problem the strict `getInstance(...)` path would have thrown (e.g. repeated extensions), instead of stopping at the first.
    `ASN1Primitive` | `toASN1Primitive()` Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension Extension ::= SEQUENCE { extnId EXTENSION.

    - ### 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`

- - ### Constructor Detail

    - #### Extensions

          public Extensions(Extension extension)

      Base Constructor
      Parameters:
        `extension` - a single extension.

    - #### Extensions

          public Extensions(Extension[] extensions)

      Base Constructor
      Parameters:
        `extensions` - an array of extensions.

  - ### Method Detail

    - #### getExtension

          public static Extension getExtension(Extensions extensions,
                                               ASN1ObjectIdentifier oid)

    - #### getExtensionParsedValue

          public static ASN1Encodable getExtensionParsedValue(Extensions extensions,
                                                              ASN1ObjectIdentifier oid)

    - #### getExtensionValue

          public static ASN1OctetString getExtensionValue(Extensions extensions,
                                                          ASN1ObjectIdentifier oid)

    - #### getInstance

          public static Extensions getInstance(ASN1TaggedObject obj,
                                               boolean explicit)

    - #### getInstance

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

    - #### reviewStructure

          public static java.util.List reviewStructure(ASN1Sequence seq)

      Re-run the parse of a candidate Extensions SEQUENCE collecting every problem the strict `getInstance(...)` path would have thrown (e.g. repeated extensions), instead of stopping at the first. The strict path and this share one parse method (see `parse(org.bouncycastle.asn1.ASN1Sequence, java.util.List)`); only the error sink differs. Intended for diagnostic/reporting tooling (github #1508); it does not relax the repeated-extension rule (the "org.bouncycastle.x509.ignore_repeated_extensions" property still governs whether a repeat is a problem at all).
      Parameters:
        `seq` - the candidate Extensions SEQUENCE.
      Returns:
        the exceptions the strict path would have thrown, one per problem, in parse order (empty if none).

    - #### oids

          public java.util.Enumeration oids()

      return an Enumeration of the extension field's object ids.

    - #### getExtension

          public Extension getExtension(ASN1ObjectIdentifier oid)

      return the extension represented by the object identifier passed in.
      Returns:
        the extension if it's present, null otherwise.

    - #### getExtensionParsedValue

          public ASN1Encodable getExtensionParsedValue(ASN1ObjectIdentifier oid)

      return the parsed value of the extension represented by the object identifier passed in.
      Returns:
        the parsed value of the extension if it's present, null otherwise.

    - #### getExtensionValue

          public ASN1OctetString getExtensionValue(ASN1ObjectIdentifier oid)

      return the value of the extension represented by the object identifier passed in.
      Returns:
        the value of the extension if it's present, null otherwise.

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

               Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension

               Extension         ::=   SEQUENCE {
                  extnId            EXTENSION.&id ({ExtensionSet}),
                  critical          BOOLEAN DEFAULT FALSE,
                  extnValue         OCTET STRING }

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.

    - #### equivalent

          public boolean equivalent(Extensions other)

    - #### getExtensionOIDs

          public ASN1ObjectIdentifier[] getExtensionOIDs()

    - #### getNonCriticalExtensionOIDs

          public ASN1ObjectIdentifier[] getNonCriticalExtensionOIDs()

    - #### getCriticalExtensionOIDs

          public ASN1ObjectIdentifier[] getCriticalExtensionOIDs()

    - #### hasAnyCriticalExtensions

          public boolean hasAnyCriticalExtensions()