@@ -182,7 +182,9 @@ impl Ed25519KeyPair {
182
182
let evp_pkey = generate_key ( ) ?;
183
183
184
184
let mut public_key = [ 0u8 ; ED25519_PUBLIC_KEY_LEN ] ;
185
- let out_len: usize = evp_pkey. as_const ( ) . marshal_raw_public_to_buffer ( & mut public_key) ?;
185
+ let out_len: usize = evp_pkey
186
+ . as_const ( )
187
+ . marshal_raw_public_to_buffer ( & mut public_key) ?;
186
188
debug_assert_eq ! ( public_key. len( ) , out_len) ;
187
189
188
190
Ok ( Self {
@@ -219,7 +221,9 @@ impl Ed25519KeyPair {
219
221
pub fn generate_pkcs8 ( _rng : & dyn SecureRandom ) -> Result < Document , Unspecified > {
220
222
let evp_pkey = generate_key ( ) ?;
221
223
Ok ( Document :: new (
222
- evp_pkey. as_const ( ) . marshal_rfc5208_private_key ( Version :: V2 ) ?,
224
+ evp_pkey
225
+ . as_const ( )
226
+ . marshal_rfc5208_private_key ( Version :: V2 ) ?,
223
227
) )
224
228
}
225
229
@@ -230,7 +234,9 @@ impl Ed25519KeyPair {
230
234
///
231
235
pub fn to_pkcs8 ( & self ) -> Result < Document , Unspecified > {
232
236
Ok ( Document :: new (
233
- self . evp_pkey . as_const ( ) . marshal_rfc5208_private_key ( Version :: V2 ) ?,
237
+ self . evp_pkey
238
+ . as_const ( )
239
+ . marshal_rfc5208_private_key ( Version :: V2 ) ?,
234
240
) )
235
241
}
236
242
@@ -251,7 +257,9 @@ impl Ed25519KeyPair {
251
257
pub fn generate_pkcs8v1 ( _rng : & dyn SecureRandom ) -> Result < Document , Unspecified > {
252
258
let evp_pkey = generate_key ( ) ?;
253
259
Ok ( Document :: new (
254
- evp_pkey. as_const ( ) . marshal_rfc5208_private_key ( Version :: V1 ) ?,
260
+ evp_pkey
261
+ . as_const ( )
262
+ . marshal_rfc5208_private_key ( Version :: V1 ) ?,
255
263
) )
256
264
}
257
265
@@ -262,7 +270,9 @@ impl Ed25519KeyPair {
262
270
///
263
271
pub fn to_pkcs8v1 ( & self ) -> Result < Document , Unspecified > {
264
272
Ok ( Document :: new (
265
- self . evp_pkey . as_const ( ) . marshal_rfc5208_private_key ( Version :: V1 ) ?,
273
+ self . evp_pkey
274
+ . as_const ( )
275
+ . marshal_rfc5208_private_key ( Version :: V1 ) ?,
266
276
) )
267
277
}
268
278
@@ -307,7 +317,9 @@ impl Ed25519KeyPair {
307
317
let evp_pkey = LcPtr :: < EVP_PKEY > :: parse_raw_private_key ( seed, EVP_PKEY_ED25519 ) ?;
308
318
309
319
let mut derived_public_key = [ 0u8 ; ED25519_PUBLIC_KEY_LEN ] ;
310
- let out_len: usize = evp_pkey. as_const ( ) . marshal_raw_public_to_buffer ( & mut derived_public_key) ?;
320
+ let out_len: usize = evp_pkey
321
+ . as_const ( )
322
+ . marshal_raw_public_to_buffer ( & mut derived_public_key) ?;
311
323
debug_assert_eq ! ( derived_public_key. len( ) , out_len) ;
312
324
313
325
Ok ( Self {
@@ -363,7 +375,9 @@ impl Ed25519KeyPair {
363
375
evp_pkey. as_const ( ) . validate_as_ed25519 ( ) ?;
364
376
365
377
let mut public_key = [ 0u8 ; ED25519_PUBLIC_KEY_LEN ] ;
366
- let out_len: usize = evp_pkey. as_const ( ) . marshal_raw_public_to_buffer ( & mut public_key) ?;
378
+ let out_len: usize = evp_pkey
379
+ . as_const ( )
380
+ . marshal_raw_public_to_buffer ( & mut public_key) ?;
367
381
debug_assert_eq ! ( public_key. len( ) , out_len) ;
368
382
369
383
Ok ( Self {
@@ -406,7 +420,11 @@ impl Ed25519KeyPair {
406
420
/// Currently the function cannot fail, but it might in future implementations.
407
421
pub fn seed ( & self ) -> Result < Seed < ' static > , Unspecified > {
408
422
Ok ( Seed {
409
- bytes : self . evp_pkey . as_const ( ) . marshal_raw_private_key ( ) ?. into_boxed_slice ( ) ,
423
+ bytes : self
424
+ . evp_pkey
425
+ . as_const ( )
426
+ . marshal_raw_private_key ( ) ?
427
+ . into_boxed_slice ( ) ,
410
428
phantom : PhantomData ,
411
429
} )
412
430
}
@@ -419,7 +437,9 @@ impl AsDer<Pkcs8V1Der<'static>> for Ed25519KeyPair {
419
437
/// `error::Unspecified` on internal error.
420
438
fn as_der ( & self ) -> Result < Pkcs8V1Der < ' static > , crate :: error:: Unspecified > {
421
439
Ok ( Pkcs8V1Der :: new (
422
- self . evp_pkey . as_const ( ) . marshal_rfc5208_private_key ( Version :: V1 ) ?,
440
+ self . evp_pkey
441
+ . as_const ( )
442
+ . marshal_rfc5208_private_key ( Version :: V1 ) ?,
423
443
) )
424
444
}
425
445
}
@@ -431,7 +451,9 @@ impl AsDer<Pkcs8V2Der<'static>> for Ed25519KeyPair {
431
451
/// `error::Unspecified` on internal error.
432
452
fn as_der ( & self ) -> Result < Pkcs8V2Der < ' static > , crate :: error:: Unspecified > {
433
453
Ok ( Pkcs8V2Der :: new (
434
- self . evp_pkey . as_const ( ) . marshal_rfc5208_private_key ( Version :: V2 ) ?,
454
+ self . evp_pkey
455
+ . as_const ( )
456
+ . marshal_rfc5208_private_key ( Version :: V2 ) ?,
435
457
) )
436
458
}
437
459
}
0 commit comments