3

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

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

(对我来说,这个问题似乎很简单,而且是一个基本特征——但显然我无法让它发挥作用)

先感谢您!

4

2 回答 2

4

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

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...

快速说明:只是为了澄清,出于安全原因,一个人的密码和一个人的私钥应该给任何其他人。 密码短语是在私钥被泄露时保持“安全”。 一个人的公钥是唯一应该与他人共享的东西。

我以我目前只能访问版本 1.4.2.2,并且没有能力测试这些解决方案的事实作为开头。更高版本具有某些选项,很可能是需要的。 如果其中任何一项有效,请尝试回复。

--local-user/-u看起来很有希望。在我拥有的版本中,--help显示use this user-id to sign or decrypt 但尝试似乎徒劳无功,进一步的研究揭示了一个残酷的事实:似乎帮助是错误的,这只是用于“签名”的选项。

这篇文章有一个可能的解决方案,虽然我个人觉得它很乱:

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

--passphrase 显然是在 1.4.3 版本中添加的。啊!

编辑: 也许更好的(可能在下面)解决方案仅在 gpg2 中可用? ,如果我没看错,这可能是我们都在寻找的东西?gpg2 seems to have --try-secret-key

于 2013-12-14T09:12:04.057 回答
1

我今天也遇到了这个问题,我通过在批处理模式下运行 gpg 解决了这个问题:

/usr/bin/gpg --batch --passphrase "your_passphrase" --verbose --decrypt

于 2016-06-16T14:51:37.567 回答