Class XAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
eu.europa.esig.dss.xades.signature.XAdESService
- All Implemented Interfaces:
CounterSignatureService<XAdESCounterSignatureParameters>
,DocumentSignatureService<XAdESSignatureParameters,
,XAdESTimestampParameters> MultipleDocumentsSignatureService<XAdESSignatureParameters,
,XAdESTimestampParameters> Serializable
public class XAdESService
extends AbstractSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>
implements MultipleDocumentsSignatureService<XAdESSignatureParameters,XAdESTimestampParameters>, CounterSignatureService<XAdESCounterSignatureParameters>
XAdES implementation of DocumentSignatureService
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
ConstructorDescriptionXAdESService
(CertificateVerifier certificateVerifier) This is the constructor to create an instance of theXAdESService
. -
Method Summary
Modifier and TypeMethodDescriptionaddSignaturePolicyStore
(DSSDocument document, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the XAdES SignaturecounterSignSignature
(DSSDocument signatureDocument, XAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Counter-signs thesignatureDocument
with the provided signatureValue.extendDocument
(DSSDocument toExtendDocument, XAdESSignatureParameters parameters) Extends the level of the signatures in thetoExtendDocument
getContentTimestamp
(DSSDocument toSignDocument, XAdESSignatureParameters parameters) This method allows to compute a content-timestamp (which is added in the signed properties)getContentTimestamp
(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters) Creates a content-timestamp attribute (to be include in the signed-data)getDataToBeCounterSigned
(DSSDocument signatureDocument, XAdESCounterSignatureParameters parameters) Retrieves the bytes of the data that need to be counter-signed fromsignatureDocument
.getDataToSign
(DSSDocument toSignDocument, XAdESSignatureParameters parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
.getDataToSign
(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocuments
andparameters
.signDocument
(DSSDocument toSignDocument, XAdESSignatureParameters parameters, SignatureValue signatureValue) Signs the toSignDocument with the provided signatureValue.signDocument
(List<DSSDocument> toSignDocuments, XAdESSignatureParameters 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.signature.AbstractSignatureService
assertSigningCertificateValid, ensureSignatureValue, getFinalDocumentName, getFinalDocumentName, getFinalFileName, getFinalFileName, getFinalFileName, isValidSignatureValue, setTspSource, timestamp
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
-
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
Description 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
-
getDataToSign
public ToBeSigned getDataToSign(List<DSSDocument> toSignDocuments, XAdESSignatureParameters 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.- 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
-
signDocument
public DSSDocument signDocument(DSSDocument toSignDocument, XAdESSignatureParameters parameters, SignatureValue signatureValue) Description 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)
-
signDocument
public DSSDocument signDocument(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters, SignatureValue signatureValue) Description 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
-
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, XAdESSignatureParameters parameters) Description copied from interface:DocumentSignatureService
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
-
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
-
addSignaturePolicyStore
public DSSDocument addSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the XAdES Signature- Parameters:
document
-DSSDocument
containing a XAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore
-SignaturePolicyStore
to add- Returns:
DSSDocument
XAdESSignature with an incorporated SignaturePolicyStore
-
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument signatureDocument, 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- Specified by:
getDataToBeCounterSigned
in interfaceCounterSignatureService<XAdESCounterSignatureParameters>
- Parameters:
signatureDocument
-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 signatureDocument, XAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:CounterSignatureService
Counter-signs thesignatureDocument
with the provided signatureValue.- Specified by:
counterSignSignature
in interfaceCounterSignatureService<XAdESCounterSignatureParameters>
- Parameters:
signatureDocument
-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
-