Package org.bouncycastle.asn1.cms

## Class ContentInfo

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

- All Implemented Interfaces:
    `ASN1Encodable`, `CMSObjectIdentifiers`, `Encodable`

      public class ContentInfo
      extends ASN1Object
      implements CMSObjectIdentifiers

  RFC 5652 ContentInfo, and RFC 5652 EncapsulatedContentInfo objects.

       ContentInfo ::= SEQUENCE {
           contentType ContentType,
           content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
       }

       EncapsulatedContentInfo ::= SEQUENCE {
           eContentType ContentType,
           eContent [0] EXPLICIT OCTET STRING OPTIONAL
       }

- - ### Field Summary

    - ### Fields inherited from interface org.bouncycastle.asn1.cms.CMSObjectIdentifiers

      `authenticatedData, authEnvelopedData, compressedData, data, digestedData, encryptedData, envelopedData, id_ri, id_ri_ocsp_response, id_ri_scvp, signedAndEnvelopedData, signedData, timestampedData`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ContentInfo​(ASN1ObjectIdentifier contentType, ASN1Encodable content)` |
    `ContentInfo​(ASN1Sequence seq)` | Deprecated. use getInstance()

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ASN1Encodable` | `getContent()` |
    `ASN1ObjectIdentifier` | `getContentType()` |
    `static ContentInfo` | `getInstance​(java.lang.Object obj)` | Return an ContentInfo object from the given object.
    `static ContentInfo` | `getInstance​(ASN1TaggedObject obj, boolean explicit)` |
    `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

    - #### ContentInfo

          public ContentInfo​(ASN1Sequence seq)

      Deprecated.
      use getInstance()

    - #### ContentInfo

          public ContentInfo​(ASN1ObjectIdentifier contentType,
                             ASN1Encodable content)

  - ### Method Detail

    - #### getInstance

          public static ContentInfo getInstance​(java.lang.Object obj)

      Return an ContentInfo object from the given object.

      Accepted inputs:

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

    - #### getInstance

          public static ContentInfo getInstance​(ASN1TaggedObject obj,
                                                boolean explicit)

    - #### getContentType

          public ASN1ObjectIdentifier getContentType()

    - #### getContent

          public ASN1Encodable getContent()

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