@@ -33,12 +33,7 @@ impl Command for CreateKeyCmd {
33
33
"Generate a keypair." . into ( )
34
34
}
35
35
36
- async fn execute ( & self , config : TEdgeConfig ) -> Result < ( ) , MaybeFancy < anyhow:: Error > > {
37
- // let socket_path = &config.device.cryptoki.socket_path;
38
- // let pkcs11client = tedge_p11_server::client::TedgeP11Client::with_ready_check(
39
- // socket_path.as_std_path().into(),
40
- // );
41
-
36
+ async fn execute ( & self , _config : TEdgeConfig ) -> Result < ( ) , MaybeFancy < anyhow:: Error > > {
42
37
let key = match self . r#type {
43
38
KeyType :: Rsa => KeyTypeParams :: Rsa { bits : self . bits } ,
44
39
KeyType :: Ec => KeyTypeParams :: Ec { curve : self . curve } ,
@@ -51,10 +46,8 @@ impl Command for CreateKeyCmd {
51
46
52
47
// generate a keypair
53
48
// should probably verify the keys before using them
54
- let pubkey_pem = {
55
- let cryptoki = tedge_p11_server:: tedge_p11_service ( self . cryptoki_config . clone ( ) ) ?;
56
- cryptoki. create_key ( None , params) ?
57
- } ;
49
+ let cryptoki = tedge_p11_server:: tedge_p11_service ( self . cryptoki_config . clone ( ) ) ?;
50
+ let pubkey_pem = cryptoki. create_key ( None , params) ?;
58
51
59
52
eprintln ! ( "New keypair was successfully created." ) ;
60
53
@@ -71,9 +64,8 @@ impl Command for CreateKeyCmd {
71
64
}
72
65
} ;
73
66
74
- let cryptoki_config = config. device . cryptoki_config ( None ) . unwrap ( ) . unwrap ( ) ;
75
67
let key = super :: create_csr:: Key :: Cryptoki {
76
- config : cryptoki_config,
68
+ config : self . cryptoki_config . clone ( ) ,
77
69
privkey_label : Some ( self . label . clone ( ) ) ,
78
70
pubkey_pem : Some ( pubkey_pem. clone ( ) ) ,
79
71
sigalg : Some ( sigalg) ,
0 commit comments