summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/src/packet
AgeCommit message (Collapse)Author
2020-08-05openpgp: Don't implement Default for the Bitflags types.Justus Winter
- See #525.
2020-06-17openpgp-ffi: Wrap the password handling functionality.Neal H. Walfield
- Wrap functions to create a password-protected certificate (`pgp_cert_builder_set_password`), and to work with keys that are password protected (`pgp_key_has_unencrypted_secret`, `pgp_key_decrypt_secret`).
2020-05-28openpgp: Change PKESK::decrypt to return an Option<_>.Justus Winter
- Returning rich errors from this function may compromise secret key material due to Bleichenbacher-style attacks. Change the API to prevent this. - Hat tip to Hanno Böck. - See #507.
2020-05-25ffi: Gracefully handle encrypted secret keys in pgp_pkesk_decrypt.Justus Winter
- Fixes #510.
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-02openpgp-ffi: Use UserIDAmalgamations, not UserIDBundles.Neal H. Walfield
- Add the `UserID`, `UserIDAmalgamation` and `ValidUserIDAmalgamation` types, and some associated methods. - Replace the use of `UserIDBundle` with `UserIDAmalgamation` and `ValidUserIDAmalgamation`.
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.
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-02-12openpgp: Add optional cipher argument to PKESK3::decrypt.Justus Winter
2020-01-21openpgp: Make the various keyflags() methods return an Option.Justus Winter
- This signals the absence of a subpacket. - Likewise for features(), key_server_preferences().
2020-01-07Fix broken links in the documentation.Justus Winter
2019-12-18openpgp: Make type aliases for keys pub(crate).Justus Winter
- They can still be used as a convenience, but the documentation will refer to them as their expanded counterparts. - This makes the structure of they Key<_, _> type more visible.
2019-12-09openpgp: Remove Signature::key_expired.Justus Winter
- Fixes #371.
2019-12-09openpgp: Remove Signature::signature_expired.Justus Winter
- See #371.
2019-12-09openpgp: Return Result from Signature::key_alive.Justus Winter
- See #371.
2019-12-09openpgp: Return Result from Signature::signature_alive.Justus Winter
- See #371.
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: Rename KeyFlag's accessors.Justus Winter
- Fixes #359.
2019-11-25OpenPGP User ID convention is "de facto" not "de factor"Daniel Kahn Gillmor
I'm not even sure if we even need to use "de facto" when we're also saying "convention", but i'm just doing a targeted fix here. The fact that this one string was copied around in a dozen places makes me a bit sad. If there are other changes to make in this boilerplate text, they'll also have to be made in a dozen places. I don't know enough about how sequoia is designed to be able to suggest a plausible boilerplate reduction strategy though. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-11-22openpgp: Make conversions into Key<SecretParts, _> fallible.Justus Winter
- Fixes #380.
2019-11-21openpgp: When parsing User IDs, recognize URIs.Neal H. Walfield
- Restore the functionality removed in 8693a005 when replacing the RFC 2822 mailbox parser.
2019-11-21openpgp: Replace time crate with std::time.Justus Winter
- In sq and sqv, use chrono to interface with the user. - Fixes #341.
2019-11-19openpgp: Be tolerant when deciding wheter a signature is alive.Neal H. Walfield
- Consider the following scenario: computer A's clock says 9:00.00 and signs and sends a message to computer B. Computer B's clock says 8:59.59, it receives the message and tries to verify it. From Computer B's perspective, the signature is not valid, because it was generated in the future. - This situation occured, because the two clocks were not completely synchronized. Unfortunately, a few seconds of clock skew are not unusual, particularly when dealing with VMs. - Since it is almost always better to consider such messages as valid, be tolerant when deciding whether a signature is alive.
2019-11-06openpgp: Replace RFC 2822 parser with a de factor parserNeal H. Walfield
- RFC 4880 says that "by convention, [a User ID Packet] includes an RFC 2822 [RFC2822] mail name-addr." This is not the actual convention, and attempting to parse User IDs using an RFC 2822 parser means that many common User IDs cannot be parsed. - Disparities between the actual convention and the stated convention include: - Neither users nor the software they use to create keys correctly quotes User IDs: - 'Nachname, Vorname <name@example.org>' is not valid, because it contains an unquoted comma. It should be 'Nachname\, Vorname <name@example.org>' or '"Nachname, Vorname" <name@example.org>'. (The same goes for dots, single quotes, etc.) - 'user@example.org <user@example.org>' is not valid, because it contains an unquoted at symbol. - 'Bj=?utf-8?q?=C3=B6?=rn <bjoern@example.net>' is encoded using RFC 2047, which is what RFC 2822 mandates when using non-ASCII characters, but no OpenPGP software would decode this User ID. In practice, everyone just uses UTF-8 (in this case: 'Björn <bjoern@example.net>'). - There are many examples of User IDs containing raw email addresses ('user@example.org'). But, these are not "name-addr"s. At best, they are RFC 2822 "mailbox"es. - Some User IDs only contain a name (e.g, "Frank PGP"). - RFC 2822 also includes a lot of complexity that no one uses or needs. For instance, CFWS (comments and folding whitespace) can be placed everywhere, and the rules for parsing them are complex. - Instead of continuing to bend the RFC 2822 parser to our will, we instead accept reality. - This patch replaces the RFC 2822 parser with a significantly simpler parser, which is based on actual convention (i.e., User IDs in the wild). - This parser is based on dkg's mail to the OpenPGP working group mailing list. Message-ID: <87woe7zx7o.fsf@fifthhorseman.net> https://mailarchive.ietf.org/arch/msg/openpgp/wNo27-0STfGR9JZSlC7s6OYOJkI - This initial version has one notable regression with respect to the RFC 2822 parser: it doesn't handle User IDs holding URIs.
2019-10-28openpgp-ffi: Fix returning pgp_tag_t.Justus Winter
- Force pgp_tag_t to have a defined size, and return integers of that size from the ffi glue. - This problem did only manifest itself when compiling with opt-level=1.
2019-10-27Fix more spelling errors caught by codespellDaniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-18openpgp: Combine Signature4::signature_alive and its _at variant.Neal H. Walfield
- Combine Signature4::signature_alive and Signature4::signature_alive_at. - Use an Into<Option<time::Tm>> to distinguish the two previous cases: the current time (None), and a specific time (a time::Tm).
2019-09-18openpgp: Combine Signature4::signature_expired and its _at variant.Neal H. Walfield
- Combine Signature4::signature_expired and Signature4::signature_expired_at. - Use an Into<Option<time::Tm>> to distinguish the two previous cases: the current time (None), and a specific time (a time::Tm).
2019-09-18openpgp: Combine Signature4::key_alive and its _at variant.Neal H. Walfield
- Combine Signature4::key_alive and Signature4::key_alive_at. - Use an Into<Option<time::Tm>> to distinguish the two previous cases: the current time (None), and a specific time (a time::Tm).
2019-09-18openpgp: Combine Signature4::key_expired and its _at variant.Neal H. Walfield
- Combine Signature4::key_expired and Signature4::key_expired_at. - Use an Into<Option<time::Tm>> to distinguish the two previous cases: the current time (None), and a specific time (a time::Tm).
2019-08-23openpgp: Use marker types to denote a Key's type.Neal H. Walfield
- In addition to providing some added protection, this allows us to implement 'From<Key<_, _>> for Packet'.
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-28openpgp-ffi: Use PublicKey::bits().Justus Winter
- See #154.
2019-06-26openpgp-ffi, ffi, ffi-macros: Avoid deprecated integer types.Justus Winter
2019-05-31ffi: Add bindings for User ID constructorsNeal H. Walfield
- Add bindings for the new User ID constructors, UserID::from_address and UserID::from_unchecked_address.
2019-05-30openpgp: Make PKESK::decrypt use crypto::Decryptor.Justus Winter
2019-05-28openpgp-ffi: Add bindings for new UserID methodsNeal H. Walfield
- Providing bindings for UserID::other and UserID::address_or_other. - Improve related documentation to reflect the changes to the parser.
2019-05-17openpgp-ffi: Typo.Justus Winter
2019-05-15openpgp-ffi: Add some bindings for Literal data packetsNeal H. Walfield
2019-05-10openpgp-ffi: Use new-style unwrapping for packetsNeal H. Walfield
- pgp_tpk_merge_packets was still using old-style unwrapping for the array of Packets although Packets now use new-style wrapping. - Likewise pgp_signature_into_packet.
2019-05-08openpgp-ffi: Fix indentationNeal H. Walfield
2019-05-08openpgp-ffi: Use extern "C", not extern "system"Neal H. Walfield
2019-05-08openpgp-ffi: Add functions to instantiate UserIDsNeal H. Walfield
- Add pgp_user_id_new to instantiate from a c string. - Add pgp_user_id_from_raw to instantiate from a not-NUL-terminated buffer.
2019-05-07openpgp-ffi, ffi: Fix calling convention on Windows.Justus Winter
- Use `extern "C"` instead of `extern "system"`. The latter selects stdcall, which is only appropriate for talking to the Windows API.
2019-05-07openpgp-ffi: Add functions to extract the various parts of a User IDNeal H. Walfield
- Add pgp_user_id_name, pgp_user_id_comment, pgp_user_id_address, and pgp_user_id_address_normalized.
2019-04-29openpgp-ffi: Introduce a new Packet type.Justus Winter
- See #156.
2019-04-01openpgp-ffi: Add a convenience function to pretty print a packetNeal H. Walfield
2019-03-21openpgp: Rename `UserID::userid()` to `value()`.Justus Winter
- Fixes #224.
2019-03-21openpgp: Rename UserAttribute's accessors.Justus Winter
- See #224.
2019-03-11openpgp-ffi: Improve error messageNeal H. Walfield