Interface SignatureService

  • All Known Implementing Classes:
    SignatureServiceImpl

    public interface SignatureService
    Provides digital signature services that can be performed on PDF documents, e.g.:
    • signing a specific PDF,
    • obtaining a list of certificates already associated with a document.
    A PDF document can be signed using a user certificate. This requires an existing user certificate present in the system. A certificate password must be made available to use this service.
    • Method Detail

      • signDocument

        Blob signDocument​(DocumentModel doc,
                          DocumentModel user,
                          String userKeyPassword,
                          String reason,
                          boolean pdfa,
                          SignatureService.SigningDisposition disposition,
                          String archiveFilename)
        Signs a document with a user certificate (converts it into a PDF first if needed).

        Requires a password to retrieve the certificate from the user keystore.

        Does not save the modified document.

        Parameters:
        doc - the document to sign
        user - the signing user
        userKeyPassword - the password for the user's signing certificate
        reason - the signing reason
        pdfa - true if the generated PDF should be a PDF/A-1b
        disposition - the signing disposition
        archiveFilename - the archive filename when using an archive
        Returns:
        a blob containing the signed PDF
      • signPDF

        Blob signPDF​(Blob pdfBlob,
                     DocumentModel doc,
                     DocumentModel user,
                     String userKeyPassword,
                     String reason)
              throws SignException
        Signs a PDF document with a user certificate. Requires a password to retrieve the certificate from the user keystore.
        Parameters:
        doc - Document model beign signed
        pdfBlob - the blob containing the PDF to sign
        user - the signing user
        userKeyPassword - the password for the user's signing certificate
        reason - the signing reason
        Returns:
        a blob containing the signed PDF
        Throws:
        SignException
      • getCertificates

        List<X509Certificate> getCertificates​(DocumentModel doc)
        Returns a list of certificates associated with a given document.
        Parameters:
        doc - the document
        Returns:
        the list of certificates (may be empty)