Targets (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.asn1.x509

## Class Targets

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

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class Targets
      extends ASN1Object

  Targets structure used in target information extension for attribute certificates from RFC 3281.

                  Targets ::= SEQUENCE OF Target

                  Target  ::= CHOICE {
                    targetName          [0] GeneralName,
                    targetGroup         [1] GeneralName,
                    targetCert          [2] TargetCert
                  }

                  TargetCert  ::= SEQUENCE {
                    targetCertificate    IssuerSerial,
                    targetName           GeneralName OPTIONAL,
                    certDigestInfo       ObjectDigestInfo OPTIONAL
                  }

  See Also:
    `Target`, `TargetInformation`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Targets(Target[] targets)` Constructor from given targets.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Targets` | `getInstance(java.lang.Object obj)` Creates an instance of a Targets from the given object.
    `Target[]` | `getTargets()` Returns the targets in a `Vector`.
    `ASN1Primitive` | `toASN1Primitive()` Produce an object suitable for an ASN1OutputStream.

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

    - #### Targets

          public Targets(Target[] targets)

      Constructor from given targets.

      The vector is copied.

      Parameters:
        `targets` - A `Vector` of `Target`s.
      Throws:
        `java.lang.IllegalArgumentException` - if the vector contains not only Targets.
      See Also:
        `Target`

  - ### Method Detail

    - #### getInstance

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

      Creates an instance of a Targets from the given object.

      `obj` can be a Targets or a `ASN1Sequence`

      Parameters:
        `obj` - The object.
      Returns:
        A Targets instance.
      Throws:
        `java.lang.IllegalArgumentException` - if the given object cannot be interpreted as Target.

    - #### getTargets

          public Target[] getTargets()

      Returns the targets in a `Vector`.

      The vector is cloned before it is returned.

      Returns:
        Returns the targets.

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Produce an object suitable for an ASN1OutputStream. Returns:

                      Targets ::= SEQUENCE OF Target

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a ASN1Primitive