Class ASiCWithCAdESService
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<SP,TP>
eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters>
eu.europa.esig.dss.asic.cades.signature.ASiCWithCAdESService
- All Implemented Interfaces:
CounterSignatureService<CAdESCounterSignatureParameters>
,DocumentSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters>
,MultipleDocumentsSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters>
,Serializable
public class ASiCWithCAdESService extends AbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters>
The service containing the main methods for ASiC with CAdES signature creation/extension
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService
archiveContent
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
Constructors Constructor Description ASiCWithCAdESService(CertificateVerifier certificateVerifier)
The default constructor to instantiate the service -
Method Summary
Modifier and Type Method Description DSSDocument
addSignaturePolicyStore(DSSDocument asicContainer, SignaturePolicyStore signaturePolicyStore)
Incorporates a Signature Policy Store as an unsigned property into the ASiC with CAdES Signatureprotected void
assertAddSignaturePolicyStorePossible()
Verifies if incorporation of a SignaturePolicyStore is possibleprotected void
assertCounterSignatureParametersValid(CAdESCounterSignatureParameters parameters)
Verifies a validity of counter signature parametersDSSDocument
counterSignSignature(DSSDocument asicContainer, CAdESCounterSignatureParameters parameters, SignatureValue signatureValue)
Counter signs thesignatureDocument
with the provided signatureValue.DSSDocument
extendDocument(DSSDocument toExtendDocument, ASiCWithCAdESSignatureParameters parameters)
Extends the level of the signatures in thetoExtendDocument
protected AbstractASiCContainerExtractor
getArchiveExtractor(DSSDocument archive)
Returns a relevant ASiC container extractor for the given formatTimestampToken
getContentTimestamp(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters)
Creates a content-timestamp attribute (to be include in the signed-data)ToBeSigned
getDataToBeCounterSigned(DSSDocument asicContainer, CAdESCounterSignatureParameters parameters)
Retrieves the bytes of the data that need to be counter signed fromsignatureDocument
.ToBeSigned
getDataToSign(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters)
Retrieves the bytes of the data that need to be signed based on thetoSignDocuments
andparameters
.protected String
getExpectedSignatureExtension()
Returns the relevant signature document extension for the implemented formatDSSDocument
signDocument(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters, SignatureValue signatureValue)
Signs the toSignDocuments with the provided signatureValue.DSSDocument
timestamp(List<DSSDocument> toTimestampDocuments, ASiCWithCAdESTimestampParameters parameters)
Timestamps the toSignDocuments with the provided signatureValue.Methods inherited from class eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService
buildASiCContainer, extractCurrentArchive, getContentTimestamp, getDataToSign, getEmbeddedArchiveManifests, getEmbeddedManifests, getEmbeddedMimetype, getEmbeddedSignatures, getEmbeddedSignedDocuments, getEmbeddedTimestamps, getFinalArchiveName, mergeArchiveAndExtendedSignatures, signDocument, timestamp
Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningDateInCertificateValidityRange, getFinalDocumentName, getFinalFileName, getFinalFileName, isValidSignatureValue, setTspSource
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.MultipleDocumentsSignatureService
isValidSignatureValue
-
Constructor Details
-
ASiCWithCAdESService
The default constructor to instantiate the service- Parameters:
certificateVerifier
-CertificateVerifier
to use
-
-
Method Details
-
getContentTimestamp
public TimestampToken getContentTimestamp(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters)Description copied from interface:MultipleDocumentsSignatureService
Creates a content-timestamp attribute (to be include in the signed-data)- Parameters:
toSignDocuments
- list of documents to signparameters
- set of the driving signing parameters- Returns:
- a timestamp token
-
getDataToSign
public ToBeSigned getDataToSign(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters 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.- Parameters:
toSignDocuments
- list of documents to signparameters
- set of the driving signing parameters- Returns:
- the data to be signed
-
signDocument
public DSSDocument signDocument(List<DSSDocument> toSignDocuments, ASiCWithCAdESSignatureParameters parameters, SignatureValue signatureValue)Description copied from interface:MultipleDocumentsSignatureService
Signs the toSignDocuments with the provided signatureValue.- 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
-
timestamp
public DSSDocument timestamp(List<DSSDocument> toTimestampDocuments, ASiCWithCAdESTimestampParameters parameters)Description copied from interface:MultipleDocumentsSignatureService
Timestamps the toSignDocuments with the provided signatureValue.- Parameters:
toTimestampDocuments
- list of documents to timestampparameters
- set of the driving timestamping parameters- Returns:
- the container with the added timestamp token
-
extendDocument
public DSSDocument extendDocument(DSSDocument toExtendDocument, ASiCWithCAdESSignatureParameters parameters)Description copied from interface:MultipleDocumentsSignatureService
Extends the level of the signatures in thetoExtendDocument
- Parameters:
toExtendDocument
- document to extendparameters
- set of the driving signing parameters- Returns:
- the extended signature
-
getArchiveExtractor
Description copied from class:AbstractASiCSignatureService
Returns a relevant ASiC container extractor for the given format- Specified by:
getArchiveExtractor
in classAbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters>
- Parameters:
archive
-DSSDocument
to get an extractor for- Returns:
- an instance of
AbstractASiCContainerExtractor
-
getExpectedSignatureExtension
Description copied from class:AbstractASiCSignatureService
Returns the relevant signature document extension for the implemented format- Specified by:
getExpectedSignatureExtension
in classAbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters>
- Returns:
String
signature extension
-
addSignaturePolicyStore
public DSSDocument addSignaturePolicyStore(DSSDocument asicContainer, SignaturePolicyStore signaturePolicyStore)Incorporates a Signature Policy Store as an unsigned property into the ASiC with CAdES Signature- Parameters:
asicContainer
-DSSDocument
containing a CAdES Signature to add a SignaturePolicyStore tosignaturePolicyStore
-SignaturePolicyStore
to add- Returns:
DSSDocument
ASiC with CAdES container with an incorporated SignaturePolicyStore
-
assertAddSignaturePolicyStorePossible
protected void assertAddSignaturePolicyStorePossible()Description copied from class:AbstractASiCSignatureService
Verifies if incorporation of a SignaturePolicyStore is possible -
getDataToBeCounterSigned
public ToBeSigned getDataToBeCounterSigned(DSSDocument asicContainer, 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- Parameters:
asicContainer
-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 asicContainer, CAdESCounterSignatureParameters parameters, SignatureValue signatureValue)Description copied from interface:CounterSignatureService
Counter signs thesignatureDocument
with the provided signatureValue.- Parameters:
asicContainer
-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
-
assertCounterSignatureParametersValid
Description copied from class:AbstractASiCSignatureService
Verifies a validity of counter signature parameters- Overrides:
assertCounterSignatureParametersValid
in classAbstractASiCSignatureService<ASiCWithCAdESSignatureParameters,ASiCWithCAdESTimestampParameters,CAdESCounterSignatureParameters>
- Parameters:
parameters
- counter signature parameters to verify
-