Python gnupg无法验证独立签名的文件

发布于 2025-01-25 14:08:05 字数 409 浏览 1 评论 0原文

我已经使用命令行和以下命令签署了一个文件:

gpg - 输出doc.sig -detach-sig“ import json.py”

当我使用以下python脚本来验证相同的相同时使用doc.sig的文件始终返回未经验证,我不确定我在做什么错。

Python脚本:

import gnupg 
import tempfile



gpg = gnupg.GPG('/usr/local/bin/gpg')

verified = gpg.verify_file('doc.sig','import json.py')


print ("Verified" if verified else "Unverified")

I have detach signed a file using command line and the following command:

gpg --output doc.sig --detach-sig "import json.py"

When I use the following python script to verify the same file using the doc.sig it always returns unverified and I am not sure what I am doing wrong.

Python Script:

import gnupg 
import tempfile



gpg = gnupg.GPG('/usr/local/bin/gpg')

verified = gpg.verify_file('doc.sig','import json.py')


print ("Verified" if verified else "Unverified")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云裳 2025-02-01 14:08:05

好的,上述问题的答案是您要确保没有多个GNUPG/GPG安装。

只有一个python-gnupg安装。

Okay, the answer to the above problem is that you want to make sure you don't have multiple gnupg/gpg installations.

Just one python-gnupg install.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文