Skip to content

Commit d996d56

Browse files
Shuo ZhaoJonathan Corbet
authored andcommitted
docs/zh_CN: Add security digsig Chinese translation
Translate .../security/digsig.rst into Chinese. Update the translation through commit d56b699 ("Documentation: Fix typos") Reviewed-by: Yanteng Si <[email protected]> Signed-off-by: Shuo Zhao <[email protected]> Reviewed-by: Yanteng Si <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6356f18 commit d996d56

File tree

2 files changed

+104
-1
lines changed

2 files changed

+104
-1
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
.. include:: ../disclaimer-zh_CN.rst
3+
4+
:Original: Documentation/security/digsig.rst
5+
6+
:翻译:
7+
赵硕 Shuo Zhao <[email protected]>
8+
9+
===============
10+
数字签名验证API
11+
===============
12+
13+
:作者: Dmitry Kasatkin
14+
:日期: 2011.06.10
15+
16+
17+
.. 内容
18+
19+
1.介绍
20+
2.API
21+
3.用户空间工具
22+
23+
24+
介绍
25+
====
26+
27+
数字签名验证API提供了一种验证数字签名的方法。
28+
目前,数字签名被IMA/EVM完整性保护子系统使用。
29+
30+
数字签名验证是通过精简的GnuPG多精度整数(MPI)库的内核移植来实现的。
31+
该内核版本提供了内存分配错误处理,已根据内核编码风格进行重构,并修复
32+
了checkpatch.pl报告的错误和警告。
33+
34+
公钥和签名由头部和MPIs组成::
35+
36+
struct pubkey_hdr {
37+
uint8_t version; /* 密钥格式版本 */
38+
time_t timestamp; /* 密钥时间戳,目前为0 */
39+
uint8_t algo;
40+
uint8_t nmpi;
41+
char mpi[0];
42+
} __packed;
43+
44+
struct signature_hdr {
45+
uint8_t version; /* 签名格式版本 */
46+
time_t timestamp; /* 签名时间戳 */
47+
uint8_t algo;
48+
uint8_t hash;
49+
uint8_t keyid[8];
50+
uint8_t nmpi;
51+
char mpi[0];
52+
} __packed;
53+
54+
keyid等同对整个密钥的内容进行SHA1哈希运算后的第12到19字节。
55+
签名头部用于生成签名的输入。这种方法确保了密钥或签名头部无法更改。
56+
它保护时间戳不被更改,并可以用于回滚保护。
57+
58+
API
59+
===
60+
61+
目前API仅包含一个函数::
62+
63+
digsig_verify() - 使用公钥进行数字签名验证
64+
65+
/**
66+
* digsig_verify() - 使用公钥进行数字签名验证
67+
* @keyring: 查找密钥的密钥环
68+
* @sig: 数字签名
69+
* @sigen: 签名的长度
70+
* @data: 数据
71+
* @datalen: 数据的长度
72+
* @return: 成功时返回0,失败时返回 -EINVAL
73+
*
74+
* 验证数据相对于数字签名的完整性。
75+
* 目前仅支持RSA算法。
76+
* 通常将内容的哈希值作为此函数的数据。
77+
*
78+
*/
79+
int digsig_verify(struct key *keyring, const char *sig, int siglen,
80+
const char *data, int datalen);
81+
82+
用户空间工具
83+
============
84+
85+
签名和密钥管理实用工具evm-utils提供了生成签名、加载密钥到内核密钥环中的功能。
86+
密钥可以是PEM格式,或转换为内核格式。
87+
当把密钥添加到内核密钥环时,keyid定义该密钥的名称:下面的示例中为5D2B05FC633EE3E8。
88+
89+
以下是keyctl实用工具的示例输出::
90+
91+
$ keyctl show
92+
Session Keyring
93+
-3 --alswrv 0 0 keyring: _ses
94+
603976250 --alswrv 0 -1 \_ keyring: _uid.0
95+
817777377 --alswrv 0 0 \_ user: kmk
96+
891974900 --alswrv 0 0 \_ encrypted: evm-key
97+
170323636 --alswrv 0 0 \_ keyring: _module
98+
548221616 --alswrv 0 0 \_ keyring: _ima
99+
128198054 --alswrv 0 0 \_ keyring: _evm
100+
101+
$ keyctl list 128198054
102+
1 key in keyring:
103+
620789745: --alswrv 0 0 user: 5D2B05FC633EE3E8

Documentation/translations/zh_CN/security/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
:maxdepth: 1
1717

1818
lsm
19+
digsig
1920

2021
TODOLIST:
2122
* credentials
@@ -28,7 +29,6 @@ TODOLIST:
2829
* self-protection
2930
* siphash
3031
* tpm/index
31-
* digsig
3232
* landlock
3333
* secrets/index
3434
* ipe

0 commit comments

Comments
 (0)