Opens in a new tab
vmblog logo 2024 wht (updated)

How to Improve Your PDF Document Security

Share: 

David Marshall | Published: July 6, 2021

By Raf Hens, CTO iText

For many people in the world, interacting with PDF documents is a common occurrence. They might receive PDFs from their doctors, containing sensitive medical information; they might get them from business colleagues; they might download them from a website, such as a company brochure or a how-to manual; they can even be used for complex projects, like multi-chapter books. However people get these documents, the Portable Document Format (PDF) is an accepted way of preserving a document’s formatting and layout. Of course, the most common way people read a PDF document is by using a PDF viewer, such as Adobe Acrobat Reader or many modern web browsers.

But a lesser known fact is that PDF supports a number of security features that can prevent unauthorized access, remove parts of the document while leaving the rest unchanged, and even contain secure electronic signatures. Let’s look at the ways you can use these features to secure your PDF documents, and the data they contain.

Securing Your PDFs with Encryption

Encrypting PDF documents is relatively straightforward and has myriad applications. For example, you can encrypt PDFs to guard against IP theft, protect classified information, ensure regulatory compliance (i.e., HIPAA), and even protect confidentiality and privacy. PDF technology supports two encryption methods: passwords and certificates.

Passwords come in two types. The first is a user password (also called a document open password), which allows someone to open an encrypted PDF document, i.e. to gain access to the document content. The second is an owner password (also called a PDF permissions password) which handles other restrictions imposed on the document, e.g. disallowing a document to be printed or pages to be deleted. Obviously, once someone has access to the document content, it’s very difficult to fully enforce certain restrictions.

It’s important to note that when you specify a user password, the document is encrypted. And although the owner can specify an encryption strength if needed, such as AES-128 for backward compatibility with older PDF reader software, the default is AES-256 making it virtually impossible to decrypt the document without the password.

But PDF also supports another way to secure documents: through certificates. If you don’t want to specify a user password, you can encrypt the document with the user’s public key. That way, when they receive the document, they can easily decrypt it using the private key of their key pair. This encryption method is based on public-key cryptography which employs an asymmetric key pair system (i.e., you cannot decrypt an encrypted document with the same key; you must have the other key of the key pair to decrypt). In combination with a public key infrastructure (PKI), in which keys are tied to entities (e.g. by a trusted party, a certificate authority), this also serves as an important part of identity verification. If I sign a document using my private key, the receiver, who has my public key, can guarantee that the document came from me.

Redacting Content to Protect Your PDF

Even if you are employing encryption methods, you may also need to redact certain content elements within the document. Redaction means that you’re removing parts of the content and optionally replacing it with some visual indicator, such as the classic black bar. It’s important to understand that redaction is more than just “covering” up text or other elements. Anyone with even a basic knowledge of PDF technology can circumvent this naive approach to redaction and see what’s underneath the black bars. True redaction means processing the document to remove the covered data straight from the PDF syntax, leaving no trace of the original content. So even if someone were to “crack” the PDF and delete the redactions, there would be nothing underneath to see!

Document Security through PDF Signatures

Many people, through a variety of document-signing platforms , have experienced signing PDFs digitally. This feature of PDF documents has several important use cases: protecting the document against tampering, validating the signer to ensure non-repudiation, and speeding transactions at reduced cost with greater transparency. In short, this method of securing your PDFs is less about a restriction of access and more a focus on the security of content. This method clearly flags document tampering with a warning of the modification. 

Employing this security feature utilizes hashing which can guarantee the integrity of a document. When a document is hashed, it produces a specific output (the “digest”). The hashing of that document will always produce the same digest when the same cryptographic algorithm is used (e.g., SHA-256). If the document is changed in any way, the hash will also be different as the data has been changed. By comparing the hash of a document when it was produced and delivered for signature with the hash of that same document when it is received tells the reader whether or not the PDF was modified after it was signed.

Taking a Layered Approach to Security

Document security requires a comprehensive, multi-layered approach. The security features in PDF-any of the methods described above-can be part of that and help keep your PDFs secure. Applying security to a PDF document doesn’t have to be difficult or require expensive software licensing. iText provides a comprehensive suite of libraries which can be integrated into any software to provide PDF generation and security functionality. What’s more, this suite of PDF features can be accessed programmatically, via iText’s API, so that users can generate and secure PDFs from within web applications.

Don’t Make PDF Security an Afterthought

PDFs are important to business and might contain sensitive or personal information. They might be legally-binding agreements that need to be signed. Whatever the case, not securing your PDFs when they need some level of protection is just inviting trouble. With iText’s proven open-source technologies, organizations no longer have to leave PDF security to chance. iText supports programmatic integration, PDF generation and document and data security. Its use can be incorporated smoothly into existing workflows so that documents are better protected and normal business rules are properly supported.

PDF Security through Open Source Technology

The iText PDF library began as an open-source project over 20 years ago and continues to be available as open source today. All the features and functionality we’ve discussed in this article are included in iText 7 Core, the latest iteration of our tried and tested PDF library. Used by millions of developers in open source and commercial applications worldwide, its security features (including digital PDF signatures) and PDF compliance are second to none.

iText 7 is available for Java and .NET and can be freely used under the terms of the AGPL license, while commercial licensing is available with the added benefit of expert support from our in-house developers. 

iText 7 Core Java on GitHub / Maven

iText 7 Core .NET on GitHub / NuGet

To test the full iText PDF Suite, which includes iText 7 Core and all of its add-ons under the terms of our commercial license, you can visit our website for a free trial.

##

ABOUT THE AUTHOR

Raf Hens 

Raf Hens is the CTO of iText. As an early employee of the company, Raf has grown with iText and is a passionate supporter of using PDF as a container for properly organized data. As an avid proponent of standards and digital documents, he sits on the ISO committees for PDF to help create standards for the industry. When he is not working at iText, you can find Raf spending time with his family.