From 8df9b9e4d9c5c61cfc9a18c58dc4548c1b1fddc6 Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 25 Feb 2026 17:05:05 +0000 Subject: [PATCH] refactor(pgp): do not use legacy key ID except for IssuerKeyId subpacket --- src/imex.rs | 11 +++-------- src/key.rs | 13 +------------ 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/imex.rs b/src/imex.rs index 166053b52..a3fe1599a 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -146,8 +146,8 @@ async fn set_self_key(context: &Context, armored: &str) -> Result<()> { info!( context, - "stored self key: {:?}", - secret_key.public_key().legacy_key_id() + "Stored self key: {:?}.", + secret_key.public_key().fingerprint() ); Ok(()) } @@ -721,12 +721,7 @@ where format!("{kind}-key-{addr}-{id}-{fp}.asc") }; let path = dir.join(&file_name); - info!( - context, - "Exporting key {:?} to {}.", - key.key_id(), - path.display() - ); + info!(context, "Exporting key to {}.", path.display()); // Delete the file if it already exists. delete_file(context, &path).await.ok(); diff --git a/src/key.rs b/src/key.rs index 3473aabe1..54d20b6a7 100644 --- a/src/key.rs +++ b/src/key.rs @@ -10,7 +10,7 @@ use deltachat_contact_tools::EmailAddress; use pgp::composed::Deserializable; pub use pgp::composed::{SignedPublicKey, SignedSecretKey}; use pgp::ser::Serialize; -use pgp::types::{KeyDetails, KeyId}; +use pgp::types::KeyDetails; use tokio::runtime::Handle; use crate::context::Context; @@ -112,9 +112,6 @@ pub trait DcKey: Serialize + Deserializable + Clone { /// Whether the key is private (or public). fn is_private() -> bool; - - /// Returns the OpenPGP Key ID. - fn key_id(&self) -> KeyId; } /// Attempts to load own public key. @@ -262,10 +259,6 @@ impl DcKey for SignedPublicKey { fn dc_fingerprint(&self) -> Fingerprint { self.fingerprint().into() } - - fn key_id(&self) -> KeyId { - KeyDetails::legacy_key_id(self) - } } impl DcKey for SignedSecretKey { @@ -289,10 +282,6 @@ impl DcKey for SignedSecretKey { fn dc_fingerprint(&self) -> Fingerprint { self.fingerprint().into() } - - fn key_id(&self) -> KeyId { - KeyDetails::legacy_key_id(&**self) - } } async fn generate_keypair(context: &Context) -> Result {