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
ConstructorsModifierConstructorDescriptionprotectedAbstractASiCSignatureService(CertificateVerifier certificateVerifier) The default constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertAddSignaturePolicyStorePossible(ASiCContent asicContent) Verifies if incorporation of a SignaturePolicyStore is possibleprotected voidassertCounterSignatureParametersValid(CSP parameters) Verifies a validity of counter signature parametersprotected voidassertSignaturePossible(List<DSSDocument> documentsToSign) This method verifies whether the signature creation is possible with the provided documentsprotected DSSDocumentbuildASiCContainer(ASiCContent asicContent, Date creationTime) Creates a ZIP-Archive by copying the provided documents to the new containerprotected ASiCContentextractCurrentArchive(DSSDocument archive) Extracts the content (documents) of the ASiC containerprotected abstract DefaultASiCContainerExtractorgetArchiveExtractor(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 thetoSignDocumentandparameters.protected StringgetFinalArchiveName(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, setTspSourceMethods 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.CounterSignatureService
counterSignSignature, getDataToBeCounterSigned, setTspSourceMethods inherited from interface eu.europa.esig.dss.signature.DocumentSignatureService
extendDocumentMethods 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:DocumentSignatureServiceThis method allows to compute a content-timestamp (which is added in the signed properties)- Specified by:
getContentTimestampin 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: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<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:DocumentSignatureServiceSigns the toSignDocument with the provided signatureValue.- Specified by:
signDocumentin 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 (
toSignDocumentwith the incorporated signature or the detached signature)
-
timestamp
Description copied from interface:DocumentSignatureServiceThis method allows to add a timestamp to an unsigned document- Specified by:
timestampin interfaceDocumentSignatureService<SP extends SerializableSignatureParameters,TP extends SerializableTimestampParameters> - Overrides:
timestampin 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-DSSDocumentrepresenting an ASiC container- Returns:
ASiCContent
-
getArchiveExtractor
Returns a relevant ASiC container extractor for the given format- Parameters:
archive-DSSDocumentto get an extractor for- Returns:
- an instance of
DefaultASiCContainerExtractor
-
buildASiCContainer
Creates a ZIP-Archive by copying the provided documents to the new container- Parameters:
asicContent-ASiCContentto create a new ZIP archive fromcreationTime-Dateof the archive creation (optional)- Returns:
DSSDocumentthe created ASiC Container
-
assertSignaturePossible
This method verifies whether the signature creation is possible with the provided documents- Parameters:
documentsToSign- a list ofDSSDocuments
-
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-DSSDocumentoriginal signed/extended document containeroperation-SigningOperationthe performed signing operationcontainerMimeType-MimeTypethe expected mimeType- Returns:
Stringthe archive filename
-