org.pdfbox.pdmodel.encryption |
The encryption package will handle the PDF document security handlers and the functionality of pluggable security handlers.
|
Java Source File Name | Type | Comment |
AccessPermission.java | Class | This class represents the access permissions to a document.
These permissions are specified in the PDF format specifications, they include:
- print the document
- modify the content of the document
- copy or extract content of the document
- add or modify annotations
- fill in interactive form fields
- extract text and graphics for accessibility to visually impaired people
- assemble the document
- print in degraded quality
This class can be used to protect a document by assigning access permissions to recipients. |
BadSecurityHandlerException.java | Class | This exception can be thrown by the SecurityHandlersManager class when
a document required an unimplemented security handler to be opened. |
DecryptionMaterial.java | Class | This class represents data required to decrypt PDF documents. |
PDEncryptionDictionary.java | Class | This class is a specialized view of the encryption dictionary of a PDF document. |
PDEncryptionManager.java | Class | This class will handle loading of the different security handlers. |
PDStandardEncryption.java | Class | This class holds information that is related to the standard PDF encryption. |
ProtectionPolicy.java | Class | This class represents the protection policy to apply to a document. |
PublicKeyDecryptionMaterial.java | Class | This class holds necessary information to decrypt a PDF document
protected by the public key security handler.
To decrypt such a document, we need:
- a valid X509 certificate which correspond to one of the recipient of the document
- the private key corresponding to this certificate
- the password to decrypt the private key if necessary
Objects of this class can be used with the openProtection method of PDDocument .
The following example shows how to decrypt a document using a PKCS#12 certificate
(typically files with a pfx extension).
PDDocument doc = PDDocument.load(document_path);
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(new FileInputStream(certificate_path), password.toCharArray());
PublicKeyDecryptionMaterial dm = new PublicKeyDecryptionMaterial(ks, null, password);
doc.openProtection(dm);
In this code sample certificate_path contains the path to the PKCS#12 certificate. |
PublicKeyProtectionPolicy.java | Class | This class represents the protection policy to use to protect
a document with the public key security handler as described
in the PDF specification 1.6 p104. |
PublicKeyRecipient.java | Class | Represents a recipient in the public key protection policy. |
PublicKeySecurityHandler.java | Class | This class implements the public key security handler
described in the PDF specification. |
SecurityHandler.java | Class | This class represents a security handler as described in the PDF specifications.
A security handler is responsible of documents protection. |
SecurityHandlersManager.java | Class | This class manages security handlers for the application. |
StandardDecryptionMaterial.java | Class | Represents the necessary information to decrypt a document protected by
the standard security handler (password protection). |
StandardProtectionPolicy.java | Class | This class represents the protection policy to add to a document
for password-based protection.
The following example shows how to protect a PDF document with password. |
StandardSecurityHandler.java | Class | The class implements the standard security handler as decribed
in the PDF specifications. |