diff --git a/sw/host/hsmtool/src/commands/spx/generate.rs b/sw/host/hsmtool/src/commands/spx/generate.rs index f36428ce67091..4d45f38f20203 100644 --- a/sw/host/hsmtool/src/commands/spx/generate.rs +++ b/sw/host/hsmtool/src/commands/spx/generate.rs @@ -53,7 +53,7 @@ impl Dispatch for Generate { Ok(Box::new(BasicResult { success: true, - id: AttrData::Str(key.hash.expect("key hash")), + id: key.hash.map_or(AttrData::None, AttrData::Str), label: AttrData::Str(key.alias), value: None, error: None, diff --git a/sw/host/hsmtool/src/commands/spx/import.rs b/sw/host/hsmtool/src/commands/spx/import.rs index f5494c534994e..cac4357c461ca 100644 --- a/sw/host/hsmtool/src/commands/spx/import.rs +++ b/sw/host/hsmtool/src/commands/spx/import.rs @@ -48,7 +48,7 @@ impl Dispatch for Import { )?; Ok(Box::new(BasicResult { success: true, - id: AttrData::Str(key.hash.expect("key hash")), + id: key.hash.map_or(AttrData::None, AttrData::Str), label: AttrData::Str(key.alias), value: None, error: None,