【发布时间】:2016-05-09 11:11:29
【问题描述】:
我正在编写一个使用gpg 加密文件的脚本。在命令行使用gpg 进行测试/实验期间,我发现了一些奇怪的行为。这工作得很好:
$ cat myFile.txt | gpg --encrypt -r 'jdoe@gmail.com'
gpg: B2D17635: There is no assurance this key belongs to the named user
pub 4096R/B2D17635 2016-01-31 John Doe (I am now a real person.) <jdoe@gmail.com>
Primary key fingerprint: B17F 98BA 1DA9 3FE1 A08F 1443 509D 87ED 32AF 2078
Subkey fingerprint: BB63 42DA 8FAD 194A E1C9 1F6D 39BA 73B9 B2D1 7635
It is NOT certain that the key belongs to the person named
in the user ID. If you *really* know what you are doing,
you may answer the next question with yes.
Use this key anyway? (y/N) y
�
Nϴ��[�mDZ.@�Bc���J������z�{p���%
<GIBBERISH SNIPPED>
i�)��/&N��t�Z�8�#�I<�Bq�!�K?�vQ�I�H6&+��(
但我不喜欢这样,因为我必须交互式地输入“y”。我希望它假设“是”并在不需要任何交互性的情况下进行加密。所以我使用--batch 和--yes 开关运行了以下命令。为什么失败了?
$ cat myFile.txt | gpg --encrypt --batch --yes -r 'jdoe@gmail.com'
gpg: B2D17635: There is no assurance this key belongs to the named user
gpg: [stdin]: encryption failed: unusable public key
【问题讨论】:
标签: gnupg