Package eu.europa.esig.dss.cms.stream
Class CMSStreamDocumentBuilder
java.lang.Object
eu.europa.esig.dss.cms.stream.CMSStreamDocumentBuilder
This class is used to build a
eu.europa.esig.dss.cms.CMS
into a eu.europa.esig.dss.model.DSSDocument
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAttributeCertificates
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds attribute certificates fromCMS
to aDSSCMSSignedDataStreamGenerator
protected void
addCertificates
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds SignedData.certificates fromCMS
to aDSSCMSSignedDataStreamGenerator
protected void
addCRLs
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds CRLs fromCMS
to aDSSCMSSignedDataStreamGenerator
protected void
addDigestAlgorithmIDs
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds digest algorithms IDs fromCMS
to aDSSCMSSignedDataStreamGenerator
protected void
addOCSPBasicStore
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds OCSP basic store fromCMS
to aDSSCMSSignedDataStreamGenerator
protected void
addOCSPResponses
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds OCSP responses fromCMS
to aDSSCMSSignedDataStreamGenerator
protected void
addSigners
(DSSCMSSignedDataStreamGenerator generator, CMS cms) Adds signers fromCMS
to aDSSCMSSignedDataStreamGenerator
protected org.bouncycastle.cms.CMSSignedDataStreamGenerator
Creates aCMSSignedDataStreamGenerator
to generate a complete CMSSignedData object from a givenCMS
.protected org.bouncycastle.cms.CMSSignedDataStreamGenerator
createCMSSignedDataStreamGenerator
(CMS cms, boolean skipUnsignedAttributes) Creates aCMSSignedDataStreamGenerator
to generate a CMSSignedData object from a givenCMS
.Builds aCMSSignedData
protected org.bouncycastle.cms.CMSTypedData
getContentToBeSigned
(CMS cms) Returns the content to be signedorg.bouncycastle.cms.SignerInformationStore
recreateSignerInformationStore
(CMS cms, org.bouncycastle.operator.DigestCalculatorProvider digestCalculatorProvider) Creates a new SignerInformationStore using thedigestCalculatorProvider
.setResourcesHandlerBuilder
(DSSResourcesHandlerBuilder resourcesHandlerBuilder) This method sets aDSSResourcesHandlerBuilder
to be used for operating with internal objects during the signature creation procedure.
-
Constructor Details
-
CMSStreamDocumentBuilder
public CMSStreamDocumentBuilder()Default constructor
-
-
Method Details
-
setResourcesHandlerBuilder
public CMSStreamDocumentBuilder setResourcesHandlerBuilder(DSSResourcesHandlerBuilder resourcesHandlerBuilder) This method sets aDSSResourcesHandlerBuilder
to be used for operating with internal objects during the signature creation procedure.- Parameters:
resourcesHandlerBuilder
-DSSResourcesHandlerBuilder
- Returns:
- this
CMSStreamDocumentBuilder
-
createCMSSignedDocument
Builds aCMSSignedData
- 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 thedigestCalculatorProvider
. This method skips unsigned properties as they are not required for a re-created SignerInformationStore.- Parameters:
cms
-CMS
used to re-create the SignerInformationStore fromdigestCalculatorProvider
-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 aCMSSignedDataStreamGenerator
to generate a complete CMSSignedData object from a givenCMS
.- Parameters:
cms
-CMS
- Returns:
CMSSignedDataStreamGenerator
-
createCMSSignedDataStreamGenerator
protected org.bouncycastle.cms.CMSSignedDataStreamGenerator createCMSSignedDataStreamGenerator(CMS cms, boolean skipUnsignedAttributes) Creates aCMSSignedDataStreamGenerator
to generate a CMSSignedData object from a givenCMS
. 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
Adds signers fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-CMS
-
addCertificates
Adds SignedData.certificates fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-CMS
-
addDigestAlgorithmIDs
Adds digest algorithms IDs fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-CMS
-
addAttributeCertificates
protected void addAttributeCertificates(DSSCMSSignedDataStreamGenerator generator, CMS cms) throws org.bouncycastle.cms.CMSException Adds attribute certificates fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-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 fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-CMS
- Throws:
org.bouncycastle.cms.CMSException
- if an exception occurs
-
addOCSPResponses
Adds OCSP responses fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-CMS
-
addOCSPBasicStore
Adds OCSP basic store fromCMS
to aDSSCMSSignedDataStreamGenerator
- Parameters:
generator
-DSSCMSSignedDataStreamGenerator
to extendcms
-CMS
-
getContentToBeSigned
Returns the content to be signed- Parameters:
cms
-CMS
- Returns:
CMSTypedData
-