Class AbstractASiCSignatureService<SP extends SerializableSignatureParameters,TP extends SerializableTimestampParameters,CSP extends SerializableCounterSignatureParameters>
java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<SP,TP>
eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService<SP,TP,CSP>
- Type Parameters:
SP
- implementation of signature parameters corresponding to the supported signature formatTP
- implementation of timestamp parameters corresponding to the supported document formatCSP
- implementation of counter-signature parameters corresponding to the supported signature format
- All Implemented Interfaces:
CounterSignatureService<CSP>
,DocumentSignatureService<SP,
,TP> MultipleDocumentsSignatureService<SP,
,TP> Serializable
- Direct Known Subclasses:
ASiCWithCAdESService
,ASiCWithXAdESService
public abstract class AbstractASiCSignatureService<SP extends SerializableSignatureParameters,TP extends SerializableTimestampParameters,CSP extends SerializableCounterSignatureParameters>
extends AbstractSignatureService<SP,TP>
implements MultipleDocumentsSignatureService<SP,TP>, CounterSignatureService<CSP>
The abstract class containing the main methods for ASiC signature creation/extension
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
certificateVerifier, tspSource
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractASiCSignatureService
(CertificateVerifier certificateVerifier) The default constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertAddSignaturePolicyStorePossible
(ASiCContent asicContent) Verifies if incorporation of a SignaturePolicyStore is possibleprotected void
assertCounterSignatureParametersValid
(CSP parameters) Verifies a validity of counter signature parametersprotected void
assertSignaturePossible
(List<DSSDocument> documentsToSign) This method verifies whether the signature creation is possible with the provided documentsprotected DSSDocument
buildASiCContainer
(ASiCContent asicContent, Date creationTime) Creates a ZIP-Archive by copying the provided documents to the new containerprotected ASiCContent
extractCurrentArchive
(DSSDocument archive) Extracts the content (documents) of the ASiC containerprotected abstract AbstractASiCContainerExtractor
getArchiveExtractor
(DSSDocument archive) Returns a relevant ASiC container extractor for the given formatgetContentTimestamp
(DSSDocument toSignDocument, SP parameters) This method allows to compute a content-timestamp (which is added in the signed properties)getDataToSign
(DSSDocument toSignDocument, SP parameters) Retrieves the bytes of the data that need to be signed based on thetoSignDocument
andparameters
.protected String
getFinalArchiveName
(DSSDocument originalFile, SigningOperation operation, MimeType containerMimeType) Generates and returns a final name for the archive to createsignDocument
(DSSDocument toSignDocument, SP parameters, SignatureValue signatureValue) Signs the toSignDocument with the provided signatureValue.timestamp
(DSSDocument toTimestampDocument, TP parameters) This method allows to add a timestamp to an unsigned documentMethods inherited from class eu.europa.esig.dss.signature.AbstractSignatureService
assertSigningCertificateValid, ensureSignatureValue, getFinalDocumentName, getFinalDocumentName, getFinalFileName, 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.CounterSignatureService
counterSignSignature, getDataToBeCounterSigned
Methods inherited from interface eu.europa.esig.dss.signature.DocumentSignatureService
extendDocument
Methods inherited from interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService
extendDocument, getContentTimestamp, getDataToSign, isValidSignatureValue, signDocument, timestamp
-
Constructor Details
-
AbstractASiCSignatureService
The default constructor- Parameters:
certificateVerifier
-CertificateVerifier
-
-
Method Details
-
getContentTimestamp
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<SP extends SerializableSignatureParameters,
TP extends SerializableTimestampParameters> - 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<SP extends SerializableSignatureParameters,
TP extends SerializableTimestampParameters> - 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, SP parameters, SignatureValue signatureValue) Description copied from interface:DocumentSignatureService
Signs the toSignDocument with the provided signatureValue.- Specified by:
signDocument
in interfaceDocumentSignatureService<SP extends SerializableSignatureParameters,
TP extends SerializableTimestampParameters> - 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)
-
timestamp
Description copied from interface:DocumentSignatureService
This method allows to add a timestamp to an unsigned document- Specified by:
timestamp
in interfaceDocumentSignatureService<SP extends SerializableSignatureParameters,
TP extends SerializableTimestampParameters> - Overrides:
timestamp
in classAbstractSignatureService<SP extends SerializableSignatureParameters,
TP extends SerializableTimestampParameters> - Parameters:
toTimestampDocument
- the document to be timestampedparameters
- set of the driving timestamping parameters- Returns:
- the timestamped document
-
extractCurrentArchive
Extracts the content (documents) of the ASiC container- Parameters:
archive
-DSSDocument
representing an ASiC container- Returns:
ASiCContent
-
getArchiveExtractor
Returns a relevant ASiC container extractor for the given format- Parameters:
archive
-DSSDocument
to get an extractor for- Returns:
- an instance of
AbstractASiCContainerExtractor
-
buildASiCContainer
Creates a ZIP-Archive by copying the provided documents to the new container- Parameters:
asicContent
-ASiCContent
to create a new ZIP archive fromcreationTime
-Date
of the archive creation (optional)- Returns:
DSSDocument
the created ASiC Container
-
assertSignaturePossible
This method verifies whether the signature creation is possible with the provided documents- Parameters:
documentsToSign
- a list ofDSSDocument
s
-
assertCounterSignatureParametersValid
Verifies a validity of counter signature parameters- Parameters:
parameters
- counter signature parameters to verify
-
assertAddSignaturePolicyStorePossible
Verifies if incorporation of a SignaturePolicyStore is possible- Parameters:
asicContent
-ASiCContent
-
getFinalArchiveName
protected String getFinalArchiveName(DSSDocument originalFile, SigningOperation operation, MimeType containerMimeType) Generates and returns a final name for the archive to create- Parameters:
originalFile
-DSSDocument
original signed/extended document containeroperation
-SigningOperation
the performed signing operationcontainerMimeType
-MimeType
the expected mimeType- Returns:
String
the archive filename
-