简体   繁体   English

使用用户密码的itext pdf解密

[英]itext pdf decryption using user password

In itext, can we decrypt a pdf file using the user password that was used to encrypt the file? 在itext中,我们可以使用用于加密文件的用户密码解密pdf文件吗?

I know decryption can be done using owner password. 我知道可以使用所有者密码来解密。 What I want to achieve is: 我想要实现的是:

In my web application, keep pdf files in encrypted form. 在我的Web应用程序中,以加密形式保存pdf文件。 When the authorized user requests for a pdf file, then depending on the permissions (user's role), I send them a file with appropriate permissions - ALLOW_PRINTING, ALLOW_COPY etc. 当授权用户请求pdf文件时,然后根据权限(用户角色),我向他们发送具有相应权限的文件-ALLOW_PRINTING,ALLOW_COPY等。

What I am doing right now is I encrypt a file using OWNER and USER passwords and then decrypt it using OWNER password but then that file allows all actions - print, copy etc. 我现在正在做的是使用OWNER和USER密码加密文件,然后使用OWNER密码解密文件,但是该文件允许所有操作-打印,复制等。

Please help. 请帮忙。

Thanks, Deepak 谢谢,迪帕克

So far, I follow this page: http://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 到目前为止,我遵循以下页面: http : //www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/

And the tool qpdf works with only user password. 并且qpdf工具仅适用于用户密码。 Hope this would help you. 希望这对您有帮助。

For decryption, you can use PDFBox , see my answer here : https://stackoverflow.com/a/9976481/535203 对于解密,您可以使用PDFBox ,在这里查看我的答案: https : //stackoverflow.com/a/9976481/535203

I give a sample code to decrypt a PDF given its password. 我给出了一个示例代码,根据给定的密码解密PDF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM