JSign PDF
JSign PDF
http://jsignpdf.sourceforge.net/
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
Table of Contents
1 JSignPdf Introduction.......................................................................................................4
1.1 Benefits of digital signatures.................................................................................................................4
1.1.1 Authentication................................................................................................................................4
1.1.2 Integrity.........................................................................................................................................4
1.2 License..................................................................................................................................................4
1.3 History...................................................................................................................................................4
1.4 Author....................................................................................................................................................5
1.5 Getting support......................................................................................................................................5
2 Prerequisites....................................................................................................................... 6
2.1 Java........................................................................................................................................................6
2.2 Keystore.................................................................................................................................................6
2.2.1 Exporting PKCS12 certificates from Internet Explorer.................................................................6
2.2.2 Java Key and Certificate Management Tool..................................................................................6
3 Installation......................................................................................................................... 8
3.1 Windows installer..................................................................................................................................8
3.2 Zip package.........................................................................................................................................10
3.3 OpenOffice.org/LibreOffice Add-On...................................................................................................10
4 Launching......................................................................................................................... 11
4.1 Windows Start menu............................................................................................................................11
4.2 Without start menu...............................................................................................................................11
4.3 OpenOffice.org/LibreOffice Add-On...................................................................................................11
5 Using JSignPdf – signing PDF files................................................................................12
5.1 Simple version.....................................................................................................................................12
5.2 More detailed version..........................................................................................................................12
5.2.1 Select Key Store Type..................................................................................................................12
5.2.2 Keystore file and password..........................................................................................................12
5.2.3 Input and Output PDF files..........................................................................................................12
5.2.4 Reason, location, contact.............................................................................................................13
5.2.5 Remember passwords..................................................................................................................13
5.2.6 Sign It..........................................................................................................................................13
5.3 Advanced view....................................................................................................................................14
5.3.1 Key alias......................................................................................................................................14
5.3.2 Key password..............................................................................................................................14
5.3.3 Append signature.........................................................................................................................14
5.3.4 Certification level........................................................................................................................14
5.3.5 Hash algorithms...........................................................................................................................15
5.4 Encryption...........................................................................................................................................16
5.4.1 Encryption: Passwords.................................................................................................................17
5.4.2 Encryption: Certificate.................................................................................................................17
5.4.3 Rights..........................................................................................................................................17
5.5 Visible signature..................................................................................................................................17
5.5.1 Page.............................................................................................................................................18
5.5.2 Signature corners.........................................................................................................................18
5.5.3 Preview / Select button................................................................................................................19
5.5.4 Display........................................................................................................................................19
5.5.5 Acrobat 6 layers...........................................................................................................................20
5.5.6 Texts and Images.........................................................................................................................20
5.6 TSA – timestamps................................................................................................................................20
2 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
3 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
1 JSignPdf Introduction
JSignPdf is an open source application which adds digital signatures to PDF documents. It's written
in Java programming language and it can be launched on the most of current OS (MS Windows,
Linux, Mac OS X, ...). User can control the application using simple Swing GUI or command line
arguments. Main features:
• supports visible signatures
• can set certification level
• supports PDF encryption with setting rights
• timestamp support
• certificate revocation checking (CRL and/or OCSP)
1.1 Benefits of digital signatures
Below are some common reasons for applying a digital signature to communications. (source
Wikipedia)
1.1.1 Authentication
Although messages may often include information about the entity sending a message, that
information may not be accurate. Digital signatures can be used to authenticate the source of
messages. When ownership of a digital signature secret key is bound to a specific user, a valid
signature shows that the message was sent by that user. The importance of high confidence in
sender authenticity is especially obvious in a financial context. For example, suppose a bank's
branch office sends instructions to the central office requesting a change in the balance of an
account. If the central office is not convinced that such a message is truly sent from an authorized
source, acting on such a request could be a grave mistake.
1.1.2 Integrity
In many scenarios, the sender and receiver of a message may have a need for confidence that the
message has not been altered during transmission. Although encryption hides the contents of a
message, it may be possible to change an encrypted message without understanding it. (Some
encryption algorithms, known as nonmalleable ones, prevent this, but others do not.) However, if a
message is digitally signed, any change in the message will invalidate the signature. Furthermore,
there is no efficient way to modify a message and its signature to produce a new message with a
valid signature, because this is still considered to be computationally infeasible by most
cryptographic hash functions
1.2 License
JSignPdf is released under LGPL and/or MPL license. It means, it can be freely used for personal
use, for academic use, by government institutions, by non-profit making organizations and by
commercial organizations. JSignPdf, or parts of it, can also be freely incorporated into commercial
products. For more details look directly to license files.
1.3 History
Project started on the beginning of 2008 as a response for a request for PDF-signing Add-On to
OpenOffice.org which came up from Czech OpenOffice.org users community.
Active development stopped by the author on September 2012.
4 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
1.4 Author
Author of the JSignPdf is a Czech developer Josef Cacek. He works in Java from 2000. Some links
to the Josef's projects:
• https://sourceforge.net/users/kwart/
• https://github.com/kwart/
1.5 Getting support
If you don't find the relevant information in this document or on JSignPdf web page
(http://jsignpdf.sourceforge.net/) use JSignPdf Google Group to ask the community.
https://groups.google.com/d/jsignpdf/
5 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
2 Prerequisites
2.1 Java
If you want to use JSignPdf, and you don't install it on Windows using the installation program, you
will need Java Runtime Environment (JRE) version 5 or newer on your computer (recommended is
the Java 6). If you don't have it, you can download it freely from web pages, for instance:
http://java.sun.com/
If you use JSignPdf OpenOffice.org/LibreOffice Add-On, you have to allow Java in OpenOffice.org
preferences.
6 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
http://java.sun.com/javase/6/docs/technotes/tools/windows/keytool.html
7 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
3 Installation
This chapter describes how to install JSignPdf using Windows installer, zip package and how to
enable JSignPdf as OpenOffice.org/LibreOffice Add On.
3.1 Windows installer
Windows installer contains ready to use version – the Java Runtime is also included in the package.
8 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
9 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
In extension manager window press Add... button, select extension file JSignPdf-1.6.2.oxt
in the displayed open-file dialog and press Open button.
Restart your OpenOffice.org/LibreOffice (quickstarter too) and check presence of the new JSignPdf
toolbar icon and menu item PDF Signer in the menu Tools → Add-Ons
10 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
4 Launching
4.1 Windows Start menu
If you've installed JSignPdf from the windows installer package, there is a new Group in your
system Start menu: Start → Programs → JSignPdf → JSignPdf 1.6.2
4.2 Without start menu
All platforms (with Java installed) should support launching of jar file JSignPdf.jar. Use
following command in the directory, where the application is located.
$java -jar JSignPdf.jar
If you don't need see console output, use javaw command instead of java.
4.3 OpenOffice.org/LibreOffice Add-On
Press JSignPdf icon in OpenOffice.org/LibreOffice toolbar or choose in menu Tools → Add-Ons →
PDF Signer
11 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
By default, JSignPdf displays keystore types provided by Java (Sun Provider) and Bouncy Castle
cryptographic provider.
More info: http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html
5.2.2 Keystore file and password
If you use JKS or PKCS#12 keystores, you have to select file where the keys are stored and provide
password of this file. Path to the keystore file can be inserted directly by typing or you can use
Browse button to navigate through the file system with Open File Dialog.
5.2.3 Input and Output PDF files
Input PDF file is an existing PDF file to which should be added digital signature.
Output PDF file is a name of result PDF file. If the value is not filled, automatically will be used the
Input PDF file with additional suffix “_signed” (e.g. input test.pdf will result in
test_signed.pdf)
The Input and Output files has to be different!
12 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
13 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
1 Only the private keys, which are valid (at the time of the signing) are displayed in the list. If the certificate supports
Key Usage extension, the private key will only be displayed if it is meant for signing.
14 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
In Acrobat reader, you can display signature properties and on tab Document is the information
about used algorithm.
15 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
5.4 Encryption
PDF Encryption combobox enables additional fields for support of PDF security. By using this you
can either sign secured PDFs (and change the rights and user password) or you can add encryption
to unencrypted PDF during signing.
16 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
Normal rights are represented by checkboxes. Printing right has 3 levels, so the combobox is used
for it.
5.5 Visible signature
Checkbox Visible signature allows you to create visible field with signature directly in the signed
PDF. If the checkbox is checked, button Settings is enabled and you can configure parameters
17 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
Read ToolTip texts, which are assigned to some input fields. You will get information, how to fill
them correctly.
5.5.1 Page
Page number (counted from 1) to which the signature will be added.
5.5.2 Signature corners
Next four inputs Lower Left (X, Y) and Upper Right (X, Y) defines position of signature on the page.
You can fill in float numbers (with decimal places) as input. If you have already selected input PDF
in the main window you will see possible range for X and Y values on the right side of Lower Left
(X, Y) input fields.
Position of signature on page is bounded by lower left corner and upper right corner. Position of
elements in PDF has base on the left bottom corner of page([0,0]).
18 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
5.5.4 Display
In combobox Display you can set which fields will be generated to visible signature.
19 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
You can try following URLs of free timestamping servers for testing (doesn't require
authentication):
http://dse200.ncipher.com/TSS/HttpTspServer
http://tsa.starfieldtech.com
https://timestamp.geotrust.com/tsa
5.7 Certificate revocation checking
JSignPdf supports two standard ways of certificate revocation checking – CRL and OCSP. Most of
the X.509 certificates supports CRL, but it has some disadvantages (for instance the size of list and
possibly outdated information). The second – OCSP solves the mentioned issues, but not all
Certification Authorities (CA) supports this protocol.
20 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
5.7.1 CRL
RFC 3280, Internet X.509 Public Key Infrastructure, Certificate and Certificate Revocation List (CRL) Profile.
Wikipedia says: In the operation of some cryptosystems, usually public key infrastructures (PKIs), a
certificate revocation list (CRL) is a list of certificates (or more specifically, a list of serial numbers
for certificates) that have been revoked or are no longer valid, and therefore should not be relied
upon.
Such a list will be downloaded from CA and stored in PDF during signing process.
5.7.2 OCSP
RFC 2560, X.509 Internet PKI Online Certificate Status Protocol-OCSP.
Wikipedia says: The Online Certificate Status Protocol (OCSP) is an Internet protocol used for
obtaining the revocation status of an X.509 digital certificate. It is described in RFC 2560 and is on
the Internet standards track. It was created as an alternative to certificate revocation lists (CRL),
specifically addressing certain problems associated with using CRLs in a public key infrastructure
(PKI). Messages communicated via OCSP are encoded in ASN.1 and are usually communicated
over HTTP. The "request/response" nature of these messages leads to OCSP servers being termed
OCSP responders.
If OCSP is enabled in JSignPdf and the protocol is supported for the certificate, the OCSP request
will be created and response will be stored in signed PDF. The URL of OCSP server is retrieved
from certificate. If the OCSP part is not found in the signing certificate, the value from default
OCSP server URL field will be used.
5.8 Proxy settings
If some “online” feature (TSA, CRL, OCSP) is enabled and JSignPdf runs behind a firewall, you
can set the proxy, which will be used for all internet connections. Proxy type DIRECT means no
proxy will be used.
21 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
Some advanced options are not controlled from GUI or command line. They can be only set directly
in the appropriate configuration file.
6.1 conf.properties
The property file conf/conf.properties contain several option groups:
• visible signature font settings
• control the certificate checks
• PKCS#11 support
• enable more strict SSL handling
6.2 Java VM options using EXE launchers
If the Java VM properties has to be changed (e.g. maximum memory allowed) and the EXE
wrapper is used, you can edit the appropriate .l4j.ini file (e.g. JSignPdf.l4j.ini).
The arguments should be separated with spaces or new lines, environment variable expansion is
supported, for example:
22 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
7 Uninstall
This chapter describes how to uninstall/remove JSignPdf from a computer.
7.1 Windows uninstaller
Choose Programs → JSignPdf → Uninstall and confirm the uninstallation.
23 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
8 Solving problems
8.1 Out of memory error
If you will see OutOfMemoryError in the program console, you need to allow java to use more
memory.
Add -Xmx<size> switch to your java. Following example allows java to use 512MB (heap size).
$java -Xmx512m -jar JSignPdf.jar
8.1.1 OpenOffice.org/LibreOffice Add-On
Configure this parameter in Tools → Options... → OpenOffice.org/LibreOffice → Java by pressing
Parameters... button.
24 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
25 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
26 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
27 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
9.2 Examples
9.2.1 Simplest signature on windows
$ java -jar JSignPdf.jar -kst WINDOWS-MY mydocument.pdf
creates copy of mydocument.pdf with name mydocument_signed.pdf, which is digitally signed with
the first certificate found in default windows certificate store
9.2.2 PKCS12 signature with encryption
$ java -jar JSignPdf.jar -kst PKCS12 -ksf my_certificate.pfx -ksp
myPrivateKeystorePassword -ka cert23 -pe PASSWORD -opwd xxx123 -upwd 123xxx
-pr DISALLOW_PRINTING mydocument.pdf
creates signed and encrypted file mydocument_signed.pdf, printing of the new file is not allowed.
For signature is used key with alias cert23 from the file my_certificate.pfx
28 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
list names (aliases) of keys stored in my_certificate.pfx file using the password for keystore. Quiet
mode is enabled so no debug info is printed.
29 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
10.2 Verifier
usage: java -jar Verifier.jar [file1.pdf [file2.pdf ...]] [-c
<certificates>] [-e <folder>] [-ff <arg>] [-h] [-kf <file>]
[-kp <password>] [-kt <keystore_type>] [-lc] [-lk] [-p
<password>]
JSignPdf Verifier is a command line tool for verifying signed PDF
documents.
-c,--cert <certificates> use external semicolon
separated X.509 certificate
files
-e,--extract <folder> extract signed PDF revisions to
given folder
-ff,--fail-fast <arg> flag which sets the Verifier to
exit with error code on the
first validation failure
-h,--help print this message
-kf,--keystore-file <file> use given keystore file
30 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
10.3 SignatureCounter
usage: java -jar SignatureCounter.jar [file1.pdf [file2.pdf ...]] [-d]
[-h] [-n] [-p <password>]
JSignPdf SignatureCounter is a command line tool which prints count of
signatures in given PDF document.
-d,--debug enables debug output
-h,--help print this message
-n,--names print comma separated signature names
instead of the count
-p,--password <password> set password for opening PDF
31 / 32
JSignPdf Quick Start Guide
http://jsignpdf.sourceforge.net/ version 1.6.2
32 / 32