pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Vacondio <andrea.vacon...@gmail.com>
Subject Troubles understanding encryption with PDFBox
Date Fri, 16 Nov 2012 15:45:49 GMT
Hi,
I'm having hard times understanding what is supposed to be the intended
behavior of PDFBox regarding encrypted files. What I'm trying to do is to
open an encrypted document, modify it, save it back (I attached my test
project). The three tests I made they all end up with a NPE but they work
if I turn on setAllSecurityToBeRemoved (and I don't want security to be
removed).
So first thing, please fix this, NPE are ugly an uninformative, they are
telling me nothing about what the problem is except that something is null
and it shouldn't (??).
First test:
1- input is a doc encrypted with owner pwd having the modify permission on.
2- The document is loaded and decrypted using owner pwd.
3- permissions.isOwnerPermission() is true which is correct
4- permissions.canModify() is true which is correct
5- modify the doc and save throws a NPE which is NOT correct

Second test
1- input is a doc encrypted with owner pwd having the modify permission on.
2- The document is loaded but not decrypted
3- permissions.isOwnerPermission() is true, why? I didn't provide any owner
pwd I should have owner permissions.
4- permissions.canModify() is true which is correct
5- modify the doc and save throws a NPE which is NOT correct

Third test
1- input is a doc encrypted with owner pwd having NO permission.
2- The document is loaded and decrypted using owner pwd.
3- permissions.isOwnerPermission() is true which is correct
4- permissions.canModify() is true, why? I can modify the doc because I
have owner permission but the Modify should be off.
5- modify the doc and save throws a NPE which is NOT correct

Could anyone help me understanding what is a bug and what is intended
behavior?
Thanks

Mime
View raw message