From 79cfcb09c29b72364e722d58f17c291d16e8c0e0 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Wed, 3 Nov 2021 02:21:44 +0100 Subject: [PATCH] In generate_key_simple(), the algo parameter is now an Option. This allows uploading keys without explicitly setting the algorithm, thus leaving the card's algo setting unchanged. --- openpgp-card-sequoia/src/card.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/openpgp-card-sequoia/src/card.rs b/openpgp-card-sequoia/src/card.rs index be2a39c..6f3fd92 100644 --- a/openpgp-card-sequoia/src/card.rs +++ b/openpgp-card-sequoia/src/card.rs @@ -408,12 +408,19 @@ impl Admin<'_, '_> { pub fn generate_key_simple( &mut self, key_type: KeyType, - algo: AlgoSimple, + algo: Option, ) -> Result<(PublicKeyMaterial, KeyGenerationTime), Error> { - self.oc.card_app.generate_key_simple( - public_to_fingerprint, - key_type, - algo, - ) + match algo { + Some(algo) => self.oc.card_app.generate_key_simple( + public_to_fingerprint, + key_type, + algo, + ), + None => self.oc.card_app.generate_key( + public_to_fingerprint, + key_type, + None, + ), + } } }