Class AbstractASiCSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters,CSP extends eu.europa.esig.dss.model.SerializableCounterSignatureParameters,ERP extends eu.europa.esig.dss.model.SerializableEvidenceRecordIncorporationParameters>

java.lang.Object
eu.europa.esig.dss.signature.AbstractSignatureService<SP,TP>
eu.europa.esig.dss.asic.common.signature.AbstractASiCSignatureService<SP,TP,CSP,ERP>
Type Parameters:
SP - implementation of signature parameters corresponding to the supported signature format
TP - implementation of timestamp parameters corresponding to the supported document format
CSP - implementation of counter-signature parameters corresponding to the supported signature format
ERP - implementation of parameters used for evidince record embedding
All Implemented Interfaces:
eu.europa.esig.dss.evidencerecord.EvidenceRecordIncorporationService<ERP>, eu.europa.esig.dss.signature.CounterSignatureService<CSP>, eu.europa.esig.dss.signature.DocumentSignatureService<SP,TP>, eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<SP,TP>, Serializable

public abstract class AbstractASiCSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters,CSP extends eu.europa.esig.dss.model.SerializableCounterSignatureParameters,ERP extends eu.europa.esig.dss.model.SerializableEvidenceRecordIncorporationParameters> extends eu.europa.esig.dss.signature.AbstractSignatureService<SP,TP> implements eu.europa.esig.dss.signature.MultipleDocumentsSignatureService<SP,TP>, eu.europa.esig.dss.signature.CounterSignatureService<CSP>, eu.europa.esig.dss.evidencerecord.EvidenceRecordIncorporationService<ERP>
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

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractASiCSignatureService(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
    The default constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    eu.europa.esig.dss.model.DSSDocument
    addContainerEvidenceRecord(eu.europa.esig.dss.model.DSSDocument document, eu.europa.esig.dss.model.DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters)
    Creates a new ASiC container with the evidenceRecordDocument applied to the document.
    abstract eu.europa.esig.dss.model.DSSDocument
    addContainerEvidenceRecord(List<eu.europa.esig.dss.model.DSSDocument> documents, eu.europa.esig.dss.model.DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters)
    Creates a new ASiC container with the evidenceRecordDocument applied to the documents.
    protected void
    Verifies if incorporation of a SignaturePolicyStore is possible
    protected void
    Verifies a validity of counter signature parameters
    protected void
    assertSignaturePossible(List<eu.europa.esig.dss.model.DSSDocument> documentsToSign)
    This method verifies whether the signature creation is possible with the provided documents
    protected eu.europa.esig.dss.model.DSSDocument
    Creates a ZIP-Archive by copying the provided documents to the new container using the current time as ZIP creation time
    protected eu.europa.esig.dss.model.DSSDocument
    buildASiCContainer(ASiCContent asicContent, Date creationTime)
    Creates a ZIP-Archive by copying the provided documents to the new container
    protected ASiCContent
    extractCurrentArchive(eu.europa.esig.dss.model.DSSDocument archive)
    Extracts the content (documents) of the ASiC container
    getArchiveExtractor(eu.europa.esig.dss.model.DSSDocument archive)
    Returns a relevant ASiC container extractor for the given format
    eu.europa.esig.dss.spi.x509.tsp.TimestampToken
    getContentTimestamp(eu.europa.esig.dss.model.DSSDocument toSignDocument, SP parameters)
     
    eu.europa.esig.dss.model.ToBeSigned
    getDataToSign(eu.europa.esig.dss.model.DSSDocument toSignDocument, SP parameters)
     
    protected String
    getFinalArchiveName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.MimeType containerMimeType)
    Generates and returns a final name for the archive to create
    eu.europa.esig.dss.model.DSSDocument
    signDocument(eu.europa.esig.dss.model.DSSDocument toSignDocument, SP parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
     
    eu.europa.esig.dss.model.DSSDocument
    timestamp(eu.europa.esig.dss.model.DSSDocument toTimestampDocument, TP parameters)
     

    Methods 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, setTspSource

    Methods inherited from interface eu.europa.esig.dss.signature.DocumentSignatureService

    extendDocument

    Methods inherited from interface eu.europa.esig.dss.evidencerecord.EvidenceRecordIncorporationService

    addSignatureEvidenceRecord

    Methods inherited from interface eu.europa.esig.dss.signature.MultipleDocumentsSignatureService

    extendDocument, getContentTimestamp, getDataToSign, isValidSignatureValue, signDocument, timestamp
  • Constructor Details

    • AbstractASiCSignatureService

      protected AbstractASiCSignatureService(eu.europa.esig.dss.spi.validation.CertificateVerifier certificateVerifier)
      The default constructor
      Parameters:
      certificateVerifier - CertificateVerifier
  • Method Details

    • getContentTimestamp

      public eu.europa.esig.dss.spi.x509.tsp.TimestampToken getContentTimestamp(eu.europa.esig.dss.model.DSSDocument toSignDocument, SP parameters)
      Specified by:
      getContentTimestamp in interface eu.europa.esig.dss.signature.DocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
    • getDataToSign

      public eu.europa.esig.dss.model.ToBeSigned getDataToSign(eu.europa.esig.dss.model.DSSDocument toSignDocument, SP parameters)
      Specified by:
      getDataToSign in interface eu.europa.esig.dss.signature.DocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
    • signDocument

      public eu.europa.esig.dss.model.DSSDocument signDocument(eu.europa.esig.dss.model.DSSDocument toSignDocument, SP parameters, eu.europa.esig.dss.model.SignatureValue signatureValue)
      Specified by:
      signDocument in interface eu.europa.esig.dss.signature.DocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
    • timestamp

      public eu.europa.esig.dss.model.DSSDocument timestamp(eu.europa.esig.dss.model.DSSDocument toTimestampDocument, TP parameters)
      Specified by:
      timestamp in interface eu.europa.esig.dss.signature.DocumentSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
      Overrides:
      timestamp in class eu.europa.esig.dss.signature.AbstractSignatureService<SP extends eu.europa.esig.dss.model.SerializableSignatureParameters,TP extends eu.europa.esig.dss.model.SerializableTimestampParameters>
    • addContainerEvidenceRecord

      public eu.europa.esig.dss.model.DSSDocument addContainerEvidenceRecord(eu.europa.esig.dss.model.DSSDocument document, eu.europa.esig.dss.model.DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters)
      Creates a new ASiC container with the evidenceRecordDocument applied to the document.

      If the provided original document is an existing ASiC container, then the evidenceRecordDocument will be evaluated against the container files and places within the container.

      Parameters:
      document - a list of DSSDocuments preserved by an evidence record
      evidenceRecordDocument - DSSDocument to add
      parameters - ASiCContainerEvidenceRecordParameters providing configuration for the evidence record incorporation
      Returns:
      DSSDocument ASiC container containing the evidence record file document
    • addContainerEvidenceRecord

      public abstract eu.europa.esig.dss.model.DSSDocument addContainerEvidenceRecord(List<eu.europa.esig.dss.model.DSSDocument> documents, eu.europa.esig.dss.model.DSSDocument evidenceRecordDocument, ASiCContainerEvidenceRecordParameters parameters)
      Creates a new ASiC container with the evidenceRecordDocument applied to the documents.

      If the provided original document is an existing ASiC container, then the evidenceRecordDocument will be evaluated against the container files and places within the container.

      Parameters:
      documents - a list of DSSDocuments preserved by an evidence record
      evidenceRecordDocument - DSSDocument to add
      parameters - ASiCContainerEvidenceRecordParameters providing configuration for the evidence record incorporation
      Returns:
      DSSDocument ASiC container containing the evidence record file document
    • extractCurrentArchive

      protected ASiCContent extractCurrentArchive(eu.europa.esig.dss.model.DSSDocument archive)
      Extracts the content (documents) of the ASiC container
      Parameters:
      archive - DSSDocument representing an ASiC container
      Returns:
      ASiCContent
    • getArchiveExtractor

      protected abstract DefaultASiCContainerExtractor getArchiveExtractor(eu.europa.esig.dss.model.DSSDocument archive)
      Returns a relevant ASiC container extractor for the given format
      Parameters:
      archive - DSSDocument to get an extractor for
      Returns:
      an instance of DefaultASiCContainerExtractor
    • buildASiCContainer

      protected eu.europa.esig.dss.model.DSSDocument buildASiCContainer(ASiCContent asicContent)
      Creates a ZIP-Archive by copying the provided documents to the new container using the current time as ZIP creation time
      Parameters:
      asicContent - ASiCContent to create a new ZIP archive from
      Returns:
      DSSDocument the created ASiC Container
    • buildASiCContainer

      protected eu.europa.esig.dss.model.DSSDocument buildASiCContainer(ASiCContent asicContent, Date creationTime)
      Creates a ZIP-Archive by copying the provided documents to the new container
      Parameters:
      asicContent - ASiCContent to create a new ZIP archive from
      creationTime - Date of the archive creation (optional)
      Returns:
      DSSDocument the created ASiC Container
    • assertSignaturePossible

      protected void assertSignaturePossible(List<eu.europa.esig.dss.model.DSSDocument> documentsToSign)
      This method verifies whether the signature creation is possible with the provided documents
      Parameters:
      documentsToSign - a list of DSSDocuments
    • assertCounterSignatureParametersValid

      protected void assertCounterSignatureParametersValid(CSP parameters)
      Verifies a validity of counter signature parameters
      Parameters:
      parameters - counter signature parameters to verify
    • assertAddSignaturePolicyStorePossible

      protected void assertAddSignaturePolicyStorePossible(ASiCContent asicContent)
      Verifies if incorporation of a SignaturePolicyStore is possible
      Parameters:
      asicContent - ASiCContent
    • getFinalArchiveName

      protected String getFinalArchiveName(eu.europa.esig.dss.model.DSSDocument originalFile, eu.europa.esig.dss.enumerations.SigningOperation operation, eu.europa.esig.dss.enumerations.MimeType containerMimeType)
      Generates and returns a final name for the archive to create
      Parameters:
      originalFile - DSSDocument original signed/extended document container
      operation - SigningOperation the performed signing operation
      containerMimeType - MimeType the expected mimeType
      Returns:
      String the archive filename