1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
//! Key agreement algorithms for establishing shared secrets.
//!
//! 用于建立共享密钥的密钥协商算法。
//!
//! ## Overview | 概述
//!
//! Key agreement algorithms allow two or more parties to establish a shared secret
//! over an insecure communication channel without prior shared information. The
//! shared secret can then be used for aead encryption or other cryptographic
//! operations requiring a common key.
//!
//! 密钥协商算法允许两方或多方在没有事先共享信息的情况下,
//! 通过不安全的通信通道建立共享密钥。然后可以将共享密钥用于对称加密
//! 或其他需要公共密钥的密码操作。
//!
//! ## Supported Algorithms | 支持的算法
//!
//! ### ECDH P-256 (Elliptic Curve Diffie-Hellman)
//! - **Curve**: NIST P-256 (secp256r1)
//! - **Security Level**: 128-bit
//! - **Key Size**: 32 bytes (256 bits)
//! - **Performance**: High
//! - **Standardization**: NIST FIPS 186-4, RFC 6090
//!
//! ## Security Properties | 安全属性
//!
//! - **Computational Diffie-Hellman (CDH)**: Based on the difficulty of computing discrete logarithms
//! - **Forward Secrecy**: When used with ephemeral keys
//! - **Perfect Forward Secrecy**: When ephemeral keys are properly deleted
//! - **No Authentication**: Key agreement alone doesn't provide authentication
//!
//! - **计算 Diffie-Hellman (CDH)**: 基于计算离散对数的困难性
//! - **前向保密**: 当与临时密钥一起使用时
//! - **完美前向保密**: 当临时密钥被正确删除时
//! - **无认证**: 密钥协商本身不提供认证
//!
//! ## Usage Guidelines | 使用指南
//!
//! - **Authentication**: Combine with digital signatures or certificates for authentication
//! - **Ephemeral Keys**: Use ephemeral keys for forward secrecy
//! - **Key Derivation**: Use proper KDF to derive actual encryption keys from shared secret
//! - **Validation**: Validate public keys to prevent invalid curve attacks
//!
//! - **认证**: 结合数字签名或证书进行认证
//! - **临时密钥**: 使用临时密钥实现前向保密
//! - **密钥派生**: 使用适当的 KDF 从共享密钥派生实际的加密密钥
//! - **验证**: 验证公钥以防止无效曲线攻击
use ;
use ;
/// Key agreement algorithm enumeration.
///
/// 密钥协商算法枚举。
///
/// ## Algorithm Selection | 算法选择
///
/// Currently supports ECDH P-256, which provides:
/// - High performance on modern hardware
/// - Wide compatibility and standardization
/// - 128-bit security level
/// - Efficient implementation
///
/// 目前支持 ECDH P-256,它提供:
/// - 在现代硬件上的高性能
/// - 广泛的兼容性和标准化
/// - 128 位安全级别
/// - 高效的实现
/// Builder for constructing key agreement algorithm instances.
///
/// 用于构建密钥协商算法实例的构建器。
///
/// ## Usage Pattern | 使用模式
///
/// ```rust
/// use seal_crypto_wrapper::algorithms::asymmetric::key_agreement::KeyAgreementAlgorithm;
///
/// // Select ECDH P-256 algorithm
/// let algorithm = KeyAgreementAlgorithm::build().ecdh_p256();
/// ```
///
/// ## Security Considerations | 安全考虑
///
/// When selecting a key agreement algorithm, consider:
/// - Required security level
/// - Performance requirements
/// - Compatibility with other systems
/// - Forward secrecy requirements
///
/// 选择密钥协商算法时,考虑:
/// - 所需的安全级别
/// - 性能要求
/// - 与其他系统的兼容性
/// - 前向保密要求
;
use crateKeyAgreementAlgorithmWrapper;