diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-04-20 11:42:33 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-04-20 18:43:40 +0200 |
commit | c66712681b1367eea110edf8dc25dcf5c937828b (patch) | |
tree | 00fcba482ca5735374af285911de8fb6b6bd5848 /autocrypt | |
parent | 4bd849d3face1918ec9888e1150a96200c75e80a (diff) |
openpgp: Don't finalize the PartialBodyFilter in Drop.
- Previously, PartialBodyFilter::drop made an effort to finalize the
filter. This, however, is only a best-effort mechanism: It cannot
report errors.
- Because of this, we now believe that it actually exacerbates the
problem of downstream users not finalizing the filter: It will
work most of the time, but sometimes fail.
- Drop the implementation of Drop. Fix all the problematic test
cases.
Diffstat (limited to 'autocrypt')
-rw-r--r-- | autocrypt/src/lib.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/autocrypt/src/lib.rs b/autocrypt/src/lib.rs index ca517cc0..1c8de979 100644 --- a/autocrypt/src/lib.rs +++ b/autocrypt/src/lib.rs @@ -487,19 +487,20 @@ impl AutocryptSetupMessage { { // Passphrase-Format header with value numeric9x4 let m = Message::new(&mut armor_writer); - let w = Encryptor::with_passwords( + let m = Encryptor::with_passwords( m, vec![self.passcode.clone().unwrap()]).build()?; - let mut w = LiteralWriter::new(w).build()?; + let m = LiteralWriter::new(m).build()?; // The inner message is an ASCII-armored encoded Cert. let mut w = armor::Writer::new( - &mut w, armor::Kind::SecretKey, + m, armor::Kind::SecretKey, &[ (&"Autocrypt-Prefer-Encrypt"[..], self.prefer_encrypt().unwrap_or(&"nopreference"[..])) ])?; self.cert.as_tsk().serialize(&mut w)?; - w.finalize()?; + let m = w.finalize()?; + m.finalize()?; } armor_writer.finalize()?; Ok(()) |