Interface PDFSignatureService

All Known Implementing Classes:
AbstractPDFSignatureService, ITextPDFSignatureService, PdfBoxSignatureService

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

    • digest

      byte[] digest(DSSDocument toSignDocument, PAdESCommonParameters parameters)
      Returns the digest value of a PDF document.
      Parameters:
      toSignDocument - the document to be signed
      parameters - the signature/timestamp parameters
      Returns:
      the digest value
    • sign

      DSSDocument sign(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(DSSDocument document, String 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

      DSSDocument addDssDictionary(DSSDocument document, PdfValidationDataContainer validationDataForInclusion)
      This method adds the DSS dictionary (Baseline-LT)
      Parameters:
      document - the document to be extended
      validationDataForInclusion - PdfValidationDataContainer
      Returns:
      the pdf document with the added dss dictionary
    • addDssDictionary

      DSSDocument addDssDictionary(DSSDocument document, PdfValidationDataContainer validationDataForInclusion, String pwd)
      This method adds the DSS dictionary (Baseline-LT) to a password-protected document
      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
    • getAvailableSignatureFields

      List<String> getAvailableSignatureFields(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(DSSDocument document, String 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

      DSSDocument addNewSignatureField(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

      DSSDocument addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String 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(DSSDocument document, List<AdvancedSignature> signatures, String pwd)
      Analyze the PDF revision and try to detect any modification (shadow attacks)
      Parameters:
      document - DSSDocument the document
      signatures - the different signatures to analyse
      pwd - String password protection
    • previewPageWithVisualSignature

      DSSDocument previewPageWithVisualSignature(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

      DSSDocument previewSignatureField(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(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