Class PdfBoxSignatureService

    • Constructor Detail

      • PdfBoxSignatureService

        public PdfBoxSignatureService​(boolean timestamp,
                                      PdfBoxSignatureDrawerFactory signatureDrawerFactory)
        Constructor for the PdfBoxSignatureService
        Parameters:
        timestamp - if true, the instance is used to generate DocumentTypestamp if false, it is used to generate a signature layer
    • Method Detail

      • digest

        public byte[] digest​(DSSDocument toSignDocument,
                             PAdESSignatureParameters parameters,
                             DigestAlgorithm digestAlgorithm)
        Description copied from interface: PDFSignatureService
        Returns the digest value of a PDF document
        Parameters:
        toSignDocument - the document to be signed
        parameters - the signature parameters
        digestAlgorithm - the digest algorithm to be used
        Returns:
        the digest value
      • sign

        public DSSDocument sign​(DSSDocument toSignDocument,
                                byte[] signatureValue,
                                PAdESSignatureParameters parameters,
                                DigestAlgorithm digestAlgorithm)
        Description copied from interface: PDFSignatureService
        Signs a PDF document
        Parameters:
        toSignDocument - the pdf document
        signatureValue - the signature value
        parameters - the signature parameters
        digestAlgorithm - the digest algorithm to be used
      • setMDPPermission

        public void setMDPPermission​(org.apache.pdfbox.pdmodel.PDDocument doc,
                                     org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature signature,
                                     int accessPermissions)
        Set the access permissions granted for this document in the DocMDP transform parameters dictionary. Details are described in the table "Entries in the DocMDP transform parameters dictionary" in the PDF specification.
        Parameters:
        doc - The document.
        signature - The signature object.
        accessPermissions - The permission value (1, 2 or 3).
      • addDssDictionary

        public DSSDocument addDssDictionary​(DSSDocument document,
                                            List<DSSDictionaryCallback> callbacks)
        Description copied from interface: PDFSignatureService
        This method adds the DSS dictionary (Baseline-LT)
        Parameters:
        document - the document to be extended
        callbacks - the callbacks to retrieve the revocation data,...
        Returns:
        the pdf document with the added dss dictionary
      • getAvailableSignatureFields

        public List<String> getAvailableSignatureFields​(DSSDocument document)
        Description copied from interface: PDFSignatureService
        This method returns not signed signature-fields
        Parameters:
        document - the pdf document
        Returns:
        the list of empty signature fields
      • addNewSignatureField

        public DSSDocument addNewSignatureField​(DSSDocument document,
                                                SignatureFieldParameters parameters)
        Description copied from interface: PDFSignatureService
        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