org.bouncycastle.asn1.cms

## Class EncryptedContentInfo

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

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class EncryptedContentInfo
      extends ASN1Object

  RFC 5652 EncryptedContentInfo object.

       EncryptedContentInfo ::= SEQUENCE {
           contentType ContentType,
           contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
           encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
       }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EncryptedContentInfo(ASN1ObjectIdentifier contentType, AlgorithmIdentifier contentEncryptionAlgorithm, ASN1OctetString encryptedContent)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AlgorithmIdentifier` | `getContentEncryptionAlgorithm()`
    `ASN1ObjectIdentifier` | `getContentType()`
    `ASN1OctetString` | `getEncryptedContent()`
    `static EncryptedContentInfo` | `getInstance(java.lang.Object obj)` Return an EncryptedContentInfo object from the given object.
    `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

    - #### EncryptedContentInfo

          public EncryptedContentInfo(ASN1ObjectIdentifier contentType,
                                      AlgorithmIdentifier contentEncryptionAlgorithm,
                                      ASN1OctetString encryptedContent)

  - ### Method Detail

    - #### getInstance

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

      Return an EncryptedContentInfo object from the given object.

      Accepted inputs:

      - null → null
      - `EncryptedContentInfo` object
      - `ASN1Sequence` input formats
      Parameters:
        `obj` - the object we want converted.
      Throws:
        `java.lang.IllegalArgumentException` - if the object cannot be converted.

    - #### getContentType

          public ASN1ObjectIdentifier getContentType()

    - #### getContentEncryptionAlgorithm

          public AlgorithmIdentifier getContentEncryptionAlgorithm()

    - #### getEncryptedContent

          public ASN1OctetString getEncryptedContent()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Produce an object suitable for an ASN1OutputStream.

      The encoding follows the encrypted content: a `BEROctetString` keeps the indefinite-length (BER) form this class has always produced, any definite-length octet string (e.g. a parse of a DER-encoded message, or a DEROctetString supplied by a generator honouring a definite-length encoding request) yields a definite-length sequence.

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