Table of Contents

Class CMSContainer

Namespace
iText.Signatures.Cms
Assembly
itext.sign.dll

The CMS container which represents SignedData structure from rfc5652 Cryptographic Message Syntax (CMS)

public class CMSContainer
Inheritance
CMSContainer
Inherited Members

Constructors

CMSContainer()

Creates an empty SignedData structure.

public CMSContainer()

CMSContainer(byte[])

Creates a SignedData structure from a serialized ASN1 structure.

public CMSContainer(byte[] encodedCMSdata)

Parameters

encodedCMSdata byte[]

the serialized CMS container

Methods

AddCertificate(IX509Certificate)

Adds a certificate.

public virtual void AddCertificate(IX509Certificate cert)

Parameters

cert IX509Certificate

the certificate to be added

AddCertificates(IX509Certificate[])

Adds a set of certificates.

public virtual void AddCertificates(IX509Certificate[] certs)

Parameters

certs IX509Certificate[]

the certificates to be added

AddCrl(IX509Crl)

Adds a CRL response to the CMS container.

public virtual void AddCrl(IX509Crl crl)

Parameters

crl IX509Crl

the CRL response to be added.

AddOcsp(IBasicOcspResponse)

Adds an OCSP response to the CMS container.

public virtual void AddOcsp(IBasicOcspResponse ocspResponse)

Parameters

ocspResponse IBasicOcspResponse

the OCSP response to be added.

GetCertificates()

Retrieves a copy of the list of certificates.

public virtual ICollection<IX509Certificate> GetCertificates()

Returns

ICollection<IX509Certificate>

the list of certificates to be used for signing and certificate validation

GetCmsVersion()

Only version 1 is supported by this class.

public virtual int GetCmsVersion()

Returns

int

1 as CMSversion

GetCrls()

Retrieves a copy of the list of CRLs.

public virtual ICollection<IX509Crl> GetCrls()

Returns

ICollection<IX509Crl>

the list of CRL revocation info.

GetDigestAlgorithm()

The digest algorithm OID and parameters used by the signer.

public virtual AlgorithmIdentifier GetDigestAlgorithm()

Returns

AlgorithmIdentifier

AlgorithmIdentifier digest algorithm.

Remarks

The digest algorithm OID and parameters used by the signer. This class only supports one signer for use in pdf signatures, so only one digest algorithm is supported.

This field is set when adding the signerInfo.

GetEncapContentInfo()

This represents the signed content.

public virtual EncapsulatedContentInfo GetEncapContentInfo()

Returns

EncapsulatedContentInfo

a representation of the data to be signed.

Remarks

This represents the signed content. In the case of a signed PDF document this will be of type data with no content.

GetOcsps()

Retrieves a copy of the list of OCSPs.

public virtual ICollection<IBasicOcspResponse> GetOcsps()

Returns

ICollection<IBasicOcspResponse>

the list of OCSP revocation info.

GetSerializedSignedAttributes()

Retrieves the encoded signed attributes of the signer info.

public virtual byte[] GetSerializedSignedAttributes()

Returns

byte[]

the encoded signed attributes of the signer info.

Remarks

Retrieves the encoded signed attributes of the signer info. This makes the signed attributes read only.

GetSignerInfo()

This class only supports one signer per signature field.

public virtual SignerInfo GetSignerInfo()

Returns

SignerInfo

the singerInfo

GetSizeEstimation()

When all fields except for signer.signedAttributes.digest and signer.signature are completed it is possible to calculate the eventual size of the signature by serializing except for the signature (that depends on the digest and cypher but is set at 1024 bytes) and later added unsigned attributes like timestamps.

public virtual long GetSizeEstimation()

Returns

long

the estimated size of the complete CMS container before signature is added, size for the signature is added, size for other attributes like timestamps is not.

Serialize()

Serializes the SignedData structure and makes the signer infos signed attributes read only.

public virtual byte[] Serialize()

Returns

byte[]

the encoded DignedData structure.

SetEncapContentInfo(EncapsulatedContentInfo)

This represents the signed content.

public virtual void SetEncapContentInfo(EncapsulatedContentInfo encapContentInfo)

Parameters

encapContentInfo EncapsulatedContentInfo

a representation of the data to be signed.

Remarks

This represents the signed content. In the case of a signed PDF document this will be of type data with no content. Defaults to 1.2.840.113549.1.7.1 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-7(7) id-data(1)}

SetSerializedSignedAttributes(byte[])

Sets the Signed Attributes of the signer info to this serialized version.

public virtual void SetSerializedSignedAttributes(byte[] signedAttributesData)

Parameters

signedAttributesData byte[]

the serialized Signed Attributes

Remarks

Sets the Signed Attributes of the signer info to this serialized version. The signed attributes will become read-only.

SetSignerInfo(SignerInfo)

This class only supports one signer per signature field.

public virtual void SetSignerInfo(SignerInfo signerInfo)

Parameters

signerInfo SignerInfo

the singerInfo