Add encryption
- actually encrypt the body of a mail
This commit is contained in:
+11
-4
@@ -210,14 +210,21 @@ impl Daemon {
|
||||
// none -> accept
|
||||
// partial -> accept (later: split)
|
||||
// full -> encrypt
|
||||
// check mailbody
|
||||
// is encrypted -> accept
|
||||
// else -> encrypt
|
||||
|
||||
let protection = ProtectionPossibility::from(&context.mail);
|
||||
|
||||
if protection == ProtectionPossibility::Full {
|
||||
// encrypt
|
||||
// if an error occures the body is not exchanged
|
||||
match crypto::encrypt(&context, &body, &context.mail.recipients) {
|
||||
Ok(encrypted) => {
|
||||
if cx.actions.replace_body(&encrypted).await.is_err() {
|
||||
log::error!("Cannot exchange body");
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::error!("{}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user