@@ -94,7 +94,7 @@ const PUBLIC_KEY_TAG: TagNumber = TagNumber::N1;
94
94
/// [RFC 5208 Section 5]: https://tools.ietf.org/html/rfc5208#section-5
95
95
/// [RFC 5958 Section 2]: https://datatracker.ietf.org/doc/html/rfc5958#section-2
96
96
#[ derive( Clone ) ]
97
- pub struct PrivateKeyInfo < Params , Key > {
97
+ pub struct PrivateKeyInfoInner < Params , Key > {
98
98
/// X.509 `AlgorithmIdentifier` for the private key type.
99
99
pub algorithm : AlgorithmIdentifier < Params > ,
100
100
@@ -105,8 +105,8 @@ pub struct PrivateKeyInfo<Params, Key> {
105
105
pub public_key : Option < Key > ,
106
106
}
107
107
108
- impl < Params , Key > PrivateKeyInfo < Params , Key > {
109
- /// Create a new PKCS#8 [`PrivateKeyInfo `] message.
108
+ impl < Params , Key > PrivateKeyInfoInner < Params , Key > {
109
+ /// Create a new PKCS#8 [`PrivateKeyInfoInner `] message.
110
110
///
111
111
/// This is a helper method which initializes `attributes` and `public_key`
112
112
/// to `None`, helpful if you aren't using those.
@@ -129,7 +129,7 @@ impl<Params, Key> PrivateKeyInfo<Params, Key> {
129
129
}
130
130
}
131
131
}
132
- impl < ' a , Params , Key > PrivateKeyInfo < Params , Key >
132
+ impl < ' a , Params , Key > PrivateKeyInfoInner < Params , Key >
133
133
where
134
134
Params : der:: Choice < ' a > + Encode ,
135
135
Key : From < & ' a [ u8 ] > + AsRef < [ u8 ] > ,
@@ -166,7 +166,7 @@ where
166
166
}
167
167
}
168
168
169
- impl < ' a , Params , Key > PrivateKeyInfo < Params , Key >
169
+ impl < ' a , Params , Key > PrivateKeyInfoInner < Params , Key >
170
170
where
171
171
Params : der:: Choice < ' a > + Encode ,
172
172
Key : AsRef < [ u8 ] > ,
@@ -186,15 +186,12 @@ where
186
186
}
187
187
}
188
188
189
- impl < ' a , Params , Key > DecodeValue < ' a > for PrivateKeyInfo < Params , Key >
189
+ impl < ' a , Params , Key > DecodeValue < ' a > for PrivateKeyInfoInner < Params , Key >
190
190
where
191
191
Params : der:: Choice < ' a > + Encode ,
192
192
Key : From < & ' a [ u8 ] > ,
193
193
{
194
- fn decode_value < R : Reader < ' a > > (
195
- reader : & mut R ,
196
- header : Header ,
197
- ) -> der:: Result < PrivateKeyInfo < Params , Key > > {
194
+ fn decode_value < R : Reader < ' a > > ( reader : & mut R , header : Header ) -> der:: Result < Self > {
198
195
reader. read_nested ( header. length , |reader| {
199
196
// Parse and validate `version` INTEGER.
200
197
let version = Version :: decode ( reader) ?;
@@ -235,7 +232,7 @@ where
235
232
}
236
233
}
237
234
238
- impl < ' a , Params , Key > EncodeValue for PrivateKeyInfo < Params , Key >
235
+ impl < ' a , Params , Key > EncodeValue for PrivateKeyInfoInner < Params , Key >
239
236
where
240
237
Params : der:: Choice < ' a > + Encode ,
241
238
Key : AsRef < [ u8 ] > ,
@@ -256,14 +253,14 @@ where
256
253
}
257
254
}
258
255
259
- impl < ' a , Params , Key > Sequence < ' a > for PrivateKeyInfo < Params , Key >
256
+ impl < ' a , Params , Key > Sequence < ' a > for PrivateKeyInfoInner < Params , Key >
260
257
where
261
258
Params : der:: Choice < ' a > + Encode ,
262
259
Key : From < & ' a [ u8 ] > + AsRef < [ u8 ] > ,
263
260
{
264
261
}
265
262
266
- impl < ' a , Params , Key > TryFrom < & ' a [ u8 ] > for PrivateKeyInfo < Params , Key >
263
+ impl < ' a , Params , Key > TryFrom < & ' a [ u8 ] > for PrivateKeyInfoInner < Params , Key >
267
264
where
268
265
Params : der:: Choice < ' a > + Encode ,
269
266
Key : From < & ' a [ u8 ] > + AsRef < [ u8 ] > ,
@@ -275,13 +272,13 @@ where
275
272
}
276
273
}
277
274
278
- impl < Params , Key > fmt:: Debug for PrivateKeyInfo < Params , Key >
275
+ impl < Params , Key > fmt:: Debug for PrivateKeyInfoInner < Params , Key >
279
276
where
280
277
Params : fmt:: Debug ,
281
278
Key : fmt:: Debug ,
282
279
{
283
280
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
284
- f. debug_struct ( "PrivateKeyInfo " )
281
+ f. debug_struct ( "PrivateKeyInfoInner " )
285
282
. field ( "version" , & self . version ( ) )
286
283
. field ( "algorithm" , & self . algorithm )
287
284
. field ( "public_key" , & self . public_key )
@@ -290,38 +287,38 @@ where
290
287
}
291
288
292
289
#[ cfg( feature = "alloc" ) ]
293
- impl < ' a , Params , Key > TryFrom < PrivateKeyInfo < Params , Key > > for SecretDocument
290
+ impl < ' a , Params , Key > TryFrom < PrivateKeyInfoInner < Params , Key > > for SecretDocument
294
291
where
295
292
Params : der:: Choice < ' a > + Encode ,
296
293
Key : From < & ' a [ u8 ] > + AsRef < [ u8 ] > ,
297
294
{
298
295
type Error = Error ;
299
296
300
- fn try_from ( private_key : PrivateKeyInfo < Params , Key > ) -> Result < SecretDocument > {
297
+ fn try_from ( private_key : PrivateKeyInfoInner < Params , Key > ) -> Result < SecretDocument > {
301
298
SecretDocument :: try_from ( & private_key)
302
299
}
303
300
}
304
301
305
302
#[ cfg( feature = "alloc" ) ]
306
- impl < ' a , Params , Key > TryFrom < & PrivateKeyInfo < Params , Key > > for SecretDocument
303
+ impl < ' a , Params , Key > TryFrom < & PrivateKeyInfoInner < Params , Key > > for SecretDocument
307
304
where
308
305
Params : der:: Choice < ' a > + Encode ,
309
306
Key : From < & ' a [ u8 ] > + AsRef < [ u8 ] > ,
310
307
{
311
308
type Error = Error ;
312
309
313
- fn try_from ( private_key : & PrivateKeyInfo < Params , Key > ) -> Result < SecretDocument > {
310
+ fn try_from ( private_key : & PrivateKeyInfoInner < Params , Key > ) -> Result < SecretDocument > {
314
311
Ok ( Self :: encode_msg ( private_key) ?)
315
312
}
316
313
}
317
314
318
315
#[ cfg( feature = "pem" ) ]
319
- impl < Params , Key > PemLabel for PrivateKeyInfo < Params , Key > {
316
+ impl < Params , Key > PemLabel for PrivateKeyInfoInner < Params , Key > {
320
317
const PEM_LABEL : & ' static str = "PRIVATE KEY" ;
321
318
}
322
319
323
320
#[ cfg( feature = "subtle" ) ]
324
- impl < Params , Key > ConstantTimeEq for PrivateKeyInfo < Params , Key >
321
+ impl < Params , Key > ConstantTimeEq for PrivateKeyInfoInner < Params , Key >
325
322
where
326
323
Params : Eq ,
327
324
Key : PartialEq + AsRef < [ u8 ] > ,
@@ -337,15 +334,15 @@ where
337
334
}
338
335
339
336
#[ cfg( feature = "subtle" ) ]
340
- impl < Params , Key > Eq for PrivateKeyInfo < Params , Key >
337
+ impl < Params , Key > Eq for PrivateKeyInfoInner < Params , Key >
341
338
where
342
339
Params : Eq ,
343
340
Key : AsRef < [ u8 ] > + Eq ,
344
341
{
345
342
}
346
343
347
344
#[ cfg( feature = "subtle" ) ]
348
- impl < Params , Key > PartialEq for PrivateKeyInfo < Params , Key >
345
+ impl < Params , Key > PartialEq for PrivateKeyInfoInner < Params , Key >
349
346
where
350
347
Params : Eq ,
351
348
Key : PartialEq + AsRef < [ u8 ] > ,
@@ -355,19 +352,19 @@ where
355
352
}
356
353
}
357
354
358
- /// [`PrivateKeyInfo `] with [`AnyRef`] algorithm parameters, and `&[u8]` key.
359
- pub type PrivateKeyInfoRef < ' a > = PrivateKeyInfo < AnyRef < ' a > , & ' a [ u8 ] > ;
355
+ /// [`PrivateKeyInfoInner `] with [`AnyRef`] algorithm parameters, and `&[u8]` key.
356
+ pub type PrivateKeyInfo < ' a > = PrivateKeyInfoInner < AnyRef < ' a > , & ' a [ u8 ] > ;
360
357
361
358
/// [`PrivateKeyInfo`] with [`Any`] algorithm parameters, and `Box<[u8]>` key.
362
359
#[ cfg( feature = "alloc" ) ]
363
- pub type PrivateKeyInfoOwned = PrivateKeyInfo < Any , Box < [ u8 ] > > ;
360
+ pub type PrivateKeyInfoOwned = PrivateKeyInfoInner < Any , Box < [ u8 ] > > ;
364
361
365
362
#[ cfg( feature = "alloc" ) ]
366
363
mod allocating {
367
364
use super :: * ;
368
365
use der:: referenced:: * ;
369
366
370
- impl < ' a > RefToOwned < ' a > for PrivateKeyInfoRef < ' a > {
367
+ impl < ' a > RefToOwned < ' a > for PrivateKeyInfo < ' a > {
371
368
type Owned = PrivateKeyInfoOwned ;
372
369
fn ref_to_owned ( & self ) -> Self :: Owned {
373
370
PrivateKeyInfoOwned {
@@ -379,9 +376,9 @@ mod allocating {
379
376
}
380
377
381
378
impl OwnedToRef for PrivateKeyInfoOwned {
382
- type Borrowed < ' a > = PrivateKeyInfoRef < ' a > ;
379
+ type Borrowed < ' a > = PrivateKeyInfo < ' a > ;
383
380
fn owned_to_ref ( & self ) -> Self :: Borrowed < ' _ > {
384
- PrivateKeyInfoRef {
381
+ PrivateKeyInfo {
385
382
algorithm : self . algorithm . owned_to_ref ( ) ,
386
383
private_key : self . private_key . owned_to_ref ( ) ,
387
384
public_key : self . public_key . owned_to_ref ( ) ,
0 commit comments