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. @see org.apache.pdfbox.pdmodel.PDDocument#openProtection(DecryptionMaterial) @author Benoit Guillon (benoit.guillon@snv.jussieu.fr) @version $Revision: 1.2 $
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. @see org.pdfbox.pdmodel.PDDocument#openProtection(DecryptionMaterial) @author Benoit Guillon (benoit.guillon@snv.jussieu.fr) @version $Revision: 1.2 $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|