Thanks a lot Tilman .. I will try that 😊
Best regards, Hesham -------------------------------------------------------------------------------------------------- Included Message: It is possible for older encryption (not AES256): get the source code and have a look at StandardSecurityHandler.java. There is a segment where "isOwnerPassword()" is called, and a bit later, "computedPassword" is calculated by calling getUserPassword(). I tried this by debugging with out test files and yes I got the user password. So you could do it by 1) get length, revision and owner key from the PDEncryption object you get by calling document.getEncryption() 2) check that revision is smaller then 5, and 3) call getUserPassword(). Tilman Am 03.01.2018 um 09:29 schrieb Hesham Gneady: > Hello, > > > > I have a PDF file that has an owner password & user password. I'd like > to decrypt it using the owner password, make some modifications to it, > then encrypt it back and save it. I did the first part successfully, > but how can I encrypt it again using the same encryption settings it > had, which I don't actually know? . For example, I know only the owner > password, but not the user password. > > > > > > Best regards, > > Hesham > > > > > > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

