Class CAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<CAdESSignatureParameters,CAdESTimestampParameters>
eu.europa.esig.dss.cades.signature.CAdESService
- All Implemented Interfaces:
CounterSignatureService<CAdESCounterSignatureParameters>
,DocumentSignatureService<CAdESSignatureParameters,
,CAdESTimestampParameters> Serializable
public class CAdESService
extends AbstractSignatureService<CAdESSignatureParameters,CAdESTimestampParameters>
implements CounterSignatureService<CAdESCounterSignatureParameters>
CAdES implementation of DocumentSignatureService
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
ConstructorDescriptionCAdESService
(CertificateVerifier certificateVerifier) This is the constructor to create an instance of theCAdESService
. -
Method Summary
Modifier and TypeMethodDescriptionaddSignaturePolicyStore
(DSSDocument document, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the CAdES SignaturecounterSignSignature
(DSSDocument signatureDocument, CAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Counter-signs thesignatureDocument
with the provided signatureValue.extendDocument
(DSSDocument toExtendDocument, CAdESSignatureParameters parameters) Extends the level of the signatures in thetoExtendDocument
getContentTimestamp
(DSSDocument toSignDocument, CAdESSignatureParameters parameters) This method allows to compute a content-timestamp (which is added in the signed properties)getDataToBeCounterSigned
(DSSDocument signatureDocument, CAdESCounterSignatureParameters parameters) Retrieves the bytes of the data that need to be counter-signed fromsignatureDocument
.getDataToBeCounterSigned
(DSSDocument signatureDocument, org.bouncycastle.cms.SignerInformation signerInfoToCounterSign, CAdESSignatureParameters parameters) Returns a data toBeSigned for a counter signature on the givensignerInfoToCounterSign
getDataToSign
(DSSDocument toSignDocument, CAdESSignatureParameters parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
.signDocument
(DSSDocument toSignDocument, CAdESSignatureParameters parameters, SignatureValue signatureValue) Signs the toSignDocument with the provided signatureValue.Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningCertificateValid, ensureSignatureValue, getFinalDocumentName, getFinalDocumentName, getFinalFileName, getFinalFileName, getFinalFileName, isValidSignatureValue, setTspSource, timestamp
-
Constructor Details
-
CAdESService
This is the constructor to create an instance of theCAdESService
. 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, CAdESSignatureParameters 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<CAdESSignatureParameters,
CAdESTimestampParameters> - Parameters:
toSignDocument
- document to sign or the already existing signatureparameters
- 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<CAdESSignatureParameters,
CAdESTimestampParameters> - Parameters:
toSignDocument
- document to sign or the already existing signatureparameters
- set of the driving signing parameters- Returns:
- the data to be signed
-
signDocument
public DSSDocument signDocument(DSSDocument toSignDocument, CAdESSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:DocumentSignatureService
Signs the toSignDocument with the provided signatureValue.- Specified by:
signDocument
in interfaceDocumentSignatureService<CAdESSignatureParameters,
CAdESTimestampParameters> - 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)
-
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, CAdESSignatureParameters parameters) Description copied from interface:DocumentSignatureService
Extends the level of the signatures in thetoExtendDocument
- Specified by:
extendDocument
in interfaceDocumentSignatureService<CAdESSignatureParameters,
CAdESTimestampParameters> - Parameters:
toExtendDocument
- document to extendparameters
- set of the driving signing parameters- Returns:
- the extended signature
-
addSignaturePolicyStore
public DSSDocument addSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore) Incorporates a Signature Policy Store as an unsigned property into the CAdES Signature- Parameters:
document
-DSSDocument
containing a CAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore
-SignaturePolicyStore
to add- Returns:
DSSDocument
CAdESSignature with an incorporated SignaturePolicyStore
-
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument signatureDocument, CAdESCounterSignatureParameters 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<CAdESCounterSignatureParameters>
- 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
)
-
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument signatureDocument, org.bouncycastle.cms.SignerInformation signerInfoToCounterSign, CAdESSignatureParameters parameters) Returns a data toBeSigned for a counter signature on the givensignerInfoToCounterSign
- Parameters:
signatureDocument
-DSSDocument
containing a signature to be counter signedsignerInfoToCounterSign
-SignerInformation
to counter signparameters
-CAdESSignatureParameters
- Returns:
ToBeSigned
-
counterSignSignature
public DSSDocument counterSignSignature(DSSDocument signatureDocument, CAdESCounterSignatureParameters parameters, SignatureValue signatureValue) Description copied from interface:CounterSignatureService
Counter-signs thesignatureDocument
with the provided signatureValue.- Specified by:
counterSignSignature
in interfaceCounterSignatureService<CAdESCounterSignatureParameters>
- 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
-