Class CMSForCAdESBuilderHelper
java.lang.Object
eu.europa.esig.dss.cades.signature.CMSForCAdESBuilderHelper
- Direct Known Subclasses:
CMSForPAdESBuilderHelper
This class is used to build an instance of
eu.europa.esig.dss.cms.CMS
for a CAdES Baseline B creation-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.bouncycastle.operator.ContentSignerContent signer used for the signature creationprotected final DSSDocumentThe document to be signed by the CAdES signatureprotected final CAdESSignatureParametersSignature parameters used on the signature creation -
Constructor Summary
ConstructorsConstructorDescriptionCMSForCAdESBuilderHelper(DSSDocument documentToSign, CAdESSignatureParameters signatureParameters, org.bouncycastle.operator.ContentSigner contentSigner) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidVerifies validity of the signature parameters configurationCreates a CMS using thecontentSignerprotected CMSSignerInfoGeneratorBuildercreateCMSSignerInfoGeneratorBuilder(org.bouncycastle.asn1.cms.AttributeTable signedAttributes, org.bouncycastle.asn1.cms.AttributeTable unsignedAttributes) Creates and configures aCMSSignerInfoGeneratorBuilderto be used for a SignerInfo creationorg.bouncycastle.cms.SignerInfoGeneratorCreates a SignerInfoGenerator for a CAdES creationprotected CAdESLevelBaselineBGets an instance ofCAdESLevelBaselineBused for the signed and unsigned attributes table creationprotected CAdESLevelBaselineBInstantiates a newCAdESLevelBaselineBprotected CMSBuilderInstantiates aCMSBuilderfor the CMS creationprotected CMSSignerInfoGeneratorBuilderCreates a new instance ofCMSSignerInfoGeneratorBuilderprotected org.bouncycastle.asn1.cms.AttributeTableCreates a signed attributes table for the CAdES Baseline B creationprotected org.bouncycastle.asn1.cms.AttributeTableCreates an unsigned attributes table for the CAdES Baseline B creationprotected booleanGets whether the signed data shall be encapsulatedsetIncludeUnsignedAttributes(boolean includeUnsignedAttributes) Sets whether the unsigned attributes should be included into the generated SignerInfoGeneratorsetOriginalCMS(CMS originalCMS) Sets original CMS, when availablesetTrustedCertificateSource(CertificateSource trustedCertificateSource) Sets trusted certificate source
-
Field Details
-
documentToSign
The document to be signed by the CAdES signature -
signatureParameters
Signature parameters used on the signature creation -
contentSigner
protected final org.bouncycastle.operator.ContentSigner contentSignerContent signer used for the signature creation
-
-
Constructor Details
-
CMSForCAdESBuilderHelper
public CMSForCAdESBuilderHelper(DSSDocument documentToSign, CAdESSignatureParameters signatureParameters, org.bouncycastle.operator.ContentSigner contentSigner) Default constructor- Parameters:
documentToSign-DSSDocumentsignatureParameters-CAdESSignatureParameterscontentSigner-CustomContentSigner
-
-
Method Details
-
setOriginalCMS
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
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
-
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
Gets an instance ofCAdESLevelBaselineBused for the signed and unsigned attributes table creation- Returns:
CAdESLevelBaselineB
-
initCAdESProfile
Instantiates a newCAdESLevelBaselineB- Returns:
CAdESLevelBaselineB
-
createCMSSignerInfoGeneratorBuilder
protected CMSSignerInfoGeneratorBuilder createCMSSignerInfoGeneratorBuilder(org.bouncycastle.asn1.cms.AttributeTable signedAttributes, org.bouncycastle.asn1.cms.AttributeTable unsignedAttributes) Creates and configures aCMSSignerInfoGeneratorBuilderto be used for a SignerInfo creation- Parameters:
signedAttributes-AttributeTablerepresenting the signed attributesunsignedAttributes-AttributeTablerepresenting the unsigned attributes- Returns:
CMSSignerInfoGeneratorBuilder
-
initCMSSignerInfoGeneratorBuilder
Creates a new instance ofCMSSignerInfoGeneratorBuilder- Returns:
CMSSignerInfoGeneratorBuilder
-
assertSignatureParametersValid
protected void assertSignatureParametersValid()Verifies validity of the signature parameters configuration -
initCMSBuilder
Instantiates aCMSBuilderfor 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
-