summaryrefslogtreecommitdiffstats
path: root/openpgp/src/packet_pile.rs
AgeCommit message (Collapse)Author
2021-03-22openpgp: Add test demonstrating that canonicalization is robust.Justus Winter
- At some point, invalid self-signatures would be mis-classified as third-party certifications by Cert::canonicalize. As a side-effect, invalid self-revocations would be considered third-party revocations, changing the certificates revocation status to CouldBe. Confusingly, also changing the digest prefix would break this mis-classification, resulting in a revocation status of NotAsFarAsWeKnow. - The underlying issue was fixed in 7afee60b7cf0f19559bfccd8c42fdc77f6b9c655. - Add a test that demonstrates that bad signatures are now recognized as such, and that the confusing behavior previously observed is now consistent. - Fixes #486.
2020-12-11openpgp: Standardize fn main() in doctests.Azul
- Avoid the additional `fn f()`.
2020-12-11openpgp: Replace `.unwrap()` in doctests with `?`Azul
- See #480.
2020-12-10buffered-reader: Require Cookies to be Send and Sync.Azul
- This way the entire `BufferedReader<C>` will be `Send` and `Sync`. - Modify all other crates accordingly. - See #615.
2020-12-08openpgp: Make unnamed iterators Send + Sync.Justus Winter
- See #615.
2020-12-08openpgp: Use parens for assert_send_and_sync!.Azul
2020-12-08openpgp: Ensure public types are Send and Sync.Azul
- See #627.
2020-11-18openpgp: Return iterator over bad signatures.Justus Winter
- This allows us to store verification errors with the signatures. - See #619.
2020-10-18openpgp: Change Cert::into_packets to not drop any information.Neal H. Walfield
- Change `Cert::into_packets` to return the underlying packets. That is don't drop secret key material like `Cert::serialize` does.
2020-10-14Use 'Examples' for the examples section.Justus Winter
- See #480.
2020-10-14Replace most 'extern crate' directives with 'use'.Justus Winter
- See #480.
2020-10-05openpgp: Improve cert canonicalization.Justus Winter
- Previously, a bad self-signature was mistakenly classified as third-party-signature by the hash-prefix heuristic. For example, a missing primary key binding signature on a self-signature causes the verification to fail, but the hash-prefix heuristic (which does not consider the missing primary key binding signature) attributes it to the subkey as a third-party-signature. - Use issuer information to distinguish between self-signatures and third-party-signatures, then use this information to limit the sorting heuristic to the corresponding buckets.
2020-08-06openpgp: Fix formatting of vector and array literals in examples.Justus Winter
- Align our examples with how the code in the examples of the Rust standard library is formatted. We are writing examples in the hope that downstream users will copy fragments of them, therefore using idiomatic formatting in these snippets is important.
2020-07-24openpgp: Improve PacketParserResult::as_ref, as_mut, and map.Justus Winter
- Previously, these method withheld information in the EOF case (and in case of `map` this loss is irrecoverable). Fix this by returning a Result instead.
2020-07-24openpgp: Don't mention private type in documentation.Justus Winter
- See #471.
2020-07-21openpgp: Remove PacketParserResult::is_none.Justus Winter
- There is no variant called `None`, so having this predicate seems wrong. - See #489.
2020-05-28openpgp: Fix PacketPileParser's API.Justus Winter
- Previously, inspecting the first packet was weird, because only .next() and .recurse() returned a reference to the underlying packet parser. Having to call .next() to get the first package differs from how the packet parser behaves (though I have to admit that it aligns with Iterator::next()). - Instead of returning the packet parser result from .next() and .recurse(), make PacketPileParser deref to it. This allows to inspect the first packet without weirdly calling .next() first, and improves code using the PPP in a parsing loop. It also simplifies the implementation, removing the need for the `returned_first` hack.
2020-05-13openpgp: Implement From<PacketPile> for Vec<Packet>Neal H. Walfield
- Provide a conversion from `PacketPile` to `Vec<Packet>` using idiomatic interfaces. - It would be nicer to implement `IntoIterator`, but `PacketPile::into_children` doesn't have a concrete type (it returns an `impl Iterator`).
2020-04-28openpgp: Convert `Cert::from_packet_pile` into `TryFrom`Wiktor Kwapisiewicz
- Drop `Cert::from_packet_pile`. - Fixes #462.
2020-04-28openpgp: Rename Cert::revoked, etc. to revocation_statusNeal H. Walfield
- Rename `Cert::revoked`, `ValidCert::revoked`, `ValidAmalgamation::revoked`, and `ComponentBundle::revoked` to revocation_status to more accurately match what it does. - Don't rename `ValidComponentAmalgamationIter::revoked` or `ValidKeyAmalgamationIter::revoked`. They don't return the revocation status; they check whether the key is revoked.
2020-04-16Revert "openpgp: Make PacketParserResult a std::result::Result."Justus Winter
This reverts commit 2e1eec5fe4157a391a13554ff7df3075cfe043cc.
2020-04-15openpgp: Add doctest example for PacketPile.Wiktor Kwapisiewicz
2020-04-15openpgp: Add doctests for PacketPile's public methods.Wiktor Kwapisiewicz
- Add doctest example to PacketPile. - Add doctest example to `PacketPile::path_ref`. - Add doctest example to `PacketPile::path_ref_mut`. - Add doctest example to `PacketPile::descendants`. - Add doctest example to `PacketPile::children`. - Add doctest example to `PacketPile::into_children`. - Fixes #467.
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-09openpgp: Remove convenience functions.Justus Winter
2020-04-09openpgp: Rename PacketParserBuilder::finalize to build.Justus Winter
- Writers should be finalized, builders should be built.
2020-04-08openpgp: Impl TryFrom<PacketParserBuilder> for PacketPileParser.Justus Winter
2020-04-08openpgp: Fix error handling.Justus Winter
2020-04-03openpgp: Return impl Iterator instead of a concrete typeNeal H. Walfield
2020-04-03openpgp: Implement From<Cert> for PacketPile.Neal H. Walfield
2020-04-03openpgp: Implement FromIterator<Packet> for PacketPile.Neal H. Walfield
2020-04-03openpgp: Convert `PacketPile::from_packet_parser` to ↵Wiktor Kwapisiewicz
`TryFrom<PacketParserResult>`
2020-03-31openpgp: Improve summary line of modules and types.Justus Winter
- Avoid repeating the type name. - Avoid self referential, trivial descriptions. - Avoid the terms OpenPGP and Sequoia. - Fix mistakes from the Message -> PacketPile rework.
2020-03-31openpgp: Move definition of struct PacketPile.Justus Winter
- Implement Default for PacketPile, add internal accessor for the top-level.
2020-03-26Remove redundant field names.Wiktor Kwapisiewicz
2020-03-26openpgp: Change packet bodies to be tristate.Justus Winter
- Packet bodies can now be either unprocessed (e.g. compressed, encrypted), processed (e.g. uncompressed, decrypted), or structured (e.g. parsed into packets). - Make the container types deref to Container, and container deref to packet bodies. - This cleanly avoids the confusion when serializing containers: We can serialize compressed data packets with either body, but we can only serialize encryption containers with unprocessed bodies. - Fixes #187.
2020-03-13openpgp: Decouple PacketPile and Container.Justus Winter
- Likewise for the test.
2020-03-09Switch from failure to anyhow.Justus Winter
- Use the anyhow crate instead of failure to implement the dynamic side of our error handling. anyhow::Error derefs to dyn std::error::Error, allowing better interoperability with other stdlib-based error handling libraries. - Fixes #444.
2019-12-20openpgp: Use Container for Literal, Unknown.Justus Winter
- Embed Container in Literal and Unknown. This reuses code. - More importantly, Literal and Unknown now correctly implement PartialEq. - Unknown cannot implement Ord. Remove PartialOrd as well, it seems like an obscure use case to order packets. - An unfortunate consequence of Unknown not implementing Eq is that Cert cannot, because it holds unknown packets. We consider that unacceptable. - See #93.
2019-12-20openpgp: Trim set of container functions and reduce visibility.Justus Winter
2019-12-20openpgp: Embed struct Container in the container packets.Justus Winter
- This allows us to implement PartialEq and related traits more selectively. See #93.
2019-12-20openpgp: Move fields from Common to Container.Justus Winter
2019-12-20openpgp: Store literal data in struct Literal.Justus Winter
- With this change, packet::Common is only used by container packets.
2019-12-11openpgp: Make the PacketPileParser interface safe.Justus Winter
- Do not expose the PacketParserResult, improve error handling. - Fixes #278.
2019-11-25openpgp: Rename openpgp::constants to openpgp::types.Justus Winter
- Fixes #381.
2019-09-27linting: Clear up bare trait object warningsDaniel Silverstone
Newer Rust compilers requre `dyn` marking trait objects. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-09-18openpgp: Make Parse::from_bytes polymorphic over AsRef<[u8]>.Justus Winter
- A drawback of this change is that currently AsRef<[u8]> is not implemented for [u8; _], only for specific lengths. This is a compiler limitation that may be lifted in the future. This limitation required fixing some tests, notably those using include_bytes!. - Fixes #296.
2019-09-17openpgp: Make packet::Common::children private.Justus Winter
2019-09-17openpgp: Make packet::Common::body private.Justus Winter
2019-09-11openpgp: Rename packet::PacketIter to packet::Iter.Justus Winter