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

org.bouncycastle.asn1.cms

## Class RecipientIdentifier

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.cms.RecipientIdentifier

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, Encodable

      public class RecipientIdentifier
      extends ASN1Object
      implements ASN1Choice

  RFC 5652: Content encryption key delivery mechanisms.

       RecipientIdentifier ::= CHOICE {
           issuerAndSerialNumber IssuerAndSerialNumber,
           subjectKeyIdentifier [0] SubjectKeyIdentifier
       }

       SubjectKeyIdentifier ::= OCTET STRING

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecipientIdentifier(ASN1OctetString id)`
    `RecipientIdentifier(ASN1Primitive id)`
    `RecipientIdentifier(IssuerAndSerialNumber id)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1Encodable` | `getId()`
    `static RecipientIdentifier` | `getInstance(java.lang.Object o)` Return a RecipientIdentifier object from the given object.
    `boolean` | `isTagged()`
    `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

    - #### RecipientIdentifier

          public RecipientIdentifier(IssuerAndSerialNumber id)

    - #### RecipientIdentifier

          public RecipientIdentifier(ASN1OctetString id)

    - #### RecipientIdentifier

          public RecipientIdentifier(ASN1Primitive id)

  - ### Method Detail

    - #### getInstance

          public static RecipientIdentifier getInstance(java.lang.Object o)

      Return a RecipientIdentifier object from the given object.

      Accepted inputs:

      - null → null
      - `RecipientIdentifier` object
      - `IssuerAndSerialNumber` object
      - `ASN1OctetString` input formats (OctetString, byte[]) with value of KeyIdentifier in DER form
      - `ASN1Primitive` for RecipientIdentifier constructor
      Parameters:
        `o` - the object we want converted.
      Throws:
        `java.lang.IllegalArgumentException` - if the object cannot be converted.

    - #### isTagged

          public boolean isTagged()

    - #### getId

          public ASN1Encodable getId()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Produce an object suitable for an ASN1OutputStream.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.