Class ASiCWithXAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<ASiCWithXAdESSignatureParameters,XAdESTimestampParameters>
eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService<ASiCWithXAdESSignatureParameters,XAdESTimestampParameters,XAdESCounterSignatureParameters,XAdESEvidenceRecordIncorporationParameters>
eu.europa.esig.dss.asic.xades.signature.ASiCWithXAdESService
- All Implemented Interfaces:
EvidenceRecordIncorporationService<XAdESEvidenceRecordIncorporationParameters>
,CounterSignatureService<XAdESCounterSignatureParameters>
,DocumentSignatureService<ASiCWithXAdESSignatureParameters,
,XAdESTimestampParameters> MultipleDocumentsSignatureService<ASiCWithXAdESSignatureParameters,
,XAdESTimestampParameters> Serializable
public class ASiCWithXAdESService
extends AbstractASiCSignatureService<ASiCWithXAdESSignatureParameters,XAdESTimestampParameters,XAdESCounterSignatureParameters,XAdESEvidenceRecordIncorporationParameters>
The service containing the main methods for ASiC with XAdES signature creation/extension
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
ConstructorsConstructorDescriptionASiCWithXAdESService
(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 theevidenceRecordDocument
applied to thedocuments
.addSignatureEvidenceRecord
(DSSDocument asicContainer, DSSDocument evidenceRecordDocument, XAdESEvidenceRecordIncorporationParameters 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 XAdES SignaturecounterSignSignature
(DSSDocument asicContainer, XAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Counter-signs thesignatureDocument
with the provided signatureValue.extendDocument
(DSSDocument toExtendDocument, ASiCWithXAdESSignatureParameters parameters) Extends the level of the signatures in thetoExtendDocument
protected DefaultASiCContainerExtractor
getArchiveExtractor
(DSSDocument archive) Returns a relevant ASiC container extractor for the given formatgetContentTimestamp
(List<DSSDocument> toSignDocuments, ASiCWithXAdESSignatureParameters parameters) Creates a content-timestamp attribute (to be include in the signed-data)getDataToBeCounterSigned
(DSSDocument asicContainer, XAdESCounterSignatureParameters parameters) Retrieves the bytes of the data that need to be counter-signed fromsignatureDocument
.getDataToSign
(List<DSSDocument> toSignDocuments, ASiCWithXAdESSignatureParameters parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocuments
andparameters
.protected List
<DSSDocument> getDetachedContents
(ASiCContent asicContent, boolean isOpenDocument) This method returns a detached contents to be used for a signature validationprotected XAdESService
Returns theXAdESService
to be used for signingvoid
setAsicFilenameFactory
(ASiCWithXAdESFilenameFactory asicFilenameFactory) SetsASiCWithXAdESFilenameFactory
defining a set of rules for naming of newly create ZIP entries, such as signature files.signDocument
(List<DSSDocument> toSignDocuments, ASiCWithXAdESSignatureParameters parameters, SignatureValue signatureValue) Signs the toSignDocuments with the provided signatureValue.timestamp
(List<DSSDocument> toTimestampDocuments, XAdESTimestampParameters parameters) Timestamps the toSignDocuments with the provided signatureValue.Methods inherited from class eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService
addContainerEvidenceRecord, assertAddSignaturePolicyStorePossible, assertCounterSignatureParametersValid, assertSignaturePossible, buildASiCContainer, buildASiCContainer, extractCurrentArchive, getContentTimestamp, getDataToSign, getFinalArchiveName, signDocument, timestamp
Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningCertificateValid, ensureSignatureValue, getFinalDocumentName, getFinalDocumentName, getFinalFileName, getFinalFileName, getFinalFileName, isValidSignatureValue, setTspSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.europa.esig.dss.signature.CounterSignatureService
setTspSource
Methods inherited from interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService
isValidSignatureValue
-
Constructor Details
-
ASiCWithXAdESService
The default constructor to instantiate the service- Parameters:
certificateVerifier
-CertificateVerifier
to use
-
-
Method Details
-
setAsicFilenameFactory
SetsASiCWithXAdESFilenameFactory
defining a set of rules for naming of newly create ZIP entries, such as signature files.- Parameters:
asicFilenameFactory
-ASiCWithXAdESFilenameFactory
-
getContentTimestamp
public TimestampToken getContentTimestamp(List<DSSDocument> toSignDocuments, ASiCWithXAdESSignatureParameters parameters) Description copied from interface:MultipleDocumentsSignatureService
Creates 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, ASiCWithXAdESSignatureParameters parameters) Description copied from interface:MultipleDocumentsSignatureService
Retrieves the bytes of the data that need to be signed based on thetoSignDocuments
andparameters
. WhentoSignDocuments
contains 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, ASiCWithXAdESSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:MultipleDocumentsSignatureService
Signs 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, XAdESTimestampParameters parameters) Description copied from interface:MultipleDocumentsSignatureService
Timestamps 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, ASiCWithXAdESSignatureParameters parameters) Description copied from interface:MultipleDocumentsSignatureService
Extends the level of the signatures in thetoExtendDocument
- Parameters:
toExtendDocument
- document to extendparameters
- set of the driving signing parameters- Returns:
- the extended signature
-
getDetachedContents
This method returns a detached contents to be used for a signature validation- Parameters:
asicContent
-ASiCContent
representing the extracted ASiC containerisOpenDocument
- defining whether the current container represents an OpenDocument- Returns:
- a list of
DSSDocument
s
-
getXAdESService
Returns theXAdESService
to be used for signing- Returns:
XAdESService
-
getArchiveExtractor
Description copied from class:AbstractASiCSignatureService
Returns a relevant ASiC container extractor for the given format- Specified by:
getArchiveExtractor
in classAbstractASiCSignatureService<ASiCWithXAdESSignatureParameters,
XAdESTimestampParameters, XAdESCounterSignatureParameters, XAdESEvidenceRecordIncorporationParameters> - Parameters:
archive
-DSSDocument
to get an extractor for- Returns:
- an instance of
DefaultASiCContainerExtractor
-
addSignaturePolicyStore
public DSSDocument addSignaturePolicyStore(DSSDocument asicContainer, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the ASiC with XAdES Signature- Parameters:
asicContainer
-DSSDocument
containing a XAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore
-SignaturePolicyStore
to add- Returns:
DSSDocument
ASiC with XAdES container with an incorporated SignaturePolicyStore
-
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument asicContainer, XAdESCounterSignatureParameters parameters) Description copied from interface:CounterSignatureService
Retrieves the bytes of the data that need to be counter-signed fromsignatureDocument
.signatureDocument
shall be a valid signature of the same type- Parameters:
asicContainer
-DSSDocument
representing the original signature to be counter-signedparameters
- set of the driving signing parameters for a counter-signature- Returns:
ToBeSigned
to be counter-signed byte array (signature value retrieved from thesignatureDocument
)
-
counterSignSignature
public DSSDocument counterSignSignature(DSSDocument asicContainer, XAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:CounterSignatureService
Counter-signs thesignatureDocument
with the provided signatureValue.- Parameters:
asicContainer
-DSSDocument
to be counter-signedparameters
- set of the driving signing parameters for a counter-signaturesignatureValue
-SignatureValue
the signature value to incorporate- Returns:
DSSDocument
the signature document enveloping a newly created counter-signature
-
addSignatureEvidenceRecord
public DSSDocument addSignatureEvidenceRecord(DSSDocument asicContainer, DSSDocument evidenceRecordDocument, XAdESEvidenceRecordIncorporationParameters parameters) Description copied from interface:EvidenceRecordIncorporationService
Incorporates the Evidence Record as an unsigned property into the signature- Parameters:
asicContainer
-DSSDocument
containing the signature to add the evidence record intoevidenceRecordDocument
-DSSDocument
to addparameters
-SerializableEvidenceRecordIncorporationParameters
providing configuration for the evidence record incorporation- Returns:
DSSDocument
signature document with an incorporated evidence record
-
addContainerEvidenceRecord
public DSSDocument addContainerEvidenceRecord(List<DSSDocument> documents, DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters) Description copied from class:AbstractASiCSignatureService
Creates a new ASiC container with theevidenceRecordDocument
applied to thedocuments
.If the provided original document is an existing ASiC container, then the
evidenceRecordDocument
will be evaluated against the container files and places within the container.- Specified by:
addContainerEvidenceRecord
in classAbstractASiCSignatureService<ASiCWithXAdESSignatureParameters,
XAdESTimestampParameters, XAdESCounterSignatureParameters, XAdESEvidenceRecordIncorporationParameters> - Parameters:
documents
- a list ofDSSDocument
s preserved by an evidence recordevidenceRecordDocument
-DSSDocument
to addparameters
-ASiCContainerEvidenceRecordParameters
providing configuration for the evidence record incorporation- Returns:
DSSDocument
ASiC container containing the evidence record file document
-