summaryrefslogtreecommitdiffstats
path: root/openpgp/src/serialize/stream.rs
AgeCommit message (Collapse)Author
2020-04-20openpgp: Fix documentation.Justus Winter
2020-04-20openpgp: Don't finalize the Signer in Drop.Justus Winter
- Previously, Signer::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.
2020-04-20openpgp: Don't finalize the Encryptor in Drop.Justus Winter
- Previously, Encryptor::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.
2020-04-20openpgp: Don't finalize the PartialBodyFilter in Drop.Justus Winter
- 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.
2020-04-16Revert "openpgp: Make PacketParserResult a std::result::Result."Justus Winter
This reverts commit 2e1eec5fe4157a391a13554ff7df3075cfe043cc.
2020-04-09openpgp: Make PacketParserResult a std::result::Result.Justus Winter
- This avoids the partial implementation imitating std::option::Option, replacing it with std::result::Result. - As a benefit, std::result::Result is in the prelude, simplifying a lot of parsing loops.
2020-04-08openpgp: Change key's role function names.Wiktor Kwapisiewicz
- Change `mark_role_primary` to `role_into_primary`. - Change `mark_role_primary_ref` to `role_as_primary`. - Change `mark_role_subordinate` to `role_into_subordinate`. - Change `mark_role_subordinate_ref` to `role_as_subordinate`. - Change `mark_role_unspecified` to `role_into_unspecified`. - Change `mark_role_unspecified_ref` to `role_as_unspecified`. - Fixes #452.
2020-04-08openpgp: Specialize stream::Message, make Cookie private.Justus Winter
- Previously, Message was polymorphic over the cookie. However, the writer stack framework only has one user, and it likely ever will, so I don't really see the point in complicating our interface.
2020-04-08openpgp: Rename Encryptor::sym_algo to symmetric_algo.Justus Winter
- This aligns it with AED::symmetric_algo and SKESK::symmetric_algo.
2020-04-07openpgp: Improve documentation for the serialize module.Justus Winter
- Fixes #472.
2020-04-06openpgp: Rename VerificationHelper::get_public_keys to get_certs.Justus Winter
2020-04-06openpgp: Make Signer::creation_time polymorphic.Justus Winter
2020-04-03openpgp: Unawkwardify the streaming encryptor.Justus Winter
2020-04-03openpgp: Make LiteralWriter::date polymorphic.Justus Winter
2020-04-03openpgp: Rename.Justus Winter
2020-04-03Change function names to align to Rust naming conventions.Wiktor Kwapisiewicz
- Change `mark_parts_public` to `parts_into_public`, - Change `mark_parts_public_ref` to `parts_as_public`, - Change `mark_parts_secret` to `parts_into_secret`, - Change `mark_parts_secret_ref` to `parts_as_secret`, - Change `mark_parts_unspecified` to `parts_into_unspecified`, - Change `mark_parts_unspecified_ref` to `parts_as_unspecified`, - Fixes #452.
2020-04-03openpgp: Unify Message and writer::Stack, hide writers.Justus Winter
- Previously, Message::new returned a writer::Stack, and Message was just an empty struct. Unify the types. This makes sense, because if you have a message, and encrypt it, you get a message. - Make the writer module private. This is an implementation detail.
2020-04-03openpgp: Rename.Justus Winter
2020-04-02openpgp: Move the writer module to serialize::stream.Justus Winter
2020-04-02openpgp: Move the padding module to serialize::stream.Justus Winter
2020-03-26Remove redundant field names.Wiktor Kwapisiewicz
2020-03-25openpgp: Improve performance of detached signature verification.Justus Winter
- Previously, we transformed data and detached signatures into signed messages on the fly, then used the streaming Verifier to verify the message. However, this introduces a nontrivial overhead, even if unnecessary copies are carefully avoided. - Instead, specialize the streaming Decryptor to handle detached signatures. use crypto::hash_buffered_reader to compute the hashes over the data, then attach the computed signatures to the signature packets, and use Decryptor's verification machinery. - While this is arguably less elegant, it is much simpler, and a lot faster. Notably, if we operate on files and can mmap them into memory, we can compute the hash in one call to the compression function. Verification of detached signatures is an important use case, so this speedup outweighs the loss of elegance. - Fixes #457.
2020-03-18openpgp: Fix documentation.Justus Winter
2020-03-03openpgp: Only impl Serialize for objects that are normally exported.Neal H. Walfield
- Add two new traits: `Marshal` and `MarshalInto`. - Implement them instead of `Serialize` and `SerializeInto`. - Only implement `Serialize` and `SerializeInto` for data structures that are normally exported. - This should prevent users from accidentally serializing a bare signature (`Signature`) when they meant to serialize a signature packet (`Packet`), for instance. - Fixes #368.
2020-03-03openpgp: Mark experimental features.Justus Winter
- Fixes #446.
2020-02-26openpgp: Add a prelude file to import things related to certificatesNeal H. Walfield
- Add `openpgp/src/cert/prelude.rs` to import most types and traits related to certificates. - Use it instead of using the types and traits individually.
2020-02-19openpgp: Split VerificationResult.Justus Winter
- Split VerificationResult into Result<GoodChecksum, VerificationError>. - Fixes #416.
2020-02-17openpgp: Make Recipient::new polymorphic over key variants.Justus Winter
2020-02-12openpgp: Add optional cipher argument to DecryptionHelper::decrypt.Justus Winter
2020-02-12openpgp: Add optional cipher argument to PKESK3::decrypt.Justus Winter
2020-02-06openpgp: Rename methods 'set_policy' to 'with_policy'.Justus Winter
- Fixes #427.
2020-01-31openpgp: Add a policy object.Neal H. Walfield
- Change all functions that need to evaluate the validity of a signature (either directly or indirectly to take a policy object. - Use the policy object to allow the user to place additional constraints on a signature's validity. - This addresses the first half of #274 (it introduces the policy object, but does not yet implement any policy).
2020-01-24openpgp: Improve test.Justus Winter
- Use the frozen time as policy. Simplify writer stack finalization.
2020-01-17openpgp: Allow the caller to determine a signature's creation time.Neal H. Walfield
- Add Signer::creation_time so that a user of a Signer object can determine the signature's creation time.
2020-01-16openpgp: Return Result<()> from Signature::verify*.Justus Winter
2020-01-16openpgp: Improve example.Neal H. Walfield
2020-01-10openpgp: Pass MessageStructure by value, not reference.Neal H. Walfield
- Instead of passing MessageStructure to VerificationHelper::check by reference, pass it by value. - After calling VerificationHelper::check, it is dropped. Passing it by value allows the caller to avoid some cloning.
2020-01-06openpgp: Use KeyAmalgamation::for_xxx instead of building a KeyFlagsNeal H. Walfield
- Use the convenient functions KeyAmalgamation::for_storage_encryption, KeyAmalgamation::for_transport_encryption, etc., instead of building up a KeyFlags and then calling KeyAmalgamation::key_flags. - This pattern requires less boilerplate.
2020-01-06openpgp: Pass a timestamp to the KeyIter instead of each filter.Neal H. Walfield
- KeyIter::revoked and KeyIter::key_flags (and its variants) didn't take a time stamp so they could only be used for filtering keys based on their current state, not their state at some time in the past. Adding a time stamp to each of the filters would have fixed the problem, but it would have made the interface ugly: callers always want the same time stamp for all filters. - Split KeyIter into two structures: a KeyIter and a ValidKeyIter. - Add KeyIter::policy. It takes a time stamp, which is then used for filters like `alive` and `revoked`, and it returns a ValidKeyIter, which exposes filters that require a time stamp.
2019-12-20openpgp: Simplify key iteration interface.Neal H. Walfield
- Cert::keys_valid() is just a short-cut for Cert::keys_all().alive().revoked(false). - Remove Cert::keys_valid() and rename Cert::keys_all() to Cert::keys().
2019-12-19openpgp: Change KeyIter to return a struct instead of a tuple.Neal H. Walfield
- A tuple is just an unnamed, inflexible struct. Use a struct instead. - Fixes #400.
2019-12-19Don't use misleading `<&[T; N] as IntoIterator>::into_iter`Igor Matuszewski
See https://github.com/rust-lang/rust/pull/65819. Warned against by default since Rust 1.41. Right now `into_iter` returns references to objects inside an array rather than moving the values (as one would expect) so it makes sense to use `iter()` or for-in-borrowed (which calls the same thing) to retain the behaviour but make it less confusing.
2019-12-13openpgp: Likewise for MDC.Justus Winter
2019-12-05openpgp: Make crypto::{Signer,Decryptor} non-polymorphic.Justus Winter
- These are low-level cryptographic traits that are not concerned with the role of a key. - Fixes #382.
2019-12-04openpgp: Refine CertBuilder::add_encryption_subkey.Justus Winter
2019-12-04openpgp: Rename KeyFlag's accessors.Justus Winter
- Fixes #359.
2019-12-04openpgp: Rename KeyIter filters.Justus Winter
- See #359.
2019-12-03openpgp: Drop algorithm argument from signature::Builder::sign_hash.Justus Winter
- The hash context knows the algorithm.
2019-12-03openpgp: Make Literal::set_filename polymorphic over AsRef<[u8]>.Justus Winter
- And drop Literal::set_filename_from_bytes.
2019-12-03openpgp: Remove all calls to Time::canonicalize.Justus Winter
- Now that we store timestamps in OpenPGP's native encoding, the canonicalization happens when converting to it.