Return Err for unexpected cases.

This commit is contained in:
Heiko Schaefer 2021-08-27 19:24:15 +02:00
parent 0e37967200
commit ea8e33b6d5
2 changed files with 8 additions and 4 deletions

View file

@ -554,7 +554,9 @@ impl CardApp {
let data = match algo {
Algo::Rsa(rsa) => Self::rsa_algo_attrs(rsa)?,
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

View file

@ -88,9 +88,11 @@ fn tlv_to_pubkey(tlv: &Tlv, algo: &Algo) -> Result<PublicKeyMaterial> {
Ok(PublicKeyMaterial::E(ecc))
}
(_, _, _) => {
unimplemented!()
}
(_, _, _) => Err(anyhow!(
"Unexpected public key material from card {:?}",
tlv
)
.into()),
}
}