Interface PDFSignatureService

All Known Implementing Classes:
AbstractPDFSignatureService

public interface PDFSignatureService
The usage of this interface permits the user to choose the underlying PDF library used to create PDF signatures.
  • Method Summary

    Modifier and Type
    Method
    Description
    eu.europa.esig.dss.model.DSSDocument
    addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion)
    This method adds the DSS dictionary (Baseline-LT) to a document without password-protection and without VRI dictionary.
    eu.europa.esig.dss.model.DSSDocument
    addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd)
    This method adds the DSS dictionary (Baseline-LT) to a password-protected document without inclusion of VRI dictionary.
    eu.europa.esig.dss.model.DSSDocument
    addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd, boolean includeVRIDict)
    This method adds the DSS dictionary (Baseline-LT) to a password-protected document with a VRI dictionary if defined.
    eu.europa.esig.dss.model.DSSDocument
    addNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters)
    This method allows to add a new signature field to an existing pdf document
    eu.europa.esig.dss.model.DSSDocument
    addNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters, char[] pwd)
    This method allows to add a new signature field to an existing encrypted pdf document
    void
    analyzePdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.validation.AdvancedSignature> signatures, char[] pwd)
    Analyze the PDF revision and try to detect any modification (shadow attacks) for signatures
    void
    analyzeTimestampPdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> timestamps, char[] pwd)
    Analyze the PDF revision and try to detect any modification (shadow attacks) for PDf document timestamps
    getAvailableSignatureFields(eu.europa.esig.dss.model.DSSDocument document)
    This method returns not signed signature-fields
    getAvailableSignatureFields(eu.europa.esig.dss.model.DSSDocument document, char[] pwd)
    Returns not-signed signature fields from an encrypted document
    getRevisions(eu.europa.esig.dss.model.DSSDocument document, char[] pwd)
    Retrieves revisions from a PDF document
    eu.europa.esig.dss.model.DSSMessageDigest
    messageDigest(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters)
    Returns the message-digest computed on PDF signature revision's ByteRange
    eu.europa.esig.dss.model.DSSDocument
    previewPageWithVisualSignature(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters)
    Returns a page preview with the visual signature
    eu.europa.esig.dss.model.DSSDocument
    previewSignatureField(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters)
    Returns a preview of the signature field
    void
    Sets the PdfDifferencesFinder used to find the differences on pages between given PDF revisions.
    void
    Sets the PdfObjectModificationsFinder used to find the differences between internal PDF objects occurred between given PDF revisions.
    void
    Sets the PdfPermissionsChecker used to verify the PDF document rules for a new signature creation
    void
    Sets the PdfSignatureFieldPositionChecker used to verify the validity of new signature field placement.
    void
    setResourcesHandlerBuilder(eu.europa.esig.dss.signature.resources.DSSResourcesHandlerBuilder resourcesHandlerBuilder)
    Sets DSSResourcesFactoryBuilder to be used for a DSSResourcesHandler creation in internal methods.
    eu.europa.esig.dss.model.DSSDocument
    sign(eu.europa.esig.dss.model.DSSDocument toSignDocument, byte[] cmsSignedData, PAdESCommonParameters parameters)
    Signs a PDF document
  • Method Details

    • messageDigest

      eu.europa.esig.dss.model.DSSMessageDigest messageDigest(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters)
      Returns the message-digest computed on PDF signature revision's ByteRange
      Parameters:
      toSignDocument - the document to be signed
      parameters - the signature/timestamp parameters
      Returns:
      DSSMessageDigest
    • sign

      eu.europa.esig.dss.model.DSSDocument sign(eu.europa.esig.dss.model.DSSDocument toSignDocument, byte[] cmsSignedData, PAdESCommonParameters parameters)
      Signs a PDF document
      Parameters:
      toSignDocument - the pdf document to be signed
      cmsSignedData - the encoded CMS Signed data
      parameters - the signature/timestamp parameters
      Returns:
      DSSDocument
    • getRevisions

      List<PdfRevision> getRevisions(eu.europa.esig.dss.model.DSSDocument document, char[] pwd)
      Retrieves revisions from a PDF document
      Parameters:
      document - the document to extract revisions from
      pwd - the password protection phrase used to encrypt the PDF document use 'null' value for not an encrypted document
      Returns:
      list of extracted PdfRevisions
    • addDssDictionary

      eu.europa.esig.dss.model.DSSDocument addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion)
      This method adds the DSS dictionary (Baseline-LT) to a document without password-protection and without VRI dictionary.
      Parameters:
      document - the document to be extended
      validationDataForInclusion - PdfValidationDataContainer
      Returns:
      the pdf document with the added dss dictionary
    • addDssDictionary

      eu.europa.esig.dss.model.DSSDocument addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd)
      This method adds the DSS dictionary (Baseline-LT) to a password-protected document without inclusion of VRI dictionary.
      Parameters:
      document - the document to be extended
      validationDataForInclusion - PdfValidationDataContainer
      pwd - the password protection used to create the encrypted document (optional)
      Returns:
      the pdf document with the added dss dictionary
    • addDssDictionary

      eu.europa.esig.dss.model.DSSDocument addDssDictionary(eu.europa.esig.dss.model.DSSDocument document, PdfValidationDataContainer validationDataForInclusion, char[] pwd, boolean includeVRIDict)
      This method adds the DSS dictionary (Baseline-LT) to a password-protected document with a VRI dictionary if defined.
      Parameters:
      document - the document to be extended
      validationDataForInclusion - PdfValidationDataContainer
      pwd - the password protection used to create the encrypted document (optional)
      includeVRIDict - defines whether VRI dictionary should be included to the created DSS dictionary
      Returns:
      the pdf document with the added dss dictionary
    • getAvailableSignatureFields

      List<String> getAvailableSignatureFields(eu.europa.esig.dss.model.DSSDocument document)
      This method returns not signed signature-fields
      Parameters:
      document - the pdf document
      Returns:
      the list of empty signature fields
    • getAvailableSignatureFields

      List<String> getAvailableSignatureFields(eu.europa.esig.dss.model.DSSDocument document, char[] pwd)
      Returns not-signed signature fields from an encrypted document
      Parameters:
      document - the pdf document
      pwd - the password protection phrase used to encrypt the document
      Returns:
      the list of not signed signature field names
    • addNewSignatureField

      eu.europa.esig.dss.model.DSSDocument addNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters)
      This method allows to add a new signature field to an existing pdf document
      Parameters:
      document - the pdf document
      parameters - the parameters with the coordinates,... of the signature field
      Returns:
      the pdf document with the new added signature field
    • addNewSignatureField

      eu.europa.esig.dss.model.DSSDocument addNewSignatureField(eu.europa.esig.dss.model.DSSDocument document, SignatureFieldParameters parameters, char[] pwd)
      This method allows to add a new signature field to an existing encrypted pdf document
      Parameters:
      document - the pdf document
      parameters - the parameters with the coordinates,... of the signature field
      pwd - the password protection used to create the encrypted document (optional)
      Returns:
      the pdf document with the new added signature field
    • analyzePdfModifications

      void analyzePdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.validation.AdvancedSignature> signatures, char[] pwd)
      Analyze the PDF revision and try to detect any modification (shadow attacks) for signatures
      Parameters:
      document - DSSDocument the document
      signatures - the different signatures to be analysed
      pwd - String password protection
    • analyzeTimestampPdfModifications

      void analyzeTimestampPdfModifications(eu.europa.esig.dss.model.DSSDocument document, List<eu.europa.esig.dss.spi.x509.tsp.TimestampToken> timestamps, char[] pwd)
      Analyze the PDF revision and try to detect any modification (shadow attacks) for PDf document timestamps
      Parameters:
      document - DSSDocument the document
      timestamps - the detached document timestamps to be analysed
      pwd - String password protection
    • previewPageWithVisualSignature

      eu.europa.esig.dss.model.DSSDocument previewPageWithVisualSignature(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters)
      Returns a page preview with the visual signature
      Parameters:
      toSignDocument - the document to be signed
      parameters - the signature/timestamp parameters
      Returns:
      a DSSDocument with the PNG picture
    • previewSignatureField

      eu.europa.esig.dss.model.DSSDocument previewSignatureField(eu.europa.esig.dss.model.DSSDocument toSignDocument, PAdESCommonParameters parameters)
      Returns a preview of the signature field
      Parameters:
      toSignDocument - the document to be signed
      parameters - the signature/timestamp parameters
      Returns:
      a DSSDocument with the PNG picture
    • setResourcesHandlerBuilder

      void setResourcesHandlerBuilder(eu.europa.esig.dss.signature.resources.DSSResourcesHandlerBuilder resourcesHandlerBuilder)
      Sets DSSResourcesFactoryBuilder to be used for a DSSResourcesHandler creation in internal methods. DSSResourcesHandler defines a way to operate with OutputStreams and create DSSDocuments. Default : eu.europa.esig.dss.signature.resources.InMemoryResourcesHandler. Works with data in memory.
      Parameters:
      resourcesHandlerBuilder - DSSResourcesHandlerBuilder
    • setPdfDifferencesFinder

      void setPdfDifferencesFinder(PdfDifferencesFinder pdfDifferencesFinder)
      Sets the PdfDifferencesFinder used to find the differences on pages between given PDF revisions. Default : eu.europa.esig.dss.pdf.modifications.DefaultPdfDifferencesFinder
      Parameters:
      pdfDifferencesFinder - PdfDifferencesFinder
    • setPdfObjectModificationsFinder

      void setPdfObjectModificationsFinder(PdfObjectModificationsFinder pdfObjectModificationsFinder)
      Sets the PdfObjectModificationsFinder used to find the differences between internal PDF objects occurred between given PDF revisions. Default : eu.europa.esig.dss.pdf.modifications.DefaultPdfObjectModificationsFinder
      Parameters:
      pdfObjectModificationsFinder - PdfObjectModificationsFinder
    • setPdfPermissionsChecker

      void setPdfPermissionsChecker(PdfPermissionsChecker pdfPermissionsChecker)
      Sets the PdfPermissionsChecker used to verify the PDF document rules for a new signature creation
      Parameters:
      pdfPermissionsChecker - PdfPermissionsChecker
    • setPdfSignatureFieldPositionChecker

      void setPdfSignatureFieldPositionChecker(PdfSignatureFieldPositionChecker pdfSignatureFieldPositionChecker)
      Sets the PdfSignatureFieldPositionChecker used to verify the validity of new signature field placement. For example to ensure the new signature field lies within PDF page borders and/or it does not overlap with existing signature fields.
      Parameters:
      pdfSignatureFieldPositionChecker - PdfPermissionsChecker