From 08581ecfa7628661cd446287aa720bedd22124b4 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Thu, 5 Oct 2023 16:27:45 +0800 Subject: [PATCH] v0.7.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cmd_pgpcardlist.rs | 1 + src/pkiutil.rs | 6 +++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81194cd..199fc20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -320,7 +320,7 @@ dependencies = [ [[package]] name = "card-cli" -version = "1.7.2" +version = "1.7.3" dependencies = [ "authenticator", "base64 0.21.4", diff --git a/Cargo.toml b/Cargo.toml index 8a0fb2e..3833125 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "card-cli" -version = "1.7.2" +version = "1.7.3" authors = ["Hatter Jiang "] edition = "2018" diff --git a/src/cmd_pgpcardlist.rs b/src/cmd_pgpcardlist.rs index f0bd311..e9ee6fb 100644 --- a/src/cmd_pgpcardlist.rs +++ b/src/cmd_pgpcardlist.rs @@ -121,6 +121,7 @@ impl Command for CommandImpl { if let Some((public_key_sha256, public_key_pem)) = public_key_pem(&public_key) { information!("{} public key sha256: {}", tag1, hex::encode(&public_key_sha256)); information!("{} public key: {}", tag1, public_key_pem.trim()); + information!("{} public key: {}", tag1, public_key); if json_output { json.insert(format!("{}_public_key_sha256", tag2), hex::encode(&public_key_sha256)); json.insert(format!("{}_public_key_pem", tag2), public_key_pem); diff --git a/src/pkiutil.rs b/src/pkiutil.rs index 59aa965..ecca688 100644 --- a/src/pkiutil.rs +++ b/src/pkiutil.rs @@ -59,8 +59,12 @@ pub fn openpgp_card_public_key_pem(public_key: &PublicKeyMaterial) -> Option<(Ve PublicKeyMaterial::R(rsa_pub) => { Some(rsa_public_key_pem(rsa_pub.n(), rsa_pub.v())) } + PublicKeyMaterial::E(ecc_pub) => { + let ecc_pub_key_bytes_sha256 = sha256_bytes(&ecc_pub.data()); + Some((ecc_pub_key_bytes_sha256, format!("hex:{}", hex::encode(&ecc_pub.data())))) + } _ => { - warning!("Not RSA public key: {:?}", public_key); + warning!("Unknown public key: {:?}", public_key); None } }