Return Err for unexpected cases.
This commit is contained in:
parent
0e37967200
commit
ea8e33b6d5
2 changed files with 8 additions and 4 deletions
|
@ -554,7 +554,9 @@ impl CardApp {
|
||||||
let data = match algo {
|
let data = match algo {
|
||||||
Algo::Rsa(rsa) => Self::rsa_algo_attrs(rsa)?,
|
Algo::Rsa(rsa) => Self::rsa_algo_attrs(rsa)?,
|
||||||
Algo::Ecc(ecc) => Self::ecc_algo_attrs(ecc.oid(), ecc.ecc_type()),
|
Algo::Ecc(ecc) => Self::ecc_algo_attrs(ecc.oid(), ecc.ecc_type()),
|
||||||
_ => unimplemented!(),
|
_ => {
|
||||||
|
return Err(anyhow!("Unexpected Algo {:?}", algo).into());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Command to PUT the algorithm attributes
|
// Command to PUT the algorithm attributes
|
||||||
|
|
|
@ -88,9 +88,11 @@ fn tlv_to_pubkey(tlv: &Tlv, algo: &Algo) -> Result<PublicKeyMaterial> {
|
||||||
Ok(PublicKeyMaterial::E(ecc))
|
Ok(PublicKeyMaterial::E(ecc))
|
||||||
}
|
}
|
||||||
|
|
||||||
(_, _, _) => {
|
(_, _, _) => Err(anyhow!(
|
||||||
unimplemented!()
|
"Unexpected public key material from card {:?}",
|
||||||
}
|
tlv
|
||||||
|
)
|
||||||
|
.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue