Class JAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>
eu.europa.esig.dss.jades.signature.JAdESService
- All Implemented Interfaces:
CounterSignatureService<JAdESCounterSignatureParameters>,DocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>,MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>,Serializable
public class JAdESService extends AbstractSignatureService<JAdESSignatureParameters,JAdESTimestampParameters> implements MultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>, CounterSignatureService<JAdESCounterSignatureParameters>
Contains methods for JAdES signature creation/extension
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource -
Constructor Summary
Constructors Constructor Description JAdESService(CertificateVerifier certificateVerifier)This is the constructor to create an instance of theJAdESService. -
Method Summary
Modifier and Type Method Description DSSDocumentaddSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore)Incorporates a Signature Policy Store as a base64Url-encoded unsigned property into the JAdES SignatureDSSDocumentaddSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance)Incorporates a Signature Policy Store as an unsigned property into the JAdES SignatureDSSDocumentcounterSignSignature(DSSDocument signatureDocument, JAdESCounterSignatureParameters parameters, SignatureValue signatureValue)Counter signs thesignatureDocumentwith the provided signatureValue.DSSDocumentextendDocument(DSSDocument toExtendDocument, JAdESSignatureParameters parameters)Extends the level of the signatures in thetoExtendDocumentTimestampTokengetContentTimestamp(DSSDocument toSignDocument, JAdESSignatureParameters parameters)This method allows to compute a content-timestamp (which is added in the signed properties)TimestampTokengetContentTimestamp(List<DSSDocument> toSignDocuments, JAdESSignatureParameters parameters)This methods allows to create a TimestampToken for a detached JAdES (with a 'sigD' parameter).ToBeSignedgetDataToBeCounterSigned(DSSDocument signatureDocument, JAdESCounterSignatureParameters parameters)Retrieves the bytes of the data that need to be counter signed fromsignatureDocument.ToBeSignedgetDataToSign(DSSDocument toSignDocument, JAdESSignatureParameters parameters)Retrieves the bytes of the data that need to be signed based on thetoSignDocumentandparameters.ToBeSignedgetDataToSign(List<DSSDocument> toSignDocuments, JAdESSignatureParameters parameters)Retrieves the bytes of the data that need to be signed based on thetoSignDocumentsandparameters.protected JAdESBuildergetJAdESBuilder(JAdESSignatureParameters parameters, List<DSSDocument> documentsToSign)Returns the JAdESBuilder to be usedDSSDocumentsignDocument(DSSDocument toSignDocument, JAdESSignatureParameters parameters, SignatureValue signatureValue)Signs the toSignDocument with the provided signatureValue.DSSDocumentsignDocument(List<DSSDocument> toSignDocuments, JAdESSignatureParameters parameters, SignatureValue signatureValue)Signs the toSignDocuments with the provided signatureValue.DSSDocumenttimestamp(List<DSSDocument> toTimestampDocuments, JAdESTimestampParameters parameters)Timestamps the toSignDocuments with the provided signatureValue.Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningDateInCertificateValidityRange, getFinalDocumentName, 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
-
JAdESService
This is the constructor to create an instance of theJAdESService. 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, JAdESSignatureParameters parameters)Description copied from interface:DocumentSignatureServiceThis method allows to compute a content-timestamp (which is added in the signed properties)- Specified by:
getContentTimestampin interfaceDocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- 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, JAdESSignatureParameters parameters)This methods allows to create a TimestampToken for a detached JAdES (with a 'sigD' parameter). NOTE: The toSignDocuments must be present in the same order they will be passed to signature computation process- Specified by:
getContentTimestampin interfaceMultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- Parameters:
toSignDocuments- a list ofDSSDocuments to be timestampedparameters-JAdESSignatureParameters- Returns:
- content
TimestampToken
-
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<JAdESSignatureParameters,JAdESTimestampParameters>- 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, JAdESSignatureParameters 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<JAdESSignatureParameters,JAdESTimestampParameters>- 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, JAdESSignatureParameters parameters, SignatureValue signatureValue)Description copied from interface:DocumentSignatureServiceSigns the toSignDocument with the provided signatureValue.- Specified by:
signDocumentin interfaceDocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- 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, JAdESSignatureParameters parameters, SignatureValue signatureValue)Description copied from interface:MultipleDocumentsSignatureServiceSigns the toSignDocuments with the provided signatureValue.- Specified by:
signDocumentin interfaceMultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- 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
-
getJAdESBuilder
protected JAdESBuilder getJAdESBuilder(JAdESSignatureParameters parameters, List<DSSDocument> documentsToSign)Returns the JAdESBuilder to be used- Parameters:
parameters-JAdESSignatureParametersdocumentsToSign- a list ofDSSDocuments- Returns:
JAdESBuilder
-
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, JAdESSignatureParameters parameters)Description copied from interface:MultipleDocumentsSignatureServiceExtends the level of the signatures in thetoExtendDocument- Specified by:
extendDocumentin interfaceDocumentSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- Specified by:
extendDocumentin interfaceMultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- Parameters:
toExtendDocument- document to extendparameters- set of the driving signing parameters- Returns:
- the extended signature
-
timestamp
public DSSDocument timestamp(List<DSSDocument> toTimestampDocuments, JAdESTimestampParameters parameters)Description copied from interface:MultipleDocumentsSignatureServiceTimestamps the toSignDocuments with the provided signatureValue.- Specified by:
timestampin interfaceMultipleDocumentsSignatureService<JAdESSignatureParameters,JAdESTimestampParameters>- 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 a base64Url-encoded unsigned property into the JAdES Signature- Parameters:
document-DSSDocumentcontaining a JAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore-SignaturePolicyStoreto add- Returns:
DSSDocumentJAdESSignature with an incorporates SignaturePolicyStore
-
addSignaturePolicyStore
public DSSDocument addSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance)Incorporates a Signature Policy Store as an unsigned property into the JAdES Signature- Parameters:
document-DSSDocumentcontaining a JAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore-SignaturePolicyStoreto addbase64UrlInstance- defines if the SignaturePolicyStore shall be incorporated in its corresponding base64Url representation, otherwise if FALSE incorporates in the clear JSON representation- Returns:
DSSDocumentJAdESSignature with an incorporates SignaturePolicyStore
-
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument signatureDocument, JAdESCounterSignatureParameters 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<JAdESCounterSignatureParameters>- 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, JAdESCounterSignatureParameters parameters, SignatureValue signatureValue)Description copied from interface:CounterSignatureServiceCounter signs thesignatureDocumentwith the provided signatureValue.- Specified by:
counterSignSignaturein interfaceCounterSignatureService<JAdESCounterSignatureParameters>- 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
-