pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duane Nickull <du...@technoracle-systems.com>
Subject Re: AES Encryption Example? (PDFBox)
Date Thu, 25 Oct 2012 00:38:21 GMT
Hi John:

Plenty of thoughts actually.  As someone who used to work for almost a
decade in the LiveCycle BU at Adobe and also is very familiar with Dr.
Rinjdael's four rounds of non-linear substitution (aka "AES") and it's
application to PDF documents, I thought about this a lot.

I just have not had time to test the AES capabilities of PDFBox.  I
briefly looked at org.apache.pdfbox.encryption and found that mosts of the
DocumentEncryption and PDFEncryption classes were marked deprecated with
no hint towards what to use.

There is also not much under org.apache.pdfbox
Class Encryptjava.lang.Object
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=
true> org.apache.pdfbox.Encrypt

What packages are you looking under?  I found this page here and am
working through it as I also need this functionality.

http://pdfbox.apache.org/apidocs/org/apache/pdfbox/pdmodel/encryption/packa
ge-summary.html

Duane Nickull


***********************************
Technoracle Advanced Systems Inc.
Consulting and Contracting; Proven Results!
i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
b. http://technoracle.blogspot.com
t.  @duanechaos
"Don't fear the Graph!  Embrace Neo4J"






On 2012-10-23 11:53 AM, "John Dhabolt" <mycolab@yahoo.com> wrote:

>No thoughts?
>
>Thanks in advance!
>
>
>
>________________________________
> From: John Dhabolt <mycolab@yahoo.com>
>To: "users@pdfbox.apache.org" <users@pdfbox.apache.org>
>Sent: Monday, October 15, 2012 4:53 PM
>Subject: AES Encryption Example?
> 
>Hi,
>
>
>I've pretty much exhausted my Google search skills in trying to find any
>posts covering AES encryption with PDFBox. I'm looking for the simplest
>implementation.
>
>It appears I need a StandardSecurityHandler or PublicKeySecurityHandler
>and apparently the StandardProtectionPolicy (which is well documented in
>the Encrypt class), but I keep trying to bang them together and nothing
>useful happens.
>
>In one of my clearly naive attempts I do something like this (the only
>thing that isn't based on the Encrypt example is the attempt to use the
>StandardSecurityHandler...obviously incorrectly):
>
>StandardSecurityHandler ssh = new StandardSecurityHandler(spp);
>ssh.setKeyLength(KEY_LENGTH);
>ssh.setAES(true);
>
>AccessPermission ap = new AccessPermission();
>// set various permissions
>
>StandardProtectionPolicy spp = new
>StandardProtectionPolicy(OWNER_PASSWORD, null, ap);
>spp.setEncryptionKeyLength(KEY_LENGTH);
>
>document.setSecurityHandler(ssh); // Seems to be the way to set a
>security handler
>document.protect(spp); // Completely ignores AES (I get the default
>128-bit RC4 encryption)
>
>As noted in the comments above, this correctly locks the PDF but sets
>128-bit RC4 encryption as opposed to AES.
>
>Thanks in advance for any suggestions.
>
>John



Mime
View raw message