OpenPGP EOF error (closes #1024)

This commit is contained in:
mdecimus 2025-01-03 11:12:39 +01:00
parent 7dfaa5bf11
commit 127ce0734f

View file

@ -685,7 +685,7 @@ impl CryptoHandler for Server {
let request = serde_json::from_slice::<EncryptionType>(body.as_deref().unwrap_or_default())
.map_err(|err| trc::ResourceEvent::BadParameters.into_err().reason(err))?;
let (method, algo, certs) = match request {
let (method, algo, mut certs) = match request {
EncryptionType::PGP { algo, certs } => (EncryptionMethod::PGP, algo, certs),
EncryptionType::SMIME { algo, certs } => (EncryptionMethod::SMIME, algo, certs),
EncryptionType::Disabled => {
@ -703,6 +703,9 @@ impl CryptoHandler for Server {
.into_http_response());
}
};
if !certs.ends_with("\n") {
certs.push('\n');
}
// Make sure Encryption is enabled
if !self.core.jmap.encrypt {