Class CreateSignedTimeStamp

  • All Implemented Interfaces:
    org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface

    public class CreateSignedTimeStamp
    extends java.lang.Object
    implements org.apache.pdfbox.pdmodel.interactive.digitalsignature.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)).
    Author:
    Thomas Chojecki, Vakhtang Koroghlishvili, John Hewson, Alexis Suter
    • Constructor Summary

      Constructors 
      Constructor Description
      CreateSignedTimeStamp​(java.lang.String tsaUrl)
      Initialize the signed timestamp creator
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)  
      byte[] sign​(java.io.InputStream content)  
      void signDetached​(java.io.File file)
      Signs the given PDF file.
      void signDetached​(java.io.File inFile, java.io.File outFile)
      Signs the given PDF file.
      void signDetached​(org.apache.pdfbox.pdmodel.PDDocument document, java.io.OutputStream output)
      Prepares the TimeStamp-Signature and starts the saving-process.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CreateSignedTimeStamp

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

      • signDetached

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

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

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

        public byte[] sign​(java.io.InputStream content)
                    throws java.io.IOException
        Specified by:
        sign in interface org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException