如何使用收件人的电子邮件地址而不是指纹加密Python GNUPG(GPG)?
如何使用收件人的电子邮件地址而不是指纹加密Python-gnupg(gnupg / gpg / openPGP)?
示例 show 显示(在我的Ubuntu上失败了20.04/这样的事情,但这是一个旧的示例
encrypted_data = gpg.encrypt(unencrypted_string, '[email protected]')
; “> this 和 this )不要提及收件人电子邮件地址 - 在当今的环境中,仅(大概是)公开键的指纹是可能的227991/98033“> keyserver ?
我的测试。
How to Python-gnupg (GnuPG / GPG / OpenPGP) encrypt with recipient's email address rather than their fingerprint?
This example shows (which failes on my Ubuntu 20.04 / such a thing, but it's an old example; excerpt:
encrypted_data = gpg.encrypt(unencrypted_string, '[email protected]')
More-current (maybe?) references (like this and this) do not mention recipient email addresses, seemingly requiring numeric-only fingerprints for (presumably) public-key identication. Is it possible in today's environment (to identify a key solely by it's associated email_address/identity)? Possibly requiring a keyserver?
My tested python-gnupg system versions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看问题中的版本编号,您似乎正在使用 pretty-bad-protocol 重写,自2018年以来一直没有更新。
如果您只需安装
python-gnupg
:您获得版本
0.4.9
,该 ,几天前:使用此版本的
gnupg
模块,您的代码毫无问题地工作:使用指纹当然是更好的,因为您的钥匙扣中可能有多个键,并且您无法确定哪个键你会得到的。使用指纹确保您获得该特定键。
Looking at the version number in your question, you appear to be using the pretty-bad-protocol rewrite, which hasn't been updated since 2018.
If you simply install
python-gnupg
:You get version
0.4.9
, which was released just a few days ago:Using this version of the
gnupg
module, your code works without a problem:It is of course better to use a fingerprint, because you may have multiple keys in your keychain with the same email address, and you can't be certain which one you'll get. Using a fingerprint ensures that you get that specific key.