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

      @Deprecated byte[] digest(DSSDocument toSignDocument, PAdESCommonParameters parameters)
      Deprecated.
      since 5.12. Use MessageDigest messageDigest = messageDigest(toSignDocument, parameters); byte[] digest = messageDigest.getValue();
      Returns the digest value of a PDF document.
      Parameters:
      toSignDocument - the document to be signed
      parameters - the signature/timestamp parameters
      Returns:
      the digest value
    • messageDigest

      DSSMessageDigest messageDigest(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

      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

      @Deprecated List<PdfRevision> getRevisions(DSSDocument document, String pwd)
      Deprecated.
      since DSS 5.12. Use #getRevisions(document, pwd.toCharArray())
      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
    • getRevisions

      List<PdfRevision> getRevisions(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

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

      @Deprecated DSSDocument addDssDictionary(DSSDocument document, PdfValidationDataContainer validationDataForInclusion, String pwd)
      Deprecated.
      since DSS 5.12. Use #addDssDictionary(document, validationDataForInclusion, pwd.toCharArray())
      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
    • addDssDictionary

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

      DSSDocument addDssDictionary(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(DSSDocument document)
      This method returns not signed signature-fields
      Parameters:
      document - the pdf document
      Returns:
      the list of empty signature fields
    • getAvailableSignatureFields

      @Deprecated List<String> getAvailableSignatureFields(DSSDocument document, String pwd)
      Deprecated.
      since DSS 5.12. Use #getAvailableSignatureFields(document, pwd.toCharArray())
      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
    • getAvailableSignatureFields

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

      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

      @Deprecated DSSDocument addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String pwd)
      Deprecated.
      since DSS 5.12. Use #addNewSignatureField(document, parameters, pwd.toCharArray())
      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
    • addNewSignatureField

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

      @Deprecated void analyzePdfModifications(DSSDocument document, List<AdvancedSignature> signatures, String pwd)
      Deprecated.
      since DSS 5.12. Use #analyzePdfModifications(document, signatures, pwd.toCharArray())
      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
    • analyzePdfModifications

      void analyzePdfModifications(DSSDocument document, List<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(DSSDocument document, List<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

      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
    • 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