In key generation: don't set algo attributes if the card doesn't support that feature.
This commit is contained in:
parent
a39f25d8a3
commit
0bf59c7e51
1 changed files with 9 additions and 1 deletions
|
@ -42,7 +42,15 @@ pub(crate) fn gen_key_with_metadata(
|
|||
) -> Result<(PublicKeyMaterial, KeyGenerationTime), Error> {
|
||||
// set algo on card if it's Some
|
||||
if let Some(algo) = algo {
|
||||
card_app.set_algorithm_attributes(key_type, algo)?;
|
||||
// only set algo if card supports setting of algo attr
|
||||
|
||||
// FIXME: caching
|
||||
let ard = card_app.get_application_related_data()?;
|
||||
let ecap = ard.get_extended_capabilities()?;
|
||||
|
||||
if ecap.algo_attrs_changeable() {
|
||||
card_app.set_algorithm_attributes(key_type, algo)?;
|
||||
}
|
||||
}
|
||||
|
||||
// algo
|
||||
|
|
Loading…
Reference in a new issue