summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse/packet_parser_builder.rs
AgeCommit message (Collapse)Author
2020-06-24openpgp: Simplify tests.Justus Winter
2020-06-08openpgp: Add example.Justus Winter
- See #471.
2020-06-08openpgp: Make the default for Dearmor explicit.Justus Winter
2020-04-30openpgp: Improve documentation of the parse module.Justus Winter
- See #471.
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-09openpgp: Rename PacketParserBuilder::finalize to build.Justus Winter
- Writers should be finalized, builders should be built.
2020-04-09openpgp: Rename MAX_RECURSION_DEPTH and make it public.Justus Winter
- Rename to DEFAULT_MAX_RECURSION_DEPTH to better reflect the fact that it is not a absolute maximum, but only the default. Make it public so that the documentation can refer to that.
2019-11-28Call TPKs Certificates, update identifiers, documentation.Justus Winter
- Fixes #387.
2019-10-30buffered-reader: Fix Generic::data_helper.Neal H. Walfield
- The `Generic::data_helper` was not sufficiently careful when dealing with errors. In particular: - If `Generic::data_hard(1)` was called, and an error occured, and nothing was buffered or read, `Generic::data_helper` would return the empty string instead of the error. - If `Generic::data(n)` was called, and an error occured, but some data (< n bytes) was buffered, `Generic::data_helper` would return the error instead of the data that was read. - Fix these bugs. - Also, simplify the code and don't save whether we hit EOF or the error (which we can only return once, anyway). Instead, rely on the underlying reader to return EOF or the error again. - Fixes #174.
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-08-27openpgp: Limit size of non-data packets.Justus Winter
- This introduces a configurable limit for non-data (i.e. non-container) packets. This prevents a trivial DoS on our parser, which previously assumed that all non-data packets can be buffered. - Fixes #242.
2019-07-15Prepare for Rust 2018.Justus Winter
- This is the result of running `cargo fix --edition`, with some manual adjustments. - The vast majority of changes merely qualify module paths with 'crate::'. - Two instances of adding an anonymous pattern to a trait's function. - `async` is a keyword in Rust 2018, and hence it needs to be escaped (e.g. in the case of the net::r#async module). - The manual adjustments were needed due to various shortcomings of the analysis employed by `cargo fix`, e.g. unexpanded macros, procedural macros, lalrpop grammars.
2019-06-08openpgp: Make the reader mode configurable in Dearmor.Justus Winter
2019-05-14openpgp: Clean up test data handling.Justus Winter
- Use the new framework instead of including the files everywhere.
2019-05-11openpgp: Include the path in the MessageValidator errorNeal H. Walfield
- To ease debugging, include the path of the packet that caused the parse error.
2019-03-27openpgp: Move test file.Justus Winter
2019-03-26openpgp: Move Header::plausible to the header module, improve itNeal H. Walfield
- Rename Header::plausible to Header::valid. - Tighten the validity checks. - Add a future_compatible option that makes unknown packets valid.
2019-03-01buffered-reader: Drop BufferedReader prefix.Justus Winter
- For example, `buffered_reader::BufferedReaderMemory` is now called `buffered_reader::Memory`. This makes the type names less unwieldy. - Fixes #206.
2019-02-08openpgp: Use KeyringValidator and TPKValidator in the parser.Justus Winter
- Fixes #30.
2019-01-31openpgp: Make the armor decoder for PacketParserBuilder optionalNeal H. Walfield
- Currently, the PacketParserBuilder uses a heuristic to detect whether to push an ASCII armor decoder on the input. - Introduce a tri-state to the builder to allow the caller to control enable the heuristic, unconditionally push a decoder, or unconditionally treat the data as binary data.
2018-12-14openpgp: Introduce trait Parse.Justus Winter
- Trait Parse introduces a uniform interface to parse packets, messages, keys, and related data structures.
2018-11-26openpgp: Improve OpenPGP message detection heuristic.Neal H. Walfield
- Also, split out the code.
2018-11-24Rename the openpgp crate to sequoia-openpgp.Justus Winter
2018-11-22openpgp: Detect ASCII-Armored data and decode.Neal H. Walfield
- Add a basic check to the PacketParserBuilder to see if the message could be a binary OpenPGP message. If not, push an ASCII-Armor decoder.
2018-10-09openpgp: Don't make tracing configurable via the API.Neal H. Walfield
- The packet parser supports tracing its execution. - There is little need to enable this on a per-PacketParser basis. - As such, make tracing a compile-time only option.
2018-10-09openpgp: Drop redundant recursive_depth field.Neal H. Walfield
- The packet parser's recursive depth can be computed from the path, which we now track. As such, don't track the recursive depth separately, just derive it from the path.
2018-10-09openpgp: Track the packet's path in the packet parser.Neal H. Walfield
2018-09-17openpgp: Use the new reader.Justus Winter
- Use the new reader either directly, or make sure that calls to from_file(..) use it down the call chain.
2018-09-10openpgp: Simplify constructor.Justus Winter
2018-09-10openpgp: Move constructors.Justus Winter
2018-07-16openpgp: Add an API to query whether a PacketParser parsed a MessageNeal H. Walfield
- Add a MessageValidator to the PacketParserState struct. - Update it after parsing each packet's header. - Add methods to the PacketParser to query the MessageValidator.
2018-07-16openpgp: Don't pass the PacketParser's state by reference.Neal H. Walfield
- Instead of passing PacketParser::state around by reference or making copies, move it.
2018-07-16openpgp: Put PacketParser state in a separate field.Neal H. Walfield
- Move all state (currently just settings) that is relevant to the packet parser, as opposed to just the current packet, in a single field.
2018-07-02openpgp: Create a special Option-like type for PacketParser.Neal H. Walfield
- In the future, we want to return some summary information about a parsed packet sequence after the packet sequence is fully parsed. Currently, PacketParser::next() and PacketParser::recurse() consume the PacketParser and return None on EOF. Thus, even if the summary information were stored in the PacketParser, it becomes inaccessible on EOF. - This change introduces a new type, PacketParserResult, that contains either a PacketParser or a PacketParserEOF. PacketParserEOF is returned on EOF instead of None. Since it is a struct, it can hold only any information that we want to return to the caller.
2018-06-20Make sure there is always a whitespace after every comma.Justus Winter
- This is the result of executing find . \( -type f -and \( -name '*.rs' -or -name '*.h' \) \) \ -exec sed -i -e 's/,\([^[:space:]]\)/, \1/g' {} \; with one manual tweak in 'parse.rs'.
2018-06-06openpgp: Avoid making BufferedReader part of our public APINeal H. Walfield
- The `BufferedReader` trait is primarily an implementation detail. Thus, we avoid exporting Foo::from_buffered_reader constructors, and making public structures generic over `BufferedReader`.
2018-05-28openpgp: Move Message construction to the message moduleNeal H. Walfield
- The parse module includes functionality related to the *implementation* of the `PacketParser`. The `Message`-related functionality simply uses this API. Thus, move it to the `message` module.
2018-05-28openpgp: Move PacketParserBuilder to its own module.Neal H. Walfield
- Continue to declutter the parse.rs.