如何对文件进行签名然后验证?
我正在编写一个应用程序,在该应用程序中我将文件同步到我想要签署该文件的服务器,然后将其发送回可以验证该文件的客户端。
Ubuntu/Debian 的 Python 似乎有多个 gnupg 模块:
python-gnupginterface - GnuPG (GPG) 的 Python 接口
python-gpgme - GPGME 库的 python 包装器
python-gpgme-dbg - GPGME 库的 python 包装器(调试扩展) )
python-pyme - GPGME GnuPG 加密库的 Python 接口
python-pyme-doc - GPGME GnuPG 加密库的 Python 接口
有人可以推荐我应该使用哪一个吗这能让我快速启动并运行吗?
我应该直接使用 gpg 而不是使用 Python 模块吗?
谢谢!
I am writing an application in which I sync a file to a server where I want to sign the file then send it back to the client where it can be verified.
There seem to be multiple gnupg modules for Python for Ubuntu/Debian:
python-gnupginterface - Python interface to GnuPG (GPG)
python-gpgme - python wrapper for the GPGME library
python-gpgme-dbg - python wrapper for the GPGME library (debug extension)
python-pyme - Python interface to the GPGME GnuPG encryption library
python-pyme-doc - Python interface to the GPGME GnuPG encryption library
Can someone recommend which I one I should use that gets me up and running quickly?
Should I just shell out to gpg instead of using a Python module?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
python-gpgme
(作为奖励,您可能认识维护者)。以下是如何使用它来签署某些内容(如果有更好的方法,请与 jamesh 联系,我没有广泛使用它):
如果不清楚,BytesIO 是一个类似文件的东西。您可以将
file("/etc/passwd")
作为普通格式,将sys.stdout
作为符号,它就是 DWYW。Use
python-gpgme
(as a bonus, you probably know the maintainer).Here's how you can use it to sign something (check with jamesh if there's a better way, I haven't use this extensively):
in case it's not clear, BytesIO is a file-like thing. You could give it
file("/etc/passwd")
as plain andsys.stdout
as sign and it'd DWYW.您可以使用 http://code.google.com/p/python-gnupg/
它包装了命令行 GnuPG。我用它来加密/签名和解密/验证文件。
You can use http://code.google.com/p/python-gnupg/
It wraps command line GnuPG. I use it to encrypt/sign and decrypt/verify files.