使用python提取pdf中的数字签名

sri*_*eni 6 python pdf

我需要获取数字签名的签名内容,例如签名名称和签名日期以及整个签名部分的坐标。

我尝试使用不同的模块,如 pypdf2、pdfminer 和 endesive 模块,这些 endesive 模块给出了该 pdf 文档中是否存在数字签名。

这是使用 endesive 模块获取签名是否存在的代码库。

   fname = 'filename'
   data = open(fname, 'rb').read()
   pdf.verify(data)

   The above code gives the following output.
   cert.issuer: OrderedDict([('common_name', 'Srikanth'), ('organization_name', ''), ('organizational_unit_name', ''), ('email_address', 'srikanth@yahoo.com'), ('country_name', 'India')])
cert.subject: OrderedDict([('common_name', 'Srikanth'), ('organization_name', ''), ('organizational_unit_name', ''), ('email_address', 'srikanth@yahoo.com'), ('country_name', 'India')])
Out[13]: (True, True, False)
Run Code Online (Sandbox Code Playgroud)

请参阅以下参考链接以获取示例数字签名: https://www.globalsign.com/en-in/blog/certifying-vs-approval-signatures-in-adobe/

我需要获取数字签名值,例如: 人名:Daniel Farrel 签名日期:2017.10.05 08.44.11 -04'00'

Jef*_*len 2

我对此进行了一些研究,您似乎一切都做对了。APIendesive不会返回签名者,它在内部使用它们,但作为调用者,您无权访问它们 [1]。

另外,请小心,因为该库似乎并未验证所有签名,仅验证第一个签名 [2]。

[1] https://github.com/m32/endesive/blob/master/endesive/verifier.py#L104

[2] https://github.com/m32/endesive/issues/124