Package com.pd4ml.pdf.encryption
Class PublicKeyDecryptionMaterial
- java.lang.Object
-
- com.pd4ml.pdf.encryption.DecryptionMaterial
-
- com.pd4ml.pdf.encryption.PublicKeyDecryptionMaterial
-
public class PublicKeyDecryptionMaterial extends DecryptionMaterial
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
- Author:
- Benoit Guillon
-
-
Constructor Summary
Constructors Constructor Description PublicKeyDecryptionMaterial(java.security.KeyStore keystore, java.lang.String a, java.lang.String pwd)
Create a new public key decryption material.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.cert.X509Certificate
getCertificate()
Returns the certificate contained in the keystore.java.lang.String
getPassword()
Returns the password given by the user and that will be used to open the private key.java.security.Key
getPrivateKey()
returns The private key that will be used to open the document protection.
-
-
-
Constructor Detail
-
PublicKeyDecryptionMaterial
public PublicKeyDecryptionMaterial(java.security.KeyStore keystore, java.lang.String a, java.lang.String pwd)
Create a new public key decryption material.- Parameters:
keystore
- The keystore were the private key and the certificate area
- The alias of the private key and the certificate. If the keystore contains only 1 entry, this parameter can be left null.pwd
- The password to extract the private key from the keystore.
-
-
Method Detail
-
getCertificate
public java.security.cert.X509Certificate getCertificate() throws java.security.KeyStoreException
Returns the certificate contained in the keystore.- Returns:
- The certificate that will be used to try to open the document.
- Throws:
java.security.KeyStoreException
- If there is an error accessing the certificate.
-
getPassword
public java.lang.String getPassword()
Returns the password given by the user and that will be used to open the private key.- Returns:
- The password.
-
getPrivateKey
public java.security.Key getPrivateKey() throws java.security.KeyStoreException
returns The private key that will be used to open the document protection.- Returns:
- The private key.
- Throws:
java.security.KeyStoreException
- If there is an error accessing the key.
-
-