encryption - GPG - 与多个收件人一起解密

标签 encryption gnupg

我正在尝试解密已使用 2 个收件人 (--recipient recipientA@example.com --recipient recipientB@example.com) 加密的文件。 但是,当我尝试解密文件时,它总是请求第一个收件人的密码。当第一个接收者 key 不是 key 环的一部分时,它会给出错误“找不到 key ”。

我如何加密具有多个收件人的文件,以便双方都可以在不知道彼此 key 和密码的情况下解密它们?

(对我来说,这个问题看起来很简单,而且是一个基本特征 - 但显然我无法让它工作)

提前致谢!

最佳答案

我今天遇到了这个问题,发现你的问题正在寻找答案。我见过很多关于如何为多个收件人加密的东西的例子......从不说/展示当一个人试图解密该数据时会发生什么。这是我得到的:

user@system ~ $ gpg --decrypt filename.pgp

You need a passphrase to unlock the secret key for
user: "SOMEBODY ELSE <somebody_else@example.com>"
2048-bit ELG-E key, ID ABC1234, created 1972-10-29 (main key ID ABC5678)

gpg: Invalid passphrase; please try again ... [I DON'T HAVE *THEIR* PASSPHRASE!]

2 more times... finally...

You need a passphrase to unlock the secret key for
user: "HEY!  This is ME! <my_email@example.com>"
2048-bit ELG-E key, ID DEF1234, created 1969-02-03 (main key ID DEF5678)

gpg: encrypted with 2048-bit ELG-E key, ID ABC1234, created 1972-10-29
      "NAME <email@example.com>"
gpg: public key decryption failed: bad passphrase
gpg: encrypted with 2048-bit ELG-E key, ID DEF1234, created 1969-02-03
      "HEY!  This is ME! <my_email@example.com>"

and then the file decrypted fine...

快速说明:为了澄清,for security reasons一个人的密码和一个人的 private key不应该永远给任何其他人。 The passphrase is to keep the private key "safe" should it become compromised.一个人的公钥是唯一应该与他人共享的东西。

首先要说明的是,我目前只能访问 1.4.2.2 版,无法测试这些解决方案。更高版本有某些选项很可能是需要的。 如果其中任何一项有效,请尝试回复。

--local-user/-u 看起来很有希望。在我的版本中,--help 显示了 use this user-id to sign or decrypt但当尝试似乎徒劳无功时,进一步的研究揭示了一个残酷的事实:seems the help is wrong , 这只是一个用于 "signing" 的选项.

This post有一个可能的解决方案,尽管我个人觉得它很困惑:

gpg --try-all-secrets --passphrase <passphrase here> filename.pgp

--密码 was apparently added in version 1.4.3 .啊!

编辑: Perhaps a better (possibly, below) solution is only available in gpg2? gpg2 seems to have --try-secret-key,如果我没看错,这可能就是我们都在寻找的东西?

关于encryption - GPG - 与多个收件人一起解密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19562185/

相关文章:

prompt - 禁止 GPG 命令中的密码提示

c++ - FileSink、StringSink、Filesource、StringSource Crypto++ 之间有什么区别

c# - 如何正确解密 C#.NET 中的 RSA 数据?

encryption - 从 MD5 哈希函数的特殊应用中恢复电子邮件地址

security - 当我尝试使用旧 key 时,gnupg 给我错误 "Invalid public key algorithm"

c++ - 从 C/C++ 和参数在 GnuPG 中生成公钥/私钥

swift - 3DES 加密结果与示例不同

pdf - poppler pdfunite 无法合并加密的 PDF 文件,如何去除加密? (无需密码即可打开)

dockerfile - 列出 key 时 Gpg 挂起(docker 安装)

windows - 批量使用密码的最佳做法是什么?