public class CMSContainer extends Object
| Constructor and Description |
|---|
CMSContainer()
Creates an empty SignedData structure.
|
CMSContainer(byte[] encodedCMSdata)
Creates a SignedData structure from a serialized ASN1 structure.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCertificate(X509Certificate cert)
Adds a certificate.
|
void |
addCertificates(X509Certificate[] certs)
Adds a set of certificates.
|
void |
addCrl(CRL crl)
Adds a CRL response to the CMS container.
|
void |
addOcsp(com.itextpdf.commons.bouncycastle.asn1.ocsp.IBasicOCSPResponse ocspResponse)
Adds an OCSP response to the CMS container.
|
Collection<X509Certificate> |
getCertificates()
Retrieves a copy of the list of certificates.
|
int |
getCmsVersion()
Only version 1 is supported by this class.
|
Collection<CRL> |
getCrls()
Retrieves a copy of the list of CRLs.
|
AlgorithmIdentifier |
getDigestAlgorithm()
The digest algorithm OID and parameters used by the signer.
|
EncapsulatedContentInfo |
getEncapContentInfo()
This represents the signed content.
|
Collection<com.itextpdf.commons.bouncycastle.asn1.ocsp.IBasicOCSPResponse> |
getOcsps()
Retrieves a copy of the list of OCSPs.
|
byte[] |
getSerializedSignedAttributes()
Retrieves the encoded signed attributes of the signer info.
|
SignerInfo |
getSignerInfo()
This class only supports one signer per signature field.
|
long |
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.
|
byte[] |
serialize()
Serializes the SignedData structure and makes the signer infos signed attributes read only.
|
void |
setEncapContentInfo(EncapsulatedContentInfo encapContentInfo)
This represents the signed content.
|
void |
setSerializedSignedAttributes(byte[] signedAttributesData)
Sets the Signed Attributes of the signer info to this serialized version.
|
void |
setSignerInfo(SignerInfo signerInfo)
This class only supports one signer per signature field.
|
public CMSContainer()
public CMSContainer(byte[] encodedCMSdata)
throws IOException,
CertificateException,
CRLException
encodedCMSdata - the serialized CMS containerIOException - if issues occur during ASN1 objects creation.CertificateException - if issues occur processing the embedded certificates.CRLException - if CRL encoding error occurs.public void setSignerInfo(SignerInfo signerInfo)
signerInfo - the singerInfopublic SignerInfo getSignerInfo()
public long getSizeEstimation()
throws CertificateEncodingException,
IOException,
CRLException
CertificateEncodingException - if an encoding error occurs in X509Certificate.IOException - if an I/O error occurs.CRLException - if CRL encoding error occurs.public int getCmsVersion()
public AlgorithmIdentifier getDigestAlgorithm()
This field is set when adding the signerInfo.
AlgorithmIdentifier digest algorithm.public EncapsulatedContentInfo getEncapContentInfo()
public void setEncapContentInfo(EncapsulatedContentInfo encapContentInfo)
encapContentInfo - a representation of the data to be signed.public void addCertificate(X509Certificate cert)
cert - the certificate to be addedpublic void addCertificates(X509Certificate[] certs)
certs - the certificates to be addedpublic Collection<X509Certificate> getCertificates()
public Collection<CRL> getCrls()
public void addCrl(CRL crl)
crl - the CRL response to be added.public Collection<com.itextpdf.commons.bouncycastle.asn1.ocsp.IBasicOCSPResponse> getOcsps()
public void addOcsp(com.itextpdf.commons.bouncycastle.asn1.ocsp.IBasicOCSPResponse ocspResponse)
ocspResponse - the OCSP response to be added.public void setSerializedSignedAttributes(byte[] signedAttributesData)
signedAttributesData - the serialized Signed Attributespublic byte[] getSerializedSignedAttributes()
throws IOException
IOException - if issues occur during ASN1 objects creation.public byte[] serialize()
throws CertificateEncodingException,
IOException,
CRLException
CertificateEncodingException - if errors occur during certificate processing.IOException - if issues occur during ASN1 objects creation.CRLException - if CRL encoding error occurs.Copyright © 1998–2024 Apryse Group NV. All rights reserved.