Class CreateSignedTimeStamp
java.lang.Object
org.apache.pdfbox.examples.signature.CreateSignedTimeStamp
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreateSignedTimeStamp(String tsaUrl) Initialize the signed timestamp creator -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbyte[]sign(InputStream content) Creates a cms signature for the given contentvoidsignDetached(File file) Signs the given PDF file.voidsignDetached(File inFile, File outFile) Signs the given PDF file.voidsignDetached(PDDocument document, OutputStream output) Prepares the TimeStamp-Signature and starts the saving-process.private static voidusage()
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
tsaUrl
-
-
Constructor Details
-
CreateSignedTimeStamp
Initialize the signed timestamp creator- Parameters:
tsaUrl- The url where TS-Request will be done.
-
-
Method Details
-
signDetached
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
Signs the given PDF file.- Parameters:
inFile- input PDF fileoutFile- output PDF file- Throws:
IOException- if the input file could not be read
-
signDetached
Prepares the TimeStamp-Signature and starts the saving-process.- Parameters:
document- given Pdfoutput- Where the file will be written- Throws:
IOException
-
sign
Description 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:
IOException- if the signature could not be created
-
main
- Throws:
IOException
-
usage
private static void usage()
-