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

org.bouncycastle.asn1.cms

## Class OriginatorIdentifierOrKey

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

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, Encodable

      public class OriginatorIdentifierOrKey
      extends ASN1Object
      implements ASN1Choice

  RFC 5652: Content encryption key delivery mechanisms.

       OriginatorIdentifierOrKey ::= CHOICE {
           issuerAndSerialNumber IssuerAndSerialNumber,
           subjectKeyIdentifier [0] SubjectKeyIdentifier,
           originatorKey [1] OriginatorPublicKey
       }

       SubjectKeyIdentifier ::= OCTET STRING

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OriginatorIdentifierOrKey(ASN1OctetString id)` Deprecated. use version taking a SubjectKeyIdentifier
    `OriginatorIdentifierOrKey(ASN1Primitive id)` Deprecated. use more specific version
    `OriginatorIdentifierOrKey(IssuerAndSerialNumber id)`
    `OriginatorIdentifierOrKey(OriginatorPublicKey id)`
    `OriginatorIdentifierOrKey(SubjectKeyIdentifier id)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1Encodable` | `getId()`
    `static OriginatorIdentifierOrKey` | `getInstance(ASN1TaggedObject o, boolean explicit)` Return an OriginatorIdentifierOrKey object from a tagged object.
    `static OriginatorIdentifierOrKey` | `getInstance(java.lang.Object o)` Return an OriginatorIdentifierOrKey object from the given object.
    `IssuerAndSerialNumber` | `getIssuerAndSerialNumber()`
    `OriginatorPublicKey` | `getOriginatorKey()`
    `SubjectKeyIdentifier` | `getSubjectKeyIdentifier()`
    `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

    - #### OriginatorIdentifierOrKey

          public OriginatorIdentifierOrKey(IssuerAndSerialNumber id)

    - #### OriginatorIdentifierOrKey

          public OriginatorIdentifierOrKey(ASN1OctetString id)

      Deprecated. use version taking a SubjectKeyIdentifier

    - #### OriginatorIdentifierOrKey

          public OriginatorIdentifierOrKey(SubjectKeyIdentifier id)

    - #### OriginatorIdentifierOrKey

          public OriginatorIdentifierOrKey(OriginatorPublicKey id)

    - #### OriginatorIdentifierOrKey

          public OriginatorIdentifierOrKey(ASN1Primitive id)

      Deprecated. use more specific version

  - ### Method Detail

    - #### getInstance

          public static OriginatorIdentifierOrKey getInstance(ASN1TaggedObject o,
                                                              boolean explicit)

      Return an OriginatorIdentifierOrKey object from a tagged object.
      Parameters:
        `o` - the tagged object holding the object we want.
        `explicit` - true if the object is meant to be explicitly tagged false otherwise.
      Throws:
        `java.lang.IllegalArgumentException` - if the object held by the tagged object cannot be converted.

    - #### getInstance

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

      Return an OriginatorIdentifierOrKey object from the given object.

      Accepted inputs:

      - null → null
      - `OriginatorIdentifierOrKey` object
      - `IssuerAndSerialNumber` object
      - `ASN1TaggedObject` input formats with IssuerAndSerialNumber structure inside
      Parameters:
        `o` - the object we want converted.
      Throws:
        `java.lang.IllegalArgumentException` - if the object cannot be converted.

    - #### getId

          public ASN1Encodable getId()

    - #### getIssuerAndSerialNumber

          public IssuerAndSerialNumber getIssuerAndSerialNumber()

    - #### getSubjectKeyIdentifier

          public SubjectKeyIdentifier getSubjectKeyIdentifier()

    - #### getOriginatorKey

          public OriginatorPublicKey getOriginatorKey()

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