|
DigiStamp.com | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.digistamp.pdf.test.PdfSignerDemo
public class PdfSignerDemo
Demonstrate creating a PKI digital signature of a PDF document and then
time-stamp that signature.
Demo dependencies:
Output is a signed and timestamped PDF copy of your input file. The type of PDF signature created is 'certifying' signature.
This demo program expect user supplied parameters to specify the signing credentials (a key store) and access to an Internet-based time stamp server.
Signing credentials are created using a certificate authority. See
information here: http://www.digistamp.com/helps/keySetup.htm
An alternative for signing credential is making key-pair for testing:
keytool -genkey -v -alias abc
-dname "cn=A Person, o=Test Org, L=A Location, S=A State, C=MY"
-keypass 7777777 -keystore GenTest.p12 -storetype PKCS12
-keyalg RSA -keysize 2048 -storepass 7777777 -validity 720
DigiStamp configuration properties. An example configuration file name
"DigiStamp.properties" was provided with the distribution; you will need to
add your account number and password to the file "DigiStamp.properties". More
configuration details are here: TSAConfig.
An optional authentication step can be performed within the time stamp
request processing: is the public key of the time stamp certificate trusted?
This is a recommended validation to be performed. You will need to supply the
trusted root certificate in a file or install the certificate to the Java
libraries trusted keystore. See method initializeDigistamp(String)
below.
| Constructor Summary | |
|---|---|
PdfSignerDemo()
|
|
| Method Summary | |
|---|---|
static TSAClientDigiStamp |
initializeDigistamp(java.lang.String digistampPropertiesPath)
DigiStamp client library needs configuration data like which TSA servers to use and the account and password information. |
static void |
loggerSetForTesting()
Logger messages can be displayed. |
static void |
main(java.lang.String[] args)
Command line interface to create a signed PDF with a valid time-stamp. |
void |
setAppearance(com.lowagie.text.pdf.PdfSignatureAppearance sap)
Setup the appearance of the signature within the PDF file. |
void |
setContentEst(int lazyInitContentEst)
Estimate signature size, creating a 'fake' one using fake data and the constant length of a SHA1. |
void |
setSks(SignerKeystore sks)
The keystore with credentials to sign the PDF. |
void |
setTsa(com.lowagie.text.pdf.TSAClient tsa)
The object responsible for retrieving the RFC 3161 timeStampToken. |
void |
signPDF(java.io.InputStream srcInputStream,
java.io.OutputStream dstOutputStream,
com.lowagie.text.pdf.TSAClient tsc)
Demo using iText to digitally sign PDF document with a valid time-stamp. |
void |
signPDF(java.lang.String srcFile,
java.lang.String dstFile)
Read PDF from input file and output new PDF that is signed and time stamped. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PdfSignerDemo()
| Method Detail |
|---|
public static TSAClientDigiStamp initializeDigistamp(java.lang.String digistampPropertiesPath)
throws java.io.FileNotFoundException,
java.io.IOException,
java.security.cert.CertificateException
Optional, an additional authentication step can be performed within the
DigiStamp time stamp request processing: is the public key of the time
stamp certificate trusted? This is a recommended validation to be
performed. see:
TSAClient.setTrustedRootCertificate(X509Certificate)
digistampPropertiesPath - - file name
java.io.FileNotFoundException
java.io.IOException
java.security.cert.CertificateExceptionpublic static void loggerSetForTesting()
public static void main(java.lang.String[] args)
args - keyStorePath keyStorePassWord digistampPropertiesPath PDFfile
{PDFfile} {PDFfile}...public void setAppearance(com.lowagie.text.pdf.PdfSignatureAppearance sap)
sap - PdfSignatureAppearancepublic void setContentEst(int lazyInitContentEst)
public void setSks(SignerKeystore sks)
sks - public void setTsa(com.lowagie.text.pdf.TSAClient tsa)
tsa -
public void signPDF(java.io.InputStream srcInputStream,
java.io.OutputStream dstOutputStream,
com.lowagie.text.pdf.TSAClient tsc)
originated from work by Martin Brunecky dated Jul 25, 2007; 01:13pm from the itext-questions@lists.sourceforge.net mailing list
srcInputStream - dstOutputStream - tsc -
public void signPDF(java.lang.String srcFile,
java.lang.String dstFile)
throws java.lang.Exception
srcFile - dstFile -
java.lang.Exception
|
Copyright 2000-2010 DigiStamp, Inc. | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||