mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
refactor(pgp): do not use legacy key ID except for IssuerKeyId subpacket
This commit is contained in:
11
src/imex.rs
11
src/imex.rs
@@ -146,8 +146,8 @@ async fn set_self_key(context: &Context, armored: &str) -> Result<()> {
|
|||||||
|
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
"stored self key: {:?}",
|
"Stored self key: {:?}.",
|
||||||
secret_key.public_key().legacy_key_id()
|
secret_key.public_key().fingerprint()
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -721,12 +721,7 @@ where
|
|||||||
format!("{kind}-key-{addr}-{id}-{fp}.asc")
|
format!("{kind}-key-{addr}-{id}-{fp}.asc")
|
||||||
};
|
};
|
||||||
let path = dir.join(&file_name);
|
let path = dir.join(&file_name);
|
||||||
info!(
|
info!(context, "Exporting key to {}.", path.display());
|
||||||
context,
|
|
||||||
"Exporting key {:?} to {}.",
|
|
||||||
key.key_id(),
|
|
||||||
path.display()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Delete the file if it already exists.
|
// Delete the file if it already exists.
|
||||||
delete_file(context, &path).await.ok();
|
delete_file(context, &path).await.ok();
|
||||||
|
|||||||
13
src/key.rs
13
src/key.rs
@@ -10,7 +10,7 @@ use deltachat_contact_tools::EmailAddress;
|
|||||||
use pgp::composed::Deserializable;
|
use pgp::composed::Deserializable;
|
||||||
pub use pgp::composed::{SignedPublicKey, SignedSecretKey};
|
pub use pgp::composed::{SignedPublicKey, SignedSecretKey};
|
||||||
use pgp::ser::Serialize;
|
use pgp::ser::Serialize;
|
||||||
use pgp::types::{KeyDetails, KeyId};
|
use pgp::types::KeyDetails;
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
|
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
@@ -112,9 +112,6 @@ pub trait DcKey: Serialize + Deserializable + Clone {
|
|||||||
|
|
||||||
/// Whether the key is private (or public).
|
/// Whether the key is private (or public).
|
||||||
fn is_private() -> bool;
|
fn is_private() -> bool;
|
||||||
|
|
||||||
/// Returns the OpenPGP Key ID.
|
|
||||||
fn key_id(&self) -> KeyId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to load own public key.
|
/// Attempts to load own public key.
|
||||||
@@ -262,10 +259,6 @@ impl DcKey for SignedPublicKey {
|
|||||||
fn dc_fingerprint(&self) -> Fingerprint {
|
fn dc_fingerprint(&self) -> Fingerprint {
|
||||||
self.fingerprint().into()
|
self.fingerprint().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn key_id(&self) -> KeyId {
|
|
||||||
KeyDetails::legacy_key_id(self)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DcKey for SignedSecretKey {
|
impl DcKey for SignedSecretKey {
|
||||||
@@ -289,10 +282,6 @@ impl DcKey for SignedSecretKey {
|
|||||||
fn dc_fingerprint(&self) -> Fingerprint {
|
fn dc_fingerprint(&self) -> Fingerprint {
|
||||||
self.fingerprint().into()
|
self.fingerprint().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn key_id(&self) -> KeyId {
|
|
||||||
KeyDetails::legacy_key_id(&**self)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn generate_keypair(context: &Context) -> Result<SignedSecretKey> {
|
async fn generate_keypair(context: &Context) -> Result<SignedSecretKey> {
|
||||||
|
|||||||
Reference in New Issue
Block a user