Class CMSStreamDocumentBuilder

java.lang.Object
eu.europa.esig.dss.cms.stream.CMSStreamDocumentBuilder

public class CMSStreamDocumentBuilder extends Object
This class is used to build a eu.europa.esig.dss.cms.CMS into a eu.europa.esig.dss.model.DSSDocument
  • Constructor Details

    • CMSStreamDocumentBuilder

      public CMSStreamDocumentBuilder()
      Default constructor
  • Method Details

    • setResourcesHandlerBuilder

      public CMSStreamDocumentBuilder setResourcesHandlerBuilder(DSSResourcesHandlerBuilder resourcesHandlerBuilder)
      This method sets a DSSResourcesHandlerBuilder to be used for operating with internal objects during the signature creation procedure.
      Parameters:
      resourcesHandlerBuilder - DSSResourcesHandlerBuilder
      Returns:
      this CMSStreamDocumentBuilder
    • createCMSSignedDocument

      public DSSDocument createCMSSignedDocument(CMS cms)
      Builds a CMSSignedData
      Parameters:
      cms - CMS
      Returns:
      CMSSignedData
    • recreateSignerInformationStore

      public org.bouncycastle.cms.SignerInformationStore recreateSignerInformationStore(CMS cms, org.bouncycastle.operator.DigestCalculatorProvider digestCalculatorProvider) throws org.bouncycastle.cms.CMSException
      Creates a new SignerInformationStore using the digestCalculatorProvider. This method skips unsigned properties as they are not required for a re-created SignerInformationStore.
      Parameters:
      cms - CMS used to re-create the SignerInformationStore from
      digestCalculatorProvider - DigestCalculatorProvider providing digest of the detached signed content
      Returns:
      SignerInformationStore re-created with content digest computed
      Throws:
      org.bouncycastle.cms.CMSException - if an exception occurs on CMS re-generation
    • createCMSSignedDataStreamGenerator

      protected org.bouncycastle.cms.CMSSignedDataStreamGenerator createCMSSignedDataStreamGenerator(CMS cms)
      Creates a CMSSignedDataStreamGenerator to generate a complete CMSSignedData object from a given CMS.
      Parameters:
      cms - CMS
      Returns:
      CMSSignedDataStreamGenerator
    • createCMSSignedDataStreamGenerator

      protected org.bouncycastle.cms.CMSSignedDataStreamGenerator createCMSSignedDataStreamGenerator(CMS cms, boolean skipUnsignedAttributes)
      Creates a CMSSignedDataStreamGenerator to generate a CMSSignedData object from a given CMS. This method allows to define whether the unsigned attributes are to be added within the generated CMS object.
      Parameters:
      cms - CMS
      skipUnsignedAttributes - whether the unsigned attributes should be skipped from the generated object
      Returns:
      CMSSignedDataStreamGenerator
    • addSigners

      protected void addSigners(DSSCMSSignedDataStreamGenerator generator, CMS cms)
      Adds signers from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
    • addCertificates

      protected void addCertificates(DSSCMSSignedDataStreamGenerator generator, CMS cms)
      Adds SignedData.certificates from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
    • addDigestAlgorithmIDs

      protected void addDigestAlgorithmIDs(DSSCMSSignedDataStreamGenerator generator, CMS cms)
      Adds digest algorithms IDs from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
    • addAttributeCertificates

      protected void addAttributeCertificates(DSSCMSSignedDataStreamGenerator generator, CMS cms) throws org.bouncycastle.cms.CMSException
      Adds attribute certificates from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
      Throws:
      org.bouncycastle.cms.CMSException - if an exception occurs
    • addCRLs

      protected void addCRLs(DSSCMSSignedDataStreamGenerator generator, CMS cms) throws org.bouncycastle.cms.CMSException
      Adds CRLs from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
      Throws:
      org.bouncycastle.cms.CMSException - if an exception occurs
    • addOCSPResponses

      protected void addOCSPResponses(DSSCMSSignedDataStreamGenerator generator, CMS cms)
      Adds OCSP responses from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
    • addOCSPBasicStore

      protected void addOCSPBasicStore(DSSCMSSignedDataStreamGenerator generator, CMS cms)
      Adds OCSP basic store from CMS to a DSSCMSSignedDataStreamGenerator
      Parameters:
      generator - DSSCMSSignedDataStreamGenerator to extend
      cms - CMS
    • getContentToBeSigned

      protected org.bouncycastle.cms.CMSTypedData getContentToBeSigned(CMS cms)
      Returns the content to be signed
      Parameters:
      cms - CMS
      Returns:
      CMSTypedData