数字签名签名时间

问题描述 投票:0回答:1

目前我正在使用

pyopenssl
来提取证书信息和验证链。但为了进行过期检查,我需要提取二进制/证书的签名时间。

有没有办法在Linux环境中提取这些信息?

python cryptography certificate digital-signature
1个回答
2
投票

我同样需要获取 pe_file(Windows 二进制)签名的时间。

我花了一段时间才弄清楚如何使用

signify
和 python 来获取此信息。他们的关键是弄清楚如何遵循和使用此处
signify
文档中的图表:https://signify.readthedocs.io/en/latest/authenticode.html#pkcs7-objects

看这个例子:

from signify.authenticode.signed_pe import SignedPEFile

pathname = r"SoftwareUpdate.exe"

with open(pathname, "rb") as f:
    pefile = SignedPEFile(f)
    print(list(pefile.signed_datas)[0].signer_infos[0].countersigner.signing_time)

我在 Ubuntu 上针对 signify 项目中的

SoftwareUpdate.exe
测试文件进行了测试:

tools/Python$ curl -O https://raw.githubusercontent.com/ralphje/signify/master/tests/test_data/SoftwareUpdate.exe
tools/Python$ python3 get_pefile_signify_time.py
2008-07-25 22:21:53+00:00

Windows 的屏幕截图:

上面的代码片段在这里:https://github.com/jgstew/tools/blob/master/Python/get_pefile_signify_time.py

这是我用来解决这个问题的脚本:https://github.com/jgstew/tools/blob/master/Python/get_pefile_signify.py

文件夹中还有其他与 pefile 相关的示例。

相关:

© www.soinside.com 2019 - 2024. All rights reserved.