mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 14:26:30 +03:00
securejoin: do not check the signatures existance twice
Mimeparser.was_encrypted() checks if the message is an Autocrypt encrypted message. It already means the message has a valid signature. This commit documents a few functions to make it clear that signatures stored in Mimeparser must be valid and must always come from encrypted messages. Also one unwrap() is eliminated in encrypted_and_signed(). It is possible to further simplify encrypted_and_signed() by skipping the was_encrypted() check, because the function only returns true if there is a matching signature, but it is helpful for debugging to distinguish between non-Autocrypt messages and messages whose fingerprint does not match.
This commit is contained in:
committed by
holger krekel
parent
64ab86a1a6
commit
6902250d6b
@@ -115,6 +115,12 @@ impl EncryptHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/// Tries to decrypt a message, but only if it is structured as an
|
||||
/// Autocrypt message, i.e. encrypted and signed with a valid
|
||||
/// signature.
|
||||
///
|
||||
/// Returns decrypted body and a set of valid signature fingerprints
|
||||
/// if successful.
|
||||
pub async fn try_decrypt(
|
||||
context: &Context,
|
||||
mail: &ParsedMail<'_>,
|
||||
|
||||
Reference in New Issue
Block a user