SignedData (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.asn1.cms

## Class SignedData

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

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class SignedData
      extends ASN1Object

  RFC 5652:

  A signed data object containing multitude of `SignerInfo`s.

       SignedData ::= SEQUENCE {
           version CMSVersion,
           digestAlgorithms DigestAlgorithmIdentifiers,
           encapContentInfo EncapsulatedContentInfo,
           certificates [0] IMPLICIT CertificateSet OPTIONAL,
           crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
           signerInfos SignerInfos
         }

       DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier

       SignerInfos ::= SET OF SignerInfo

  The version calculation uses following ruleset from RFC 5652 section 5.1:

       IF ((certificates is present) AND
          (any certificates with a type of other are present)) OR
          ((crls is present) AND
          (any crls with a type of other are present))
       THEN version MUST be 5
       ELSE
          IF (certificates is present) AND
             (any version 2 attribute certificates are present)
          THEN version MUST be 4
          ELSE
             IF ((certificates is present) AND
                (any version 1 attribute certificates are present)) OR
                (any SignerInfo structures are version 3) OR
                (encapContentInfo eContentType is other than id-data)
             THEN version MUST be 3
             ELSE version MUST be 1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SignedData(ASN1Set digestAlgorithms, ContentInfo contentInfo, ASN1Set certificates, ASN1Set crls, ASN1Set signerInfos)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1Set` | `getCertificates()`
    `ASN1Set` | `getCRLs()`
    `ASN1Set` | `getDigestAlgorithms()`
    `ContentInfo` | `getEncapContentInfo()`
    `static SignedData` | `getInstance(java.lang.Object o)` Return a SignedData object from the given object.
    `ASN1Set` | `getSignerInfos()`
    `ASN1Integer` | `getVersion()`
    `ASN1Primitive` | `toASN1Primitive()` Produce an object suitable for an ASN1OutputStream.

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode, toASN1Object`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SignedData

          public SignedData(ASN1Set digestAlgorithms,
                    ContentInfo contentInfo,
                    ASN1Set certificates,
                    ASN1Set crls,
                    ASN1Set signerInfos)

  - ### Method Detail

    - #### getInstance

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

      Return a SignedData object from the given object.

      Accepted inputs:

      - null → null
      - `SignedData` object
      - `ASN1Sequence` input formats with SignedData structure inside
      Parameters:
        `o` - the object we want converted.
      Returns:
        a reference that can be assigned to SignedData (may be null)
      Throws:
        `java.lang.IllegalArgumentException` - if the object cannot be converted.

    - #### getVersion

          public ASN1Integer getVersion()

    - #### getDigestAlgorithms

          public ASN1Set getDigestAlgorithms()

    - #### getEncapContentInfo

          public ContentInfo getEncapContentInfo()

    - #### getCertificates

          public ASN1Set getCertificates()

    - #### getCRLs

          public ASN1Set getCRLs()

    - #### getSignerInfos

          public ASN1Set getSignerInfos()

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