Skip to main content
Skip table of contents

Addendum to Digital signatures for PDF documents - iText 5 Documentation

The Digital Signatures for PDF documents eBook has been one of our most popular downloads since it was written. Although many of the principles and concepts remain the same, iText itself has changed a great deal over the years.

The code snippets included in the eBook were accompanied by complete examples which we made available on our website. As these examples were originally written for iText 5/iTextSharp, they have been completely updated and rewritten for the latest versions of iText. This meant significant changes in some cases, and some examples were no longer applicable.

This addendum links to pages with updated Java and .NET (C#) examples for each chapter of the eBook, and the table below notes the name of the example and which chapter the code example corresponds to:

Example Name

Description and Notes

Chapter 1

Understanding the concept of digital signatures

DigestDefault

An example showing how to use the MessageDigest class

DigestBC

An example demonstrating the use of the Bouncy Castle library

EncryptDecrypt

An example of a simple class to encrypt and decrypt messages

Chapter 2

PDF and digital signatures

SignHelloWorld

A simple example of adding a visible signature to a document

SignHelloWorldWithTempFile

Signing a document using a temporary file to avoid OutOfMemoryExceptions with large PDFs

SignEmptyField

Signing an empty text field with iText

CreateEmptyField

Creating an empty text field with iText

CustomAppearance

Creating a custom appearance for the signature by adding a grey background

SignatureAppearance

Creating custom text, custom fonts and using right-to-left writing in a signature

SignatureAppearances

Adding a custom image

SignatureMetadata

Adding metadata to the signature dictionary

SignatureTypes

Ordinary (approval) and Certification (author) signatures

SequentialSignatures

Sequential signatures in PDFs

SignatureWorkflow

An example where multiple signatures are required

LockFields

Locking fields and documents after signing

Chapter 3

Certificate Authorities, certificate revocation and time stamping

SignWithCAcert

Signing a document with a PKCS12 file from the CAcert Certificate Authority

GetCrlUrl

Getting the Certificate Revocation List (CRL) URLs from a certificate chain

SignWithCRLDefaultImp

Using the default CrlClient implementation

SignWithCRLOnline

Getting the CRL online

SignWithCRLOffline

Creating a CrlClient using an offline copy of the CRL

GetOcspUrl

Fetching the Online Certificate Status Protocol (OCSP) URL from a certificate

SignWithOCSP

Signing a document with the OCSP

GetTsaUrl

Extracting a Time Stamping Authority (TSA) URL from a certificate

SignWithTSA

Signing a document with TSAClientBouncyCastle, an implementation of TSAClient

SignWithTSAEvent

Adding an event to a TSAClientBouncyCastle instance

SignWithToken

Signing a document with a USB token using Microsoft CryptoAPI (MSCAPI) - currently only available for Java

SignWithEstimatedSize

Estimating the size in bytes of the signature content

Chapter 4

Creating signatures externally

SignWithPKCS11HSM

Signing a document with PKCS#11 using a Hardware Security Module (HSM) - currently only available for Java

SignWithPKCS11USB

Signing a document with PKCS#11 using a USB token - currently only available for Java

SignWithPKCS11SC

Signing a document with PKCS#11 using a BEID - currently only available for Java

ClientServerSigning

Signing a document on the client using a signature created on the server

ServerClientSigning

Signing a document on the server using a signature created on the client

DeferredSigning

Signing a document by creating a blank signature container, creating a signature appearance on the server and getting a hash to send to the client (deferred signing)

Chapter 5

Validation of signed documents

SignatureIntegrity

Checking the validity of a signature

SignatureInfo

Retrieving information from a signature

CertificateValidation

Validating the certificates of a signature

If you need the original iText5/iTextSharp equivalent code examples, you’ll find them linked below.

Code examples for iText5/iTextSharp

Digital signatures - chapter 1 - iText 5 Documentation

Digital signatures - chapter 2 - iText 5 Documentation

Digital signatures - chapter 3 - iText 5 Documentation

Digital signatures - chapter 4 - iText 5 Documentation

Digital signatures - chapter 5 - iText 5 Documentation

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.