How to display gpg key details without importing it?

后端 未结 8 781
萌比男神i
萌比男神i 2020-12-22 20:55

I have a copy of the postgresql apt repository gpg key and would like to view the details of the gpg key as it comes in the file. Is this possible without importing it into

8条回答
  •  有刺的猬
    2020-12-22 21:24

    To get the key IDs (8 bytes, 16 hex digits), this is the command which worked for me in GPG 1.4.16, 2.1.18 and 2.2.19:

    gpg --list-packets 

    To get some more information (in addition to the key ID):

    gpg --list-packets 

    To get even more information:

    gpg --list-packets -vvv --debug 0x2 

    The command

    gpg --dry-run --import 

    also works in all 3 versions, but in GPG 1.4.16 it prints only a short (4 bytes, 8 hex digits) key ID, so it's less secure to identify keys.

    Some commands in other answers (e.g. gpg --show-keys, gpg --with-fingerprint, gpg --import --import-options show-only) don't work in some of the 3 GPG versions above, thus they are not portable when targeting multiple versions of GPG.

提交回复
热议问题