You're right that PDFBox does not consider the revision. Code excerpt:

else if( isUserPassword(password.getBytes(passwordCharset), userKey, ownerKey,
                           dicPermissions, documentIDBytes, dicRevision,
                           dicLength, encryptMetadata) )
        {
            currentAccessPermission = new AccessPermission(dicPermissions);


"dicPermissions" is the value of the /Encrypt/P entry. "dicRevision" is the value of the /Encrypt/R entry and obviously, it isn't used when the AccessPermission is initialized.

I've not fully understood your text: what do you mean with 'bitwise "Encrypt Flag"' ? Do you mean the /Encrypt/P entry?

If you are working on something, please open an issue and submit the patch, so that the work isn't done twice.

I'd also be interested in a test file to better understand the problem.

Tilman

PS: The 1.8 version is outdated. Use 2.0.3.


Am 29.09.2016 um 22:51 schrieb Stan Ivaciov:
Thank you for a great PDF tool. We have come up against a small issue while testing encrypted documents with restrictions for filling out forms set.

The PDF spec, http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf, pages 59-61, describes that bit 9 "/can fill in form fields/" can only be considered by Security Handlers of revision 3 or greater. Older versions should rely on bit 6, see perm_spec.png^<https://jira.accusoft.com/secure/attachment/54791/54791_perm_spec.png>, perm_spec_Rev.png^<https://jira.accusoft.com/secure/attachment/54792/54792_perm_spec_Rev.png>

(The idea described in the spec is that granulation of permissions is extended with revision, and up to 2008 year it has 4 revisions, from 1 to 4, and our PDF sample has only 2-nd revision, which is seen by PDFBOX).

Could you please confirm our overall conclusion: PDFBox does not support this bit at the moment and to imitate Acrobat behaviour and fix this issue outside of PDFBox; we need to add a logic which would be considering both bitwise "Encrypt Flag" and the Revision Number of Security Handler.

Maybe this also could be an improvement in one of the future PDFBox release.


Best regards,

Stan



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to