Class CreateSignedTimeStamp

java.lang.Object
org.apache.pdfbox.examples.signature.CreateSignedTimeStamp
All Implemented Interfaces:
SignatureInterface

public class CreateSignedTimeStamp extends Object implements SignatureInterface
An example for timestamp-signing a PDF for PADeS-Specification. The document will be extended by a signed TimeStamp (another kind of signature) (Signed TimeStamp and Hash-Value of the document are signed by a Time Stamp Authority (TSA)).
  • Field Details

    • LOG

      private static final org.apache.commons.logging.Log LOG
    • tsaUrl

      private final String tsaUrl
  • Constructor Details

    • CreateSignedTimeStamp

      public CreateSignedTimeStamp(String tsaUrl)
      Initialize the signed timestamp creator
      Parameters:
      tsaUrl - The url where TS-Request will be done.
  • Method Details

    • signDetached

      public void signDetached(File file) throws IOException
      Signs the given PDF file. Alters the original file on disk.
      Parameters:
      file - the PDF file to sign
      Throws:
      IOException - if the file could not be read or written
    • signDetached

      public void signDetached(File inFile, File outFile) throws IOException
      Signs the given PDF file.
      Parameters:
      inFile - input PDF file
      outFile - output PDF file
      Throws:
      IOException - if the input file could not be read
    • signDetached

      public void signDetached(PDDocument document, OutputStream output) throws IOException
      Prepares the TimeStamp-Signature and starts the saving-process.
      Parameters:
      document - given Pdf
      output - Where the file will be written
      Throws:
      IOException
    • sign

      public byte[] sign(InputStream content) throws IOException
      Description copied from interface: SignatureInterface
      Creates a cms signature for the given content
      Specified by:
      sign in interface SignatureInterface
      Parameters:
      content - is the content as a (Filter)InputStream
      Returns:
      signature as a byte array
      Throws:
      IOException - if the signature could not be created
    • main

      public static void main(String[] args) throws IOException
      Throws:
      IOException
    • usage

      private static void usage()