[英]Retrieving digital signature information from a PDF file using Python
I am looking for a direction on how to retrieve the digital signature information in a PDF (signer details, date of signature, issuer, etc) with Python 2.7.我正在寻找有关如何使用 Python 2.7 检索 PDF 中的数字签名信息(签名者详细信息、签名日期、发行者等)的方向。 Do I need to use a signature module like django-endesive (not the endesive since I think its , or can I retrieve it while reading a file?
我是否需要使用像 django-endesive 这样的签名模块(不是 endesive,因为我认为它,或者我可以在读取文件时检索它吗?
Currently the user adds the signature via an external program, locally, and then uploads the file to the server via the application and encrypts it with pycrypto.目前用户通过外部程序在本地添加签名,然后通过应用程序将文件上传到服务器并使用pycrypto对其进行加密。
Is it possible to retrieve that information during -say- reading the file before encryption and how can I go about that?是否可以在加密之前读取文件期间检索该信息,我该如何处理?
Below is the code I use to encrypt a file:下面是我用来加密文件的代码:
encryptor = AES.new(key, AES.MODE_CBC, IV)
with open(filename, "rb") as infile:
if not os.path.isfile(outFile):
with open(outFile, "wb") as outfile:
outfile.write(filesize)
outfile.write(IV)
while True:
chunk = infile.read(chunksize)
if len(chunk) == 0:
break
elif len(chunk)%16 !=0:
chunk += ' ' * (16 - (len(chunk)%16))
outfile.write(encryptor.encrypt(chunk))
你可以使用pyhanko
。
pyhanko sign validate --pretty-print test.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.