I am trying to encrypt files in 256 bit AES Encryption, cause screw Adobe for their $15 a month to do this...
I found the library PyPDF2 however this will only allow up to 128 bit with the following code:
from PyPDF4 import PdfFileWriter, PdfFileReader
out = PdfFileWriter()
file = PdfFileReader("input.pdf")
num = file.numPages
for i in range(num):
page = file.getPage(i)
out.addPage(page)
password = "password"
out.encrypt(password, password, True)
with open("out.pdf", "wb") as f:
out.write(f)
I also found this post however it does not deal with the pdf aspect to my knowledge, just encrypts the bytes. I would ideally want an output, password protected PDF that can be opened in acrobat or another reader, just without having to pay for the privilege of encrypting them.
I wondered if anyone was aware of, or knew how to change this module, a way to get 256 bit password encryption? Thanks!