Class CreateSignedTimeStamp
- java.lang.Object
-
- org.apache.pdfbox.examples.signature.CreateSignedTimeStamp
-
- All Implemented Interfaces:
SignatureInterface
public class CreateSignedTimeStamp extends java.lang.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)).
-
-
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 voidmain(java.lang.String[] args)byte[]sign(java.io.InputStream content)Creates a cms signature for the given contentvoidsignDetached(java.io.File file)Signs the given PDF file.voidsignDetached(java.io.File inFile, java.io.File outFile)Signs the given PDF file.voidsignDetached(PDDocument document, java.io.OutputStream output)Prepares the TimeStamp-Signature and starts the saving-process.private static voidusage()
-
-
-
Method Detail
-
signDetached
public void signDetached(java.io.File file) throws java.io.IOExceptionSigns 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.IOExceptionSigns the given PDF file.- Parameters:
inFile- input PDF fileoutFile- output PDF file- Throws:
java.io.IOException- if the input file could not be read
-
signDetached
public void signDetached(PDDocument document, java.io.OutputStream output) throws java.io.IOException
Prepares the TimeStamp-Signature and starts the saving-process.- Parameters:
document- given Pdfoutput- Where the file will be written- Throws:
java.io.IOException
-
sign
public byte[] sign(java.io.InputStream content) throws java.io.IOExceptionDescription copied from interface:SignatureInterfaceCreates a cms signature for the given content- Specified by:
signin interfaceSignatureInterface- Parameters:
content- is the content as a (Filter)InputStream- Returns:
- signature as a byte array
- Throws:
java.io.IOException- if the signature could not be created
-
main
public static void main(java.lang.String[] args) throws java.io.IOException- Throws:
java.io.IOException
-
usage
private static void usage()
-
-