decrypting pdf protected by aes-256bit using the right password [closed]
-
22-07-2019 - |
Question
Is there any way to decrypting a pdf protected by an aes-256 bit key?
I have the correct password and I need a command-line tool (or library - perhaps in python :P ) for decrypting the file and then doing some operation over it.
The best thing could be if the file could be saved decrypted, then I elaborate it and then I can remove it...
Does anyone know something about it?
Solution
import pyPdf
pdf = pyPdf.PdfFileReader(open("file.pdf"))
pdf.decrypt("password")
You can then do whatever you want with the contents. This will work with either the user or owner passwords.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow