Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.encryption

public Class PublicKeyDecryptionMaterial

extends DecryptionMaterial
Class Inheritance
Imports
java.security.Key, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .UnrecoverableKeyException, java.security.cert.X509Certificate, java.util.Enumeration

This class holds necessary information to decrypt a PDF document protected by the public key security handler. To decrypt such a document, we need:
Author
Benoit Guillon

Field Summary

Modifier and TypeField and Description
private final String
private final KeyStore
private final String

Constructor Summary

AccessConstructor and Description
public
PublicKeyDecryptionMaterial(KeyStore
The keystore were the private key and the certificate are
keystore
,
String
The alias of the private key and the certificate. If the keystore contains only 1 entry, this parameter can be left null.
a
,
String
The password to extract the private key from the keystore.
pwd
)

Create a new public key decryption material.

Method Summary

Modifier and TypeMethod and Description
public X509Certificate

Returns:

The certificate that will be used to try to open the document.
getCertificate
()

Returns the certificate contained in the keystore.

public String

Returns:

The password.
getPassword
()

Returns the password given by the user and that will be used to open the private key.

public Key

Returns:

The private key.
getPrivateKey
()

returns The private key that will be used to open the document protection.

Field Detail

aliasback to summary
private final String alias
keyStoreback to summary
private final KeyStore keyStore
passwordback to summary
private final String password

Constructor Detail

PublicKeyDecryptionMaterialback to summary
public PublicKeyDecryptionMaterial(KeyStore keystore, String a, String pwd)

Create a new public key decryption material.

Parameters
keystore:KeyStore

The keystore were the private key and the certificate are

a:String

The alias of the private key and the certificate. If the keystore contains only 1 entry, this parameter can be left null.

pwd:String

The password to extract the private key from the keystore.

Method Detail

getCertificateback to summary
public X509Certificate getCertificate() throws KeyStoreException

Returns the certificate contained in the keystore.

Returns:X509Certificate

The certificate that will be used to try to open the document.

Exceptions
KeyStoreException:
If there is an error accessing the certificate.
getPasswordback to summary
public String getPassword()

Returns the password given by the user and that will be used to open the private key.

Returns:String

The password.

getPrivateKeyback to summary
public Key getPrivateKey() throws KeyStoreException

returns The private key that will be used to open the document protection.

Returns:Key

The private key.

Exceptions
KeyStoreException:
If there is an error accessing the key.