【问题标题】:where can I find the public key for Gnu Emacs?我在哪里可以找到 Gnu Emacs 的公钥?
【发布时间】:2011-04-18 10:13:53
【问题描述】:

我从23.1到23.3只用了半年的emacs。

每次我试图找到 emacs 的 gpg 公钥以便我可以使用每个新版本发布的 tar.gz.sig 来检查 tar.gz 包时,我都失败了。

看来我应该先获取公钥,我搜索了emacs的网站,但没有找到标志......

我只能在邮件列表中找到 SHA1 校验和 http://lists.gnu.org/archive/html/info-gnu-emacs/2011-03/msg00000.html 做完整性检查

我该怎么做?

【问题讨论】:

    标签: emacs gnupg


    【解决方案1】:

    如果您尝试使用验证签名

    gpg --verify <pkg>.key
    

    你会得到如下输出:

    gpg: Signature made 02/17/05 14:02:42 GTB Standard Time using DSA key ID BE216115
    gpg: Can't check signature: No public key
    

    您要查找的密钥 ID 是 BE216115,因此您要求 gpg 使用以下命令检索它:

    gpg --recv-keys BE216115
    

    这导致我的安装出现以下情况:

    gpg: requesting key BE216115 from hkp server keys.gnupg.net
    gpg: key BE216115: public key "Francesco Potortì <pot@potorti.it>" imported
    gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
    gpg: depth: 0  valid:   1  signed:   1  trust: 0-, 0q, 0n, 0m, 0f, 1u
    gpg: depth: 1  valid:   1  signed:   6  trust: 0-, 0q, 0n, 0m, 1f, 0u
    gpg: depth: 2  valid:   6  signed:   1  trust: 0-, 0q, 0n, 6m, 0f, 0u
    gpg: Total number processed: 1
    gpg:               imported: 1
    

    现在,您可以验证它了。但是由于您没有为此密钥分配任何信任,因此输出将是:

    gpg: Signature made 02/17/05 14:02:42 GTB Standard Time using DSA key ID BE216115
    gpg: Good signature from "Francesco Potortì <pot@potorti.it>"
    gpg:                 aka "Francesco Potortì <pot@gnu.org>"
    gpg:                 aka "Francesco Potortì <Potorti@isti.cnr.it>"
    gpg:                 aka "Francesco Potortì <pot@softwarelibero.it>"
    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: 4B02 6187 5C03 D6B1 2E31  7666 09DF 2DC9 BE21 6115
    

    因此,您将知道签名是有效的,但您不信任公钥。您可以使用以下方式信任或签署公钥:

    gpg --edit-key BE216115
    

    在命令提示符下键入help 以查看所有可用选项。如需更多信息,请参阅Using the GNU Privacy Guard

    【讨论】:

    • 我怎么知道我可以信任你(BE216115 是关键)?同样简单地信任任何添加的密钥似乎也不是一个好习惯。
    【解决方案2】:

    GNU 密钥环位于https://ftp.gnu.org/gnu/gnu-keyring.gpg

    您可以使用

    在本地(下载后)导入它们
    gpg --import gnu-keyring.gpg
    

    【讨论】:

    • 谢谢。接受的答案没有指定没有密钥服务器时要做什么。
    • 仅仅验证下载是不是有点矫枉过正?
    • @JeffBurdges 如果您要下载软件,然后安装并运行(可能以 root 身份),那么验证它是否是正确的软件似乎是合理的。
    【解决方案3】:

    @vhallac 的答案现在已过时(我正在尝试验证 emacs-24.4 下载)。如果您不想下载和导入整个 GNU 密钥环(正如 @JSON 所讨论的那样),这里有一种方法可以完成此操作。在这个答案中,我将展示今天有效的方法,以及如何确定一年后有效的方法。

    首先下载 emacs 及其 .sig 文件。我有:

    $ ls | grep emacs
    emacs-24.4.tar.xz
    emacs-24.4.tar.xz.sig
    

    假设您已经安装了 gpg,请尝试验证它:

    $ gpg --verify emacs-24.4.tar.xz.sig 
    gpg: Signature made Mon 20 Oct 2014 02:58:21 PM EDT using RSA key ID A0B0F199
    gpg: Can't check signature: public key not found
    

    在此尝试中,它失败了(您将在本文末尾看到成功的尝试)。我没有公钥。输出告诉您需要获取哪个公钥:A0B0F199。 (这是未来最有可能改变的事情。)

    然后我尝试使用默认命令下载它:

    $ gpg --recv-keys A0B0F199
    gpg: requesting key A0B0F199 from hkp server keys.gnupg.net
    (...hangs here...)
    

    它只是挂起。那是因为我有ufw(我的 Linux 防火墙软件)阻止了大多数端口。您可以告诉 gpg 使用端口 80,如下所示:

    $ gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys A0B0F199
    gpg: requesting key A0B0F199 from hkp server keys.gnupg.net
    gpgkeys: key A0B0F199 not found on keyserver
    gpg: no valid OpenPGP data found.
    gpg: Total number processed: 0
    

    它通过了防火墙,但由于某种原因,Emacs/FSF 密钥不再存储在 gnupg 服务器上而失败。所以我尝试了另一个我知道并且有一定程度信任的密钥服务器:

    $ gpg --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys A0B0F199
    gpg: requesting key A0B0F199 from hkp server pool.sks-keyservers.net
    gpg: key A0B0F199: public key "Glenn Morris <rgm@gnu.org>" imported
    gpg: Total number processed: 1
    gpg:               imported: 1  (RSA: 1)
    

    好的,成功了。现在检查一下:

    $ gpg --list-keys
    ...
    pub   2048R/A0B0F199 2012-12-23 [expires: 2015-12-23]
    uid                  Glenn Morris <rgm@gnu.org>
    sub   2048R/951C59EC 2012-12-23 [expires: 2015-12-23]
    

    是的,明白了。

    现在我可以验证下载的 emacs tarball:

    $ gpg --verify emacs-24.4.tar.xz.sig 
    gpg: Signature made Mon 20 Oct 2014 02:58:21 PM EDT using RSA key ID A0B0F199
    gpg: Good signature from "Glenn Morris <rgm@gnu.org>"
    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: B294 26DE FB07 724C 3C35  E5D3 6592 E9A3 A0B0 F199
    

    签名是“好的”,但不受信任。请参阅其他答案以了解如何信任该密钥。

    【讨论】:

    • 您可以创建一个 gpg.conf 文件,其中包含密钥服务器 keyserver hkp://pool.sks-keyservers.net:80 的一行。将此 gpg.conf 文件放入 ~/.gnupg(在类 unix 环境下)或放入 c:/Users/USERNAME/AppData/Roaming/gnupg 在 Windows 下
    【解决方案4】:

    在 GNU FTP 服务器的根级别有一个 README 文件,它解释了如何使用签名。

    有关最新版本,请参阅 https://ftp.gnu.org/README

    当前文件说:

    There are also .sig files, which contain detached GPG signatures of the above
    files, automatically signed by the same script that generates them.
    
    You can verify the signatures for gnu project files with the keyring file from:
      https://ftp.gnu.org/gnu/gnu-keyring.gpg
    
    In a directory with the keyring file, the source file to verify and the
    signature file, the command to use is:
    
      $ gpg --verify --keyring ./gnu-keyring.gpg foo.tar.xz.sig
    

    【讨论】:

    • 原来你的答案是 - 对于 Emacs-26.1。至少 - 唯一还在工作的,非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-04
    • 2021-03-21
    • 1970-01-01
    • 2016-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多