Class CMSBuilder
java.lang.Object
eu.europa.esig.dss.cades.signature.CMSBuilder
Builds a
CMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCMS
(org.bouncycastle.cms.SignerInfoGenerator signerInfoGenerator, DSSDocument toSignDocument) Builds aCMSSignedData
extendCMSSignedData
(Collection<CertificateToken> certificateTokens, Collection<CRLToken> crlTokens, Collection<OCSPToken> ocspTokens) Extends the providedoriginalCMS
with the required validation datasetCertificateChain
(Collection<CertificateToken> certificateChain) Sets a collection of certificates to be incorporated within SignedData.certificates fieldsetEncapsulate
(boolean encapsulate) Sets whether a signer content shall be encapsulated to the CMSSignedData.setGenerateWithoutCertificates
(boolean generateWithoutCertificates) Sets whether CMSSignedData is to be generated without certificates inside.setOriginalCMS
(CMS originalCMS) Sets the original CMSSignedData, which internal field values will be copied to a new CMSSignedDatasetSigningCertificate
(CertificateToken signingCertificate) Sets a signing-certificate to be used for CMSSignedData generationsetTrustAnchorBPPolicy
(boolean trustAnchorBPPolicy) Sets whether a B-level trust anchor policy should be used.setTrustedCertificateSource
(CertificateSource trustedCertificateSource) Sets a trusted certificate source.
-
Constructor Details
-
CMSBuilder
public CMSBuilder()This is the default constructor forCMSSignedDataBuilder
.
-
-
Method Details
-
setSigningCertificate
Sets a signing-certificate to be used for CMSSignedData generation- Parameters:
signingCertificate
-CertificateToken
- Returns:
- this
CMSBuilder
-
setCertificateChain
Sets a collection of certificates to be incorporated within SignedData.certificates field- Parameters:
certificateChain
- a collection ofCertificateToken
s- Returns:
- this
CMSBuilder
-
setGenerateWithoutCertificates
Sets whether CMSSignedData is to be generated without certificates inside. Default : FALSE (an attempt to generate without certificates will result to an exception)- Parameters:
generateWithoutCertificates
- whether CMSSignedData is to be generated without certificates- Returns:
- this
CMSBuilder
-
setTrustedCertificateSource
Sets a trusted certificate source. SeetrustAnchorBPPolicy
for more details.- Parameters:
trustedCertificateSource
-CertificateSource
- Returns:
- this
CMSBuilder
-
setTrustAnchorBPPolicy
Sets whether a B-level trust anchor policy should be used. When enabled, the trust anchor is not included to the generated certificate chain. Otherwise, the chain is generated up to a trust anchor, including the trust anchor itself. Default : TRUE (the certificate chain will be generated up to a trust anchor, excluded)- Parameters:
trustAnchorBPPolicy
- whether a B-level trust anchor policy should be used- Returns:
- this
CMSBuilder
-
setOriginalCMS
Sets the original CMSSignedData, which internal field values will be copied to a new CMSSignedData- Parameters:
originalCMS
-CMS
- Returns:
- this
CMSBuilder
-
setEncapsulate
Sets whether a signer content shall be encapsulated to the CMSSignedData. When enabled creates an enveloping signature, otherwise creates detached signature. Default : TRUE (the signer content is included to the signature)- Parameters:
encapsulate
- whether signer content shall be encapsulated to the CMSSignedData- Returns:
- this
CMSBuilder
-
createCMS
public CMS createCMS(org.bouncycastle.cms.SignerInfoGenerator signerInfoGenerator, DSSDocument toSignDocument) Builds aCMSSignedData
- Parameters:
signerInfoGenerator
-SignerInfoGenerator
toSignDocument
-DSSDocument
- Returns:
CMSSignedData
-
extendCMSSignedData
public CMS extendCMSSignedData(Collection<CertificateToken> certificateTokens, Collection<CRLToken> crlTokens, Collection<OCSPToken> ocspTokens) Extends the providedoriginalCMS
with the required validation data- Parameters:
certificateTokens
- a collection ofCertificateToken
scrlTokens
- a collection ofCRLToken
socspTokens
- a collection ofOCSPToken
s- Returns:
- extended
CMS
-