我今天遇到了这个问题,发现你的问题正在寻找答案。我已经看到很多关于如何为多个收件人加密 事物的示例......从不说/展示当一个人尝试解密该数据时会发生什么。这是我得到的:
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. 一个人的 public 密钥是唯一应该与他人共享的东西。
我以我目前只能访问版本 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
--passphrasewas 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,如果我没看错,这可能是我们都在寻找的东西?