Q: I’m having a problem with adding a password to a pdf file. When I
create a PDFViewSecurityHandler with a key length of 40 and the RC4
encryption mode I am unable to open the file in Adobe Acrobat. It
just says the password is invalid. If I use a key length of 128 and
RC4 or AES then it works fine. Do you know why it is failing with 40
bit RC4?
---------------
A:
If you select StdSecurityHandler(40, 1) you need to set the algorithm
revision to '2' because Acrobat 3 didn't support the full permission
set that was available in later versions of PDF.
For example:
StdSecurityHandler new_handler = new StdSecurityHandler(40, 1);
new_handler.ChangeRevisionNumber(2);
new_handler.ChangeUserPassword("user");
new_handler.ChangeMasterPassword("owner");
StdSecurityHandler constructor accepting AlgorithmType.e_RC4_40
automatically calls ChangeRevisionNumber(2).
For examle:
StdSecurityHandler new_handler = new
StdSecurityHandler(SecurityHandler.AlgorithmType.e_RC4_40);