gpt4 book ai didi

gnupg - 使用 gpg 验证 .asc 文件而不导入 KEYS 文件。

转载 作者:行者123 更新时间:2023-12-04 15:40:05 29 4
gpt4 key购买 nike

我想创建脚本,将文件下载和 GPG 验证到我的 docker 镜像。来自 apache docs我明白了,为了验证,我需要做:

gpg --import KEYS
gpg --verify downloaded_file.tgz.asc downloaded_file.tgz

我想省略第一步,因为它更改了“某处的某些文件”。这里的原因是我想保持 docker 图像尽可能原封不动。我更喜欢简单地调用类似的东西: gpg --using-keys KEYS --verify file.tgz.asc file.tgz .是否可以?

我试过使用 --no-default-keyring --keyring KEYS如前所述 here ,但我无法正确解释输出(它打印 Can't check signature: public key not found 。当我删除 --no-default-keyring 时,输出似乎很好,但我以前导入了 KEYS 文件,但不知道如何取消导入以查看明确的结果)。

KEYS、.tgz 和 .tgz.asc 文件来自 Apache Kafka .

最佳答案

我是 gpg 的新手,所以请稍加保留,但这样的事情对我来说已经足够了。在 debian 和 gpg (GnuPG) 2.1.18 上测试:
test.asc是我们不想导入的公钥,test.tar.bz2.asc是用上述公钥签名的文件签名,test.tar.bz2是用于签名验证的文件。首先我要购买 key ,然后使用它们来验证文件签名:

gpg --dearmor ./test.asc
gpg --dearmor ./test.tar.bz2.asc
gpg --dry-run --no-default-keyring --keyring ./test.asc.gpg --homedir ./ --verify ./test.tar.bz2.asc.gpg ./test.tar.bz2

当然 gpg 提示签名不受信任并在当前文件夹中创建 trustdb:
gpg: WARNING: unsafe permissions on homedir '/tmp/./'
gpg: Signature made Mi 24 Apr 2019 21:52:46 CEST
gpg: using RSA key xxxxxxxxxxxxxxxx
gpg: /tmp/.//trustdb.gpg: trustdb created
gpg: Good signature from "example security <security@example.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

但这之后失败了:
gpg --dry-run  --homedir ./ --verify ./test.tar.bz2.asc.gpg ./test.tar.bz2
gpg --dry-run --verify ./test.tar.bz2.asc.gpg ./test.tar.bz2
gpg --verify ./test.tar.bz2.asc.gpg ./test.tar.bz2

所以我假设 key 没有导入到通常的 key 数据库中。

关于gnupg - 使用 gpg 验证 .asc 文件而不导入 KEYS 文件。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46072548/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com