密钥详细信息列表中如何定义 GPG 使用标志?

max*_*zig 70 gpg

当我列出一个键的详细信息时,我会得到如下输出:

$ gpg --edit-key SOMEID
pub [..] created: [..] expires: [..]   usage:SC
[..]
sub [..] created: [..] expires: [..]   usage: E
Run Code Online (Sandbox Code Playgroud)

甚至usage: SCA在另一个键上(主键部分)。

用法字段中的这些缩写是什么意思?

我可以得出:

S -> for signing
E -> for encrypting
Run Code Online (Sandbox Code Playgroud)

但是CA呢?

还有更多吗?

在哪里可以找到这样的东西?

max*_*zig 75

好吧,gpg手册好像没有提到这些缩写。因此,必须要从源头上看。

例如在 Debian/Ubuntu 下:

$ apt-get source gnupg2
$ cd gnupg2-2.0.17
$ cscope -bR
$ grep 'usage: %' . -r --exclude '*po*'
$ vim g10/keyedit.c
jump to usage: %
jump to definition of `usagestr_from_pk`
Run Code Online (Sandbox Code Playgroud)

从代码中可以得出下表:

????????????????????????????????????
常量字符
????????????????????????????????????
PUBKEY_USAGE_SIG S
PUBKEY_USAGE_CERT C
PUBKEY_USAGE_ENC E
PUBKEY_USAGE_AUTH A
????????????????????????????????????

因此,例如,usage: SCA意味着子密钥可用于签名、创建证书和身份验证。

  • 真的在文档中的任何地方吗? (11认同)
  • 永远不要相信文档。源代码是唯一且最终的真理。 (2认同)

jer*_*tbt 24

--edit-key列表的布局没有记录(无论如何我都找不到)。但是,您提到的缩写位于信息页面 ( info gpg)中的某处。

我搜索S:并发现我实际上想搜索usage:.

在“GPG 密钥相关选项”中:

4.2.1 如何更改配置

这些选项用于更改配置,通常可在选项文件中找到。

'--list-options parameters'

 show-usage

      Show usage information for keys and subkeys in the standard
      key listing.  This is a list of letters indicating the allowed
      usage for a key ('E'=encryption, 'S'=signing,
      'C'=certification, 'A'=authentication).  Defaults to no.
Run Code Online (Sandbox Code Playgroud)

所以,这样做gpg -k --list-options show-usage 1A3ABKEY会告诉你这样的事情:

pub   rsa4096/1A3ABKEY 2015-01-25 [SC]
uid         [ultimate] Some Key
sub   rsa4096/4B907KEY 2015-09-19 [S]
sub   rsa4096/F9A41KET 2015-09-19 [E]
Run Code Online (Sandbox Code Playgroud)

更多信息可在“无人值守的 GPG 使用”中找到

关键用途:USAGE-LIST

 Space or comma delimited list of key usages.  Allowed values are
 'encrypt', 'sign', and 'auth'.  This is used to generate the key
 flags.  Please make sure that the algorithm is capable of this
 usage.  Note that OpenPGP requires that all primary keys are
 capable of certification, so no matter what usage is given here,
 the 'cert' flag will be on.  If no 'Key-Usage' is specified and the
 'Key-Type' is not 'default', all allowed usages for that particular
 algorithm are used; if it is not given but 'default' is used the
 usage will be 'sign'.
Run Code Online (Sandbox Code Playgroud)

所以,虽然不是很明显,但信息就在你系统的某个地方。如果man对您没有帮助,请尝试man -k和/或info


elb*_*ero 8

深埋在GnuPG 邮件列表中......

“用法”右侧的字母是什么意思?
(S,C,A,E) 我只能猜测 |S|ign, |E|ncrypt, ....

(S)ign:签署一些数据(如文件)
(C)ertify:签署密钥(这称为认证)
(A)uthenticate:向计算机验证您自己的身份(例如登录)
(E)ncrypt:加密数据


小智 7

这些关键标志在OpenPGP 规范中定义

5.2.3.21。关键标志

(N 个八位字节的标志)

该子包包含一个二进制标志列表,这些标志包含有关密钥的信息。它是一串八位字节,并且一个实现不能假定一个固定的大小。这样它就可以随着时间的推移而增长。如果列表比实现预期的短,则未声明的标志被视为零。定义的标志如下:

   First octet:

   0x01 - This key may be used to certify other keys.

   0x02 - This key may be used to sign data.

   0x04 - This key may be used to encrypt communications.

   0x08 - This key may be used to encrypt storage.

   0x10 - The private component of this key may have been split
          by a secret-sharing mechanism.

   0x20 - This key may be used for authentication.

   0x80 - The private component of this key may be in the
          possession of more than one person.
Run Code Online (Sandbox Code Playgroud)

  • 这看起来像是一个有用的参考,但它并没有真正回答这个问题。 (8认同)

小智 6

另一个信息源是GnuPG 发行版中的DETAILS文件。

\n\n

“字段 12 - 关键功能”部分说明

\n\n
\n定义的功能为:\n\ne\n加密\ns\n签名\nc\n验证\na\n身份验证\n?\n未知功能\n\n密钥可以按任意顺序具有它们的任意组合。\n除了这些字母之外,主键还具有字母的大写版本,\n表示整个键的可用功能,以及潜在的字母 \xe2\x80\x98D\xe2\x80\x99 表示禁用的键。 \n
\n