我正在尝试将我的GPG公钥添加为设备安装过程的一部分。它的目的是在管理员使用管理门户将任何重要文件(如日志)拉入本地之前对其进行加密,然后使用私钥对其进行解密。我们的计划是将公钥导出到一个文件中,并使用gpg --import命令使设备安装过程导入公钥。但我意识到,在进行任何加密之前,需要对密钥进行信任/签名。如何在安装时不进行任何人工干预的情况下使该密钥可信?顺便说一句,我们的设备操作系统是ubuntu vm,我们使用kickstart进行自动化。
提前感谢大家的帮助。
发布于 2013-06-16 14:01:29
您的问题实际上是“我如何加密一个密钥,而不会因为密钥不可信而让gpg望而却步?”
一个答案是你可以在密钥上签名。
gpg --edit-key YOUR_RECIPIENT
sign
yes
save另一种是你可以告诉gpg去信任它。
gpg --encrypt --recipient YOUR_RECIPIENT --trust-model always YOUR_FILE发布于 2014-07-03 08:20:24
巧合的是,我的情况与OP类似--我试图使用公钥/私钥为不同嵌入式设备的固件签名和加密。由于还没有答案显示如何向您已经导入的密钥添加信任,下面是我的答案。
在测试机器上创建并测试密钥后,我将它们导出为ascii:
$ gpg --export -a <hex_key_id> > public_key.asc
$ gpg --export-secret-keys -a <hex_key_id> > private_key.asc然后安全地将它们复制并导入到构建服务器:
$ gpg --import public_key.asc
$ gpg --import private_key.asc重要:添加信任
现在编辑密钥以添加终极信任:
$ gpg --edit-key <user@here.com>在gpg>提示符下,键入trust,然后键入5表示最终信任,然后键入y确认,然后键入quit。
现在使用测试文件对其进行测试:
$ gpg --sign --encrypt --yes --batch --status-fd 1 --recipient "recipient" --output testfile.gpg testfile.txt哪些报告
...
[GNUPG:] END_ENCRYPTION在不添加信任的情况下,我得到了各种错误(不限于以下内容):
gpg: There is no assurance this key belongs to the named user
gpg: testfile.bin: sign+encrypt failed: Unusable public key发布于 2016-02-13 05:55:29
有一种更简单的方法来告诉GPG信任它的所有密钥,方法是使用-- trust -model选项:
gpg -a --encrypt -r <recipient key name> --trust-model always从手册页:
--trust-model pgp|classic|direct|always|auto
Set what trust model GnuPG should follow. The models are:
always Skip key validation and assume that used
keys are always fully trusted. You generally
won't use this unless you are using some
external validation scheme. This option also
suppresses the "[uncertain]" tag printed
with signature checks when there is no evidence
that the user ID is bound to the key. Note that
this trust model still does not allow the use
of expired, revoked, or disabled keys.https://stackoverflow.com/questions/13116457
复制相似问题