Class XAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
eu.europa.esig.dss.xades.signature.XAdESService
- All Implemented Interfaces:
DocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
,MultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
,Serializable
public class XAdESService extends AbstractSignatureService<XAdESSignatureParameters,XAdESTimestampParameters> implements MultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
XAdES implementation of DocumentSignatureService
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
Constructors Constructor Description XAdESService(CertificateVerifier certificateVerifier)
This is the constructor to create an instance of theXAdESService
. -
Method Summary
Modifier and Type Method Description DSSDocument
extendDocument(DSSDocument toExtendDocument, XAdESSignatureParameters parameters)
Extends the level of the signatures in thetoExtendDocument
TimestampToken
getContentTimestamp(DSSDocument toSignDocument, XAdESSignatureParameters parameters)
This method allows to compute a content-timestamp (which is added in the signed properties)TimestampToken
getContentTimestamp(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters)
Creates a content-timestamp attribute (to be include in the signed-data)ToBeSigned
getDataToSign(DSSDocument toSignDocument, XAdESSignatureParameters parameters)
Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
.ToBeSigned
getDataToSign(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters)
Retrieves the bytes of the data that need to be signed based on thetoSignDocuments
andparameters
.DSSDocument
signDocument(DSSDocument toSignDocument, XAdESSignatureParameters parameters, SignatureValue signatureValue)
Signs the toSignDocument with the provided signatureValue.DSSDocument
signDocument(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters, SignatureValue signatureValue)
Signs the toSignDocuments with the provided signatureValue.DSSDocument
timestamp(List<DSSDocument> toTimestampDocuments, XAdESTimestampParameters parameters)
Timestamps the toSignDocuments with the provided signatureValue.Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningDateInCertificateValidityRange, getFinalArchiveName, getFinalFileName, setTspSource, timestamp
-
Constructor Details
-
XAdESService
This is the constructor to create an instance of theXAdESService
. A certificate verifier must be provided.- Parameters:
certificateVerifier
-CertificateVerifier
provides information on the sources to be used in the validation process in the context of a signature.
-
-
Method Details
-
getContentTimestamp
public TimestampToken getContentTimestamp(DSSDocument toSignDocument, XAdESSignatureParameters parameters)Description copied from interface:DocumentSignatureService
This method allows to compute a content-timestamp (which is added in the signed properties)- Specified by:
getContentTimestamp
in interfaceDocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toSignDocument
- document to sign or the already existing signatureparameters
- set of the driving signing parameters- Returns:
- a timestamp token
-
getContentTimestamp
public TimestampToken getContentTimestamp(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters)Description copied from interface:MultipleDocumentsSignatureService
Creates a content-timestamp attribute (to be include in the signed-data)- Specified by:
getContentTimestamp
in interfaceMultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toSignDocuments
- list of documents to signparameters
- set of the driving signing parameters- Returns:
- a timestamp token
-
getDataToSign
public ToBeSigned getDataToSign(DSSDocument toSignDocument, XAdESSignatureParameters parameters) throws DSSExceptionDescription copied from interface:DocumentSignatureService
Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
. WhentoSignDocument
contains an already existing signature the returned bytes are related to a new parallel signature. - Enveloped signature (XML): a new signature is added and the signed data corresponds to that pointed by the first signature; - Enveloping signature: - - XML: The parallel signature is not possible - - CMS: A new parallel signature is added - Detached signature: - - XML: The parallel signature is added - - CMS: A new parallel signature is added- Specified by:
getDataToSign
in interfaceDocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toSignDocument
- document to sign or the already existing signatureparameters
- set of the driving signing parameters- Returns:
- the data to be signed
- Throws:
DSSException
-
getDataToSign
public ToBeSigned getDataToSign(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters) throws DSSExceptionDescription 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.- Specified by:
getDataToSign
in interfaceMultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toSignDocuments
- list of documents to signparameters
- set of the driving signing parameters- Returns:
- the data to be signed
- Throws:
DSSException
-
signDocument
public DSSDocument signDocument(DSSDocument toSignDocument, XAdESSignatureParameters parameters, SignatureValue signatureValue) throws DSSExceptionDescription copied from interface:DocumentSignatureService
Signs the toSignDocument with the provided signatureValue.- Specified by:
signDocument
in interfaceDocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toSignDocument
- document to signparameters
- set of the driving signing parameterssignatureValue
- the signature value to incorporate- Returns:
- the signed document (
toSignDocument
with the incorporated signature or the detached signature) - Throws:
DSSException
-
signDocument
public DSSDocument signDocument(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters, SignatureValue signatureValue) throws DSSExceptionDescription copied from interface:MultipleDocumentsSignatureService
Signs the toSignDocuments with the provided signatureValue.- Specified by:
signDocument
in interfaceMultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- 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
- Throws:
DSSException
-
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, XAdESSignatureParameters parameters) throws DSSExceptionDescription copied from interface:MultipleDocumentsSignatureService
Extends the level of the signatures in thetoExtendDocument
- Specified by:
extendDocument
in interfaceDocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Specified by:
extendDocument
in interfaceMultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toExtendDocument
- document to extendparameters
- set of the driving signing parameters- Returns:
- the extended signature
- Throws:
DSSException
-
timestamp
public DSSDocument timestamp(List<DSSDocument> toTimestampDocuments, XAdESTimestampParameters parameters)Description copied from interface:MultipleDocumentsSignatureService
Timestamps the toSignDocuments with the provided signatureValue.- Specified by:
timestamp
in interfaceMultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
- Parameters:
toTimestampDocuments
- list of documents to timestampparameters
- set of the driving timestamping parameters- Returns:
- the container with the added timestamp token
-