Now that I've done the encryption, I'm trying to decrypt (imagine that). My goal is to read in an encrypted File, and write out that same file without the encryption. I've tried a few different things, and I seem to be very close. The file I write out can be opened in Adobe Acrobat Reader and it displays without entering a password, however if I read in the file with PDFBox, doc.isEncrypted() will return true. I opened it in a hex editor and it does look like it's encrypted, so I'm guessing what's happening is that it's being encrypted with an empty password. I wanted to just remove the encryption all together. Here's my code:
AccessPermission ap = new AccessPermission(); StandardProtectionPolicy spp = new StandardProtectionPolicy(null, null, ap); StandardDecryptionMaterial sdm = new StandardDecryptionMaterial(password); StandardSecurityHandler ssh = new StandardSecurityHandler(spp); ssh.decryptDocument(doc, sdm); doc.protect(spp); doc.save(fos); I tried it without doc.protect(spp) but then the old policy still applied so it was still encrypted and the password was still needed to open it. Anyone know how to completely remove the encryption. --Adam ? Click here to submit conditions This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.