Package org.bouncycastle.asn1

## Class ASN1External

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.ASN1Primitive
    - - org.bouncycastle.asn1.ASN1External

- All Implemented Interfaces:
    `ASN1Encodable`, `Encodable`
  Direct Known Subclasses:
    `DERExternal`, `DLExternal`

      public abstract class ASN1External
      extends ASN1Primitive

  Class representing the DER-type External

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected ASN1Primitive` | `dataValueDescriptor` |
    `protected ASN1ObjectIdentifier` | `directReference` |
    `protected int` | `encoding` |
    `protected ASN1Primitive` | `externalContent` |
    `protected ASN1Integer` | `indirectReference` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ASN1External​(ASN1EncodableVector vector)` | Construct an EXTERNAL object, the input encoding vector must have exactly two elements on it.
    `ASN1External​(ASN1ObjectIdentifier directReference, ASN1Integer indirectReference, ASN1Primitive dataValueDescriptor, int encoding, ASN1Primitive externalData)` | Creates a new instance of External.
    `ASN1External​(ASN1ObjectIdentifier directReference, ASN1Integer indirectReference, ASN1Primitive dataValueDescriptor, DERTaggedObject externalData)` | Creates a new instance of External See X.690 for more informations about the meaning of these parameters

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ASN1Primitive` | `getDataValueDescriptor()` | Returns the data value descriptor
    `ASN1ObjectIdentifier` | `getDirectReference()` | Returns the direct reference of the external element
    `int` | `getEncoding()` | Returns the encoding of the content.
    `ASN1Primitive` | `getExternalContent()` | Returns the content of this element
    `ASN1Integer` | `getIndirectReference()` | Returns the indirect reference of this element
    `int` | `hashCode()` |

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Primitive

      `encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1Primitive`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `getEncoded, getEncoded, hasEncodedTagValue`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### directReference

          protected ASN1ObjectIdentifier directReference

    - #### indirectReference

          protected ASN1Integer indirectReference

    - #### dataValueDescriptor

          protected ASN1Primitive dataValueDescriptor

    - #### encoding

          protected int encoding

    - #### externalContent

          protected ASN1Primitive externalContent

  - ### Constructor Detail

    - #### ASN1External

          public ASN1External​(ASN1EncodableVector vector)

      Construct an EXTERNAL object, the input encoding vector must have exactly two elements on it.

      Acceptable input formats are:

      - `ASN1ObjectIdentifier` + data `DERTaggedObject` (direct reference form)
      - `ASN1Integer` + data `DERTaggedObject` (indirect reference form)
      - Anything but `DERTaggedObject` + data `DERTaggedObject` (data value form)
      Throws:
        `java.lang.IllegalArgumentException` - if input size is wrong, or

    - #### ASN1External

          public ASN1External​(ASN1ObjectIdentifier directReference,
                              ASN1Integer indirectReference,
                              ASN1Primitive dataValueDescriptor,
                              DERTaggedObject externalData)

      Creates a new instance of External See X.690 for more informations about the meaning of these parameters
      Parameters:
        `directReference` - The direct reference or `null` if not set.
        `indirectReference` - The indirect reference or `null` if not set.
        `dataValueDescriptor` - The data value descriptor or `null` if not set.
        `externalData` - The external data in its encoded form.

    - #### ASN1External

          public ASN1External​(ASN1ObjectIdentifier directReference,
                              ASN1Integer indirectReference,
                              ASN1Primitive dataValueDescriptor,
                              int encoding,
                              ASN1Primitive externalData)

      Creates a new instance of External. See X.690 for more informations about the meaning of these parameters
      Parameters:
        `directReference` - The direct reference or `null` if not set.
        `indirectReference` - The indirect reference or `null` if not set.
        `dataValueDescriptor` - The data value descriptor or `null` if not set.
        `encoding` - The encoding to be used for the external data
        `externalData` - The external data

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `ASN1Primitive`

    - #### getDataValueDescriptor

          public ASN1Primitive getDataValueDescriptor()

      Returns the data value descriptor
      Returns:
        The descriptor

    - #### getDirectReference

          public ASN1ObjectIdentifier getDirectReference()

      Returns the direct reference of the external element
      Returns:
        The reference

    - #### getEncoding

          public int getEncoding()

      Returns the encoding of the content. Valid values are
      - `0` single-ASN1-type
      - `1` OCTET STRING
      - `2` BIT STRING
      Returns:
        The encoding

    - #### getExternalContent

          public ASN1Primitive getExternalContent()

      Returns the content of this element
      Returns:
        The content

    - #### getIndirectReference

          public ASN1Integer getIndirectReference()

      Returns the indirect reference of this element
      Returns:
        The reference