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
ConstructorsConstructorDescriptionXAdESService(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 thesignatureDocumentwith the provided signatureValue.extendDocument(DSSDocument toExtendDocument, XAdESSignatureParameters parameters) Extends the level of the signatures in thetoExtendDocumentgetContentTimestamp(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 thetoSignDocumentandparameters.getDataToSign(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocumentsandparameters.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, timestampMethods 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.MultipleDocumentsSignatureService
isValidSignatureValue
-
Constructor Details
-
XAdESService
This is the constructor to create an instance of theXAdESService. A certificate verifier must be provided.- Parameters:
certificateVerifier-CertificateVerifierprovides 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:DocumentSignatureServiceThis method allows to compute a content-timestamp (which is added in the signed properties)- Specified by:
getContentTimestampin 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:MultipleDocumentsSignatureServiceCreates a content-timestamp attribute (to be include in the signed-data)- Specified by:
getContentTimestampin 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:DocumentSignatureServiceRetrieves the bytes of the data that need to be signed based on thetoSignDocumentandparameters. WhentoSignDocumentcontains 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:
getDataToSignin 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: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.- Specified by:
getDataToSignin 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:DocumentSignatureServiceSigns the toSignDocument with the provided signatureValue.- Specified by:
signDocumentin interfaceDocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters> - Parameters:
toSignDocument- document to signparameters- set of the driving signing parameterssignatureValue- the signature value to incorporate- Returns:
- the signed document (
toSignDocumentwith the incorporated signature or the detached signature)
-
signDocument
public DSSDocument signDocument(List<DSSDocument> toSignDocuments, XAdESSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:MultipleDocumentsSignatureServiceSigns the toSignDocuments with the provided signatureValue.- Specified by:
signDocumentin 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:MultipleDocumentsSignatureServiceExtends the level of the signatures in thetoExtendDocument- Specified by:
extendDocumentin interfaceDocumentSignatureService<XAdESSignatureParameters,XAdESTimestampParameters> - Specified by:
extendDocumentin 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:MultipleDocumentsSignatureServiceTimestamps the toSignDocuments with the provided signatureValue.- Specified by:
timestampin 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-DSSDocumentcontaining a XAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore-SignaturePolicyStoreto add- Returns:
DSSDocumentXAdESSignature with an incorporated SignaturePolicyStore
-
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument signatureDocument, XAdESCounterSignatureParameters 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- Specified by:
getDataToBeCounterSignedin interfaceCounterSignatureService<XAdESCounterSignatureParameters>- Parameters:
signatureDocument-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 signatureDocument, XAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:CounterSignatureServiceCounter signs thesignatureDocumentwith the provided signatureValue.- Specified by:
counterSignSignaturein interfaceCounterSignatureService<XAdESCounterSignatureParameters>- Parameters:
signatureDocument-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
-