Class CMSBuilder

java.lang.Object
eu.europa.esig.dss.cades.signature.CMSBuilder

public class CMSBuilder extends Object
Builds a CMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    This is the default constructor for CMSSignedDataBuilder.
  • Method Summary

    Modifier and Type
    Method
    Description
    eu.europa.esig.dss.cms.CMS
    createCMS(org.bouncycastle.cms.SignerInfoGenerator signerInfoGenerator, eu.europa.esig.dss.model.DSSDocument toSignDocument)
    Builds a CMSSignedData
    eu.europa.esig.dss.cms.CMS
    extendCMSSignedData(Collection<eu.europa.esig.dss.model.x509.CertificateToken> certificateTokens, Collection<eu.europa.esig.dss.spi.x509.revocation.crl.CRLToken> crlTokens, Collection<eu.europa.esig.dss.spi.x509.revocation.ocsp.OCSPToken> ocspTokens)
    Extends the provided originalCMS with the required validation data
    setCertificateChain(Collection<eu.europa.esig.dss.model.x509.CertificateToken> certificateChain)
    Sets a collection of certificates to be incorporated within SignedData.certificates field
    setEncapsulate(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(eu.europa.esig.dss.cms.CMS originalCMS)
    Sets the original CMSSignedData, which internal field values will be copied to a new CMSSignedData
    setSigningCertificate(eu.europa.esig.dss.model.x509.CertificateToken signingCertificate)
    Sets a signing-certificate to be used for CMSSignedData generation
    setTrustAnchorBPPolicy(boolean trustAnchorBPPolicy)
    Sets whether a B-level trust anchor policy should be used.
    setTrustedCertificateSource(eu.europa.esig.dss.spi.x509.CertificateSource trustedCertificateSource)
    Sets a trusted certificate source.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CMSBuilder

      public CMSBuilder()
      This is the default constructor for CMSSignedDataBuilder.
  • Method Details

    • setSigningCertificate

      public CMSBuilder setSigningCertificate(eu.europa.esig.dss.model.x509.CertificateToken signingCertificate)
      Sets a signing-certificate to be used for CMSSignedData generation
      Parameters:
      signingCertificate - CertificateToken
      Returns:
      this CMSBuilder
    • setCertificateChain

      public CMSBuilder setCertificateChain(Collection<eu.europa.esig.dss.model.x509.CertificateToken> certificateChain)
      Sets a collection of certificates to be incorporated within SignedData.certificates field
      Parameters:
      certificateChain - a collection of CertificateTokens
      Returns:
      this CMSBuilder
    • setGenerateWithoutCertificates

      public CMSBuilder setGenerateWithoutCertificates(boolean generateWithoutCertificates)
      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

      public CMSBuilder setTrustedCertificateSource(eu.europa.esig.dss.spi.x509.CertificateSource trustedCertificateSource)
      Sets a trusted certificate source. See trustAnchorBPPolicy for more details.
      Parameters:
      trustedCertificateSource - CertificateSource
      Returns:
      this CMSBuilder
    • setTrustAnchorBPPolicy

      public CMSBuilder setTrustAnchorBPPolicy(boolean trustAnchorBPPolicy)
      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

      public CMSBuilder setOriginalCMS(eu.europa.esig.dss.cms.CMS originalCMS)
      Sets the original CMSSignedData, which internal field values will be copied to a new CMSSignedData
      Parameters:
      originalCMS - CMS
      Returns:
      this CMSBuilder
    • setEncapsulate

      public CMSBuilder setEncapsulate(boolean encapsulate)
      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 eu.europa.esig.dss.cms.CMS createCMS(org.bouncycastle.cms.SignerInfoGenerator signerInfoGenerator, eu.europa.esig.dss.model.DSSDocument toSignDocument)
      Builds a CMSSignedData
      Parameters:
      signerInfoGenerator - SignerInfoGenerator
      toSignDocument - DSSDocument
      Returns:
      CMSSignedData
    • extendCMSSignedData

      public eu.europa.esig.dss.cms.CMS extendCMSSignedData(Collection<eu.europa.esig.dss.model.x509.CertificateToken> certificateTokens, Collection<eu.europa.esig.dss.spi.x509.revocation.crl.CRLToken> crlTokens, Collection<eu.europa.esig.dss.spi.x509.revocation.ocsp.OCSPToken> ocspTokens)
      Extends the provided originalCMS with the required validation data
      Parameters:
      certificateTokens - a collection of CertificateTokens
      crlTokens - a collection of CRLTokens
      ocspTokens - a collection of OCSPTokens
      Returns:
      extended CMS