Class ASiCWithCAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters>
eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters,CAdESEvidenceRecordIncorporationParameters>
eu.europa.esig.dss.asic.cades.signature.ASiCWithCAdESService
- All Implemented Interfaces:
EvidenceRecordIncorporationService<CAdESEvidenceRecordIncorporationParameters>,CounterSignatureService<CAdESCounterSignatureParameters>,DocumentSignatureService<ASiCWithCAdESSignatureParameters,,ASiCWithCAdESTimestampParameters> MultipleDocumentsSignatureService<ASiCWithCAdESSignatureParameters,,ASiCWithCAdESTimestampParameters> Serializable
public class ASiCWithCAdESService
extends AbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters,CAdESEvidenceRecordIncorporationParameters>
The service containing the main methods for ASiC with CAdES signature creation/extension
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DSSResourcesHandlerBuilderThis object is used to create data container objects such as an OutputStream or a DSSDocumentFields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource -
Constructor Summary
ConstructorsConstructorDescriptionASiCWithCAdESService(CertificateVerifier certificateVerifier) The default constructor to instantiate the service -
Method Summary
Modifier and TypeMethodDescriptionaddContainerEvidenceRecord(List<DSSDocument> documents, DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters) Creates a new ASiC container with theevidenceRecordDocumentapplied to thedocuments.addSignatureEvidenceRecord(DSSDocument asicContainer, DSSDocument evidenceRecordDocument, CAdESEvidenceRecordIncorporationParameters parameters) Incorporates the Evidence Record as an unsigned property into the signatureaddSignaturePolicyStore(DSSDocument asicContainer, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the ASiC with CAdES Signatureprotected voidassertAddSignaturePolicyStorePossible(ASiCContent asicContent) Verifies if incorporation of a SignaturePolicyStore is possibleprotected voidVerifies a validity of counter signature parameterscounterSignSignature(DSSDocument asicContainer, CAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Counter-signs thesignatureDocumentwith the provided signatureValue.extendDocument(DSSDocument toExtendDocument, ASiCWithCAdESSignatureParameters parameters) Extends the level of the signatures in thetoExtendDocumentprotected DefaultASiCContainerExtractorgetArchiveExtractor(DSSDocument archive) Returns a relevant ASiC container extractor for the given formatprotected CAdESCounterSignatureBuilderCreates a new instance ofCAdESCounterSignatureBuilderprotected CAdESSignatureParametersgetCAdESParameters(ASiCWithCAdESSignatureParameters parameters) ReturnsCAdESSignatureParametersfrom the givenASiCWithCAdESSignatureParametersprotected CAdESSignatureParametersgetCAdESParameters(ASiCWithCAdESSignatureParameters parameters, GetDataToSignASiCWithCAdESHelper dataToSignHelper) ReturnsCAdESSignatureParametersfrom the givenASiCWithCAdESSignatureParametersandGetDataToSignASiCWithCAdESHelperprotected CAdESServiceReturns theCAdESServiceto be used for signature/timestamp creationgetContentTimestamp(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters) Creates a content-timestamp attribute (to be include in the signed-data)getDataToBeCounterSigned(DSSDocument asicContainer, CAdESCounterSignatureParameters parameters) Retrieves the bytes of the data that need to be counter-signed fromsignatureDocument.getDataToSign(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocumentsandparameters.protected ASiCWithCAdESSignatureExtensiongetExtensionProfile(SignatureLevel signatureLevel, ASiCContainerType containerType) Returns the extension profile to be used for the current signatureprotected ASiCWithCAdESLevelBaselineLTAGets an extension profile for an LTA-level signature augmentationvoidsetAsicFilenameFactory(ASiCWithCAdESFilenameFactory asicFilenameFactory) SetsASiCWithCAdESFilenameFactorydefining a set of rules for naming of newly create ZIP entries, such as signature files.voidsetResourcesHandlerBuilder(DSSResourcesHandlerBuilder resourcesHandlerBuilder) This method sets aDSSResourcesHandlerBuilderto be used for operating with internal objects during the signature creation procedure.signDocument(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters, SignatureValue signatureValue) Signs the toSignDocuments with the provided signatureValue.timestamp(List<DSSDocument> toTimestampDocuments, ASiCWithCAdESTimestampParameters parameters) Timestamps the toSignDocuments with the provided signatureValue.Methods inherited from class eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService
addContainerEvidenceRecord, assertSignaturePossible, buildASiCContainer, buildASiCContainer, extractCurrentArchive, getContentTimestamp, getDataToSign, getFinalArchiveName, signDocument, timestampMethods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningCertificateValid, ensureSignatureValue, getFinalDocumentName, getFinalDocumentName, getFinalFileName, getFinalFileName, getFinalFileName, isValidSignatureValue, setTspSourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.europa.esig.dss.signature.CounterSignatureService
setTspSourceMethods inherited from interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService
isValidSignatureValue
-
Field Details
-
resourcesHandlerBuilder
This object is used to create data container objects such as an OutputStream or a DSSDocument
-
-
Constructor Details
-
ASiCWithCAdESService
The default constructor to instantiate the service- Parameters:
certificateVerifier-CertificateVerifierto use
-
-
Method Details
-
setResourcesHandlerBuilder
This method sets aDSSResourcesHandlerBuilderto be used for operating with internal objects during the signature creation procedure. NOTE: TheDSSResourcesHandlerBuilderis supported only within the 'dss-cms-stream' module!- Parameters:
resourcesHandlerBuilder-DSSResourcesHandlerBuilder
-
setAsicFilenameFactory
SetsASiCWithCAdESFilenameFactorydefining a set of rules for naming of newly create ZIP entries, such as signature files.- Parameters:
asicFilenameFactory-ASiCWithCAdESFilenameFactory
-
getContentTimestamp
public TimestampToken getContentTimestamp(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters) Description copied from interface:MultipleDocumentsSignatureServiceCreates a content-timestamp attribute (to be include in the signed-data)- Parameters:
toSignDocuments- list of documents to signparameters- set of the driving signing parameters- Returns:
- a timestamp token
-
getDataToSign
public ToBeSigned getDataToSign(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters) Description copied from interface:MultipleDocumentsSignatureServiceRetrieves the bytes of the data that need to be signed based on thetoSignDocumentsandparameters. WhentoSignDocumentscontains an already existing signature the returned bytes are related to a new parallel signature.- Parameters:
toSignDocuments- list of documents to signparameters- set of the driving signing parameters- Returns:
- the data to be signed
-
signDocument
public DSSDocument signDocument(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:MultipleDocumentsSignatureServiceSigns the toSignDocuments with the provided signatureValue.- Parameters:
toSignDocuments- list of documents to signparameters- set of the driving signing parameterssignatureValue- the signature value to incorporate- Returns:
- the container with the signature and the documents (ASiC) or the signature file
-
timestamp
public DSSDocument timestamp(List<DSSDocument> toTimestampDocuments, ASiCWithCAdESTimestampParameters parameters) Description copied from interface:MultipleDocumentsSignatureServiceTimestamps the toSignDocuments with the provided signatureValue.- Parameters:
toTimestampDocuments- list of documents to timestampparameters- set of the driving timestamping parameters- Returns:
- the container with the added timestamp token
-
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, ASiCWithCAdESSignatureParameters parameters) Description copied from interface:MultipleDocumentsSignatureServiceExtends the level of the signatures in thetoExtendDocument- Parameters:
toExtendDocument- document to extendparameters- set of the driving signing parameters- Returns:
- the extended signature
-
getArchiveExtractor
Description copied from class:AbstractASiCSignatureServiceReturns a relevant ASiC container extractor for the given format- Specified by:
getArchiveExtractorin classAbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters, CAdESCounterSignatureParameters, CAdESEvidenceRecordIncorporationParameters> - Parameters:
archive-DSSDocumentto get an extractor for- Returns:
- an instance of
DefaultASiCContainerExtractor
-
getCAdESService
Returns theCAdESServiceto be used for signature/timestamp creation- Returns:
CAdESService
-
getCAdESParameters
ReturnsCAdESSignatureParametersfrom the givenASiCWithCAdESSignatureParameters- Parameters:
parameters-ASiCWithCAdESSignatureParameters- Returns:
CAdESSignatureParameters
-
getCAdESParameters
protected CAdESSignatureParameters getCAdESParameters(ASiCWithCAdESSignatureParameters parameters, GetDataToSignASiCWithCAdESHelper dataToSignHelper) ReturnsCAdESSignatureParametersfrom the givenASiCWithCAdESSignatureParametersandGetDataToSignASiCWithCAdESHelper- Parameters:
parameters-ASiCWithCAdESSignatureParametersdataToSignHelper-GetDataToSignASiCWithCAdESHelper- Returns:
CAdESSignatureParameters
-
addSignaturePolicyStore
public DSSDocument addSignaturePolicyStore(DSSDocument asicContainer, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the ASiC with CAdES Signature- Parameters:
asicContainer-DSSDocumentcontaining a CAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore-SignaturePolicyStoreto add- Returns:
DSSDocumentASiC with CAdES container with an incorporated SignaturePolicyStore
-
assertAddSignaturePolicyStorePossible
Description copied from class:AbstractASiCSignatureServiceVerifies if incorporation of a SignaturePolicyStore is possible -
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument asicContainer, CAdESCounterSignatureParameters parameters) Description copied from interface:CounterSignatureServiceRetrieves the bytes of the data that need to be counter-signed fromsignatureDocument.signatureDocumentshall be a valid signature of the same type- Parameters:
asicContainer-DSSDocumentrepresenting the original signature to be counter-signedparameters- set of the driving signing parameters for a counter-signature- Returns:
ToBeSignedto be counter-signed byte array (signature value retrieved from thesignatureDocument)
-
counterSignSignature
public DSSDocument counterSignSignature(DSSDocument asicContainer, CAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:CounterSignatureServiceCounter-signs thesignatureDocumentwith the provided signatureValue.- Parameters:
asicContainer-DSSDocumentto be counter-signedparameters- set of the driving signing parameters for a counter-signaturesignatureValue-SignatureValuethe signature value to incorporate- Returns:
DSSDocumentthe signature document enveloping a newly created counter-signature
-
addSignatureEvidenceRecord
public DSSDocument addSignatureEvidenceRecord(DSSDocument asicContainer, DSSDocument evidenceRecordDocument, CAdESEvidenceRecordIncorporationParameters parameters) Description copied from interface:EvidenceRecordIncorporationServiceIncorporates the Evidence Record as an unsigned property into the signature- Parameters:
asicContainer-DSSDocumentcontaining the signature to add the evidence record intoevidenceRecordDocument-DSSDocumentto addparameters-SerializableEvidenceRecordIncorporationParametersproviding configuration for the evidence record incorporation- Returns:
DSSDocumentsignature document with an incorporated evidence record
-
addContainerEvidenceRecord
public DSSDocument addContainerEvidenceRecord(List<DSSDocument> documents, DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters) Description copied from class:AbstractASiCSignatureServiceCreates a new ASiC container with theevidenceRecordDocumentapplied to thedocuments.If the provided original document is an existing ASiC container, then the
evidenceRecordDocumentwill be evaluated against the container files and places within the container.- Specified by:
addContainerEvidenceRecordin classAbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters, CAdESCounterSignatureParameters, CAdESEvidenceRecordIncorporationParameters> - Parameters:
documents- a list ofDSSDocuments preserved by an evidence recordevidenceRecordDocument-DSSDocumentto addparameters-ASiCContainerEvidenceRecordParametersproviding configuration for the evidence record incorporation- Returns:
DSSDocumentASiC container containing the evidence record file document
-
getExtensionProfile
protected ASiCWithCAdESSignatureExtension getExtensionProfile(SignatureLevel signatureLevel, ASiCContainerType containerType) Returns the extension profile to be used for the current signature- Parameters:
signatureLevel-SignatureLevelcontainerType-ASiCContainerType- Returns:
ASiCWithCAdESSignatureExtensionrelated to the pre-defined profile
-
getLTALevelExtensionProfile
Gets an extension profile for an LTA-level signature augmentation- Returns:
ASiCWithCAdESLevelBaselineLTA
-
getCAdESCounterSignatureBuilder
Creates a new instance ofCAdESCounterSignatureBuilder- Returns:
CAdESCounterSignatureBuilder
-
assertCounterSignatureParametersValid
Description copied from class:AbstractASiCSignatureServiceVerifies a validity of counter signature parameters- Overrides:
assertCounterSignatureParametersValidin classAbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters, CAdESCounterSignatureParameters, CAdESEvidenceRecordIncorporationParameters> - Parameters:
parameters- counter signature parameters to verify
-