Class CMSForCAdESBuilderHelper

java.lang.Object
eu.europa.esig.dss.cades.signature.CMSForCAdESBuilderHelper
Direct Known Subclasses:
CMSForPAdESBuilderHelper

public class CMSForCAdESBuilderHelper extends Object
This class is used to build an instance of eu.europa.esig.dss.cms.CMS for a CAdES Baseline B creation
  • Field Details

    • documentToSign

      protected final DSSDocument documentToSign
      The document to be signed by the CAdES signature
    • signatureParameters

      protected final CAdESSignatureParameters signatureParameters
      Signature parameters used on the signature creation
    • contentSigner

      protected final org.bouncycastle.operator.ContentSigner contentSigner
      Content signer used for the signature creation
  • Constructor Details

  • Method Details

    • setOriginalCMS

      public CMSForCAdESBuilderHelper setOriginalCMS(CMS originalCMS)
      Sets original CMS, when available
      Parameters:
      originalCMS - CMS
      Returns:
      this CMSForCAdESBuilderHelper
    • setTrustedCertificateSource

      public CMSForCAdESBuilderHelper setTrustedCertificateSource(CertificateSource trustedCertificateSource)
      Sets trusted certificate source
      Parameters:
      trustedCertificateSource - CertificateSource
      Returns:
      this CMSForCAdESBuilderHelper
    • setIncludeUnsignedAttributes

      public CMSForCAdESBuilderHelper setIncludeUnsignedAttributes(boolean includeUnsignedAttributes)
      Sets whether the unsigned attributes should be included into the generated SignerInfoGenerator
      Parameters:
      includeUnsignedAttributes - whether the unsigned attributes should be included
      Returns:
      this CMSForCAdESBuilderHelper
    • createCMS

      public CMS createCMS()
      Creates a CMS using the contentSigner
      Returns:
      CMS
    • createSignerInfoGenerator

      public org.bouncycastle.cms.SignerInfoGenerator createSignerInfoGenerator()
      Creates a SignerInfoGenerator for a CAdES creation
      Returns:
      SignerInfoGenerator
    • initSignedAttributesTable

      protected org.bouncycastle.asn1.cms.AttributeTable initSignedAttributesTable()
      Creates a signed attributes table for the CAdES Baseline B creation
      Returns:
      AttributeTable
    • initUnsignedAttributesTable

      protected org.bouncycastle.asn1.cms.AttributeTable initUnsignedAttributesTable()
      Creates an unsigned attributes table for the CAdES Baseline B creation
      Returns:
      AttributeTable
    • getCAdESProfile

      protected CAdESLevelBaselineB getCAdESProfile()
      Gets an instance of CAdESLevelBaselineB used for the signed and unsigned attributes table creation
      Returns:
      CAdESLevelBaselineB
    • initCAdESProfile

      protected CAdESLevelBaselineB initCAdESProfile()
      Instantiates a new CAdESLevelBaselineB
      Returns:
      CAdESLevelBaselineB
    • createCMSSignerInfoGeneratorBuilder

      protected CMSSignerInfoGeneratorBuilder createCMSSignerInfoGeneratorBuilder(org.bouncycastle.asn1.cms.AttributeTable signedAttributes, org.bouncycastle.asn1.cms.AttributeTable unsignedAttributes)
      Creates and configures a CMSSignerInfoGeneratorBuilder to be used for a SignerInfo creation
      Parameters:
      signedAttributes - AttributeTable representing the signed attributes
      unsignedAttributes - AttributeTable representing the unsigned attributes
      Returns:
      CMSSignerInfoGeneratorBuilder
    • initCMSSignerInfoGeneratorBuilder

      protected CMSSignerInfoGeneratorBuilder initCMSSignerInfoGeneratorBuilder()
      Creates a new instance of CMSSignerInfoGeneratorBuilder
      Returns:
      CMSSignerInfoGeneratorBuilder
    • assertSignatureParametersValid

      protected void assertSignatureParametersValid()
      Verifies validity of the signature parameters configuration
    • initCMSBuilder

      protected CMSBuilder initCMSBuilder()
      Instantiates a CMSBuilder for the CMS creation
      Returns:
      CMSBuilder
    • isEncapsulateSignerData

      protected boolean isEncapsulateSignerData()
      Gets whether the signed data shall be encapsulated
      Returns:
      TRUE if the signed data shall be encapsulated, FALSE otherwise