summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types
AgeCommit message (Collapse)Author
2022-06-10openpgp: Add docs to PublicKeyAlgorithm's Display impl.Wiktor Kwapisiewicz
- Adjust the attribute to reduce the number of #[allow]s.
2022-06-10openpgp: Provide short names for AEADAlgorithm.Wiktor Kwapisiewicz
- Long names are still supported using the alternate format specifier. - Update NEWS file. - Fixes #803.
2022-06-10openpgp: Provide short names for SymmetricAlgorithm.Wiktor Kwapisiewicz
- Long names are still supported using the alternate format specifier.
2022-06-10openpgp: Provide short curve names by default.Wiktor Kwapisiewicz
- Leave long names as alternate format.
2022-06-09openpgp: Deprecate DataFormat::MIMEWiktor Kwapisiewicz
- Deprecate the enum variant in preparation for v2 removal to let API clients adjust their code as early as possible. - Update NEWS. - See #863.
2022-06-08openpgp: Make PublicKeyAlgorithm descriptions shorter.Wiktor Kwapisiewicz
- Make the previously long description available using the "alternate" (#) format specifier. - Make the default description short. - Update subplot tests to use short algorithm names. - Fixes #803.
2022-05-12openpgp: Add Curve::field_size.Justus Winter
2022-03-02openpgp: Disable doctest if padding is not available.Justus Winter
2022-03-02openpgp: Fix test.Justus Winter
- We cannot assert that an algorithm is supported in tests.
2022-02-08openpgp: Fix test.Justus Winter
- We cannot make that kind of assumption in a test.
2021-12-13ipc, openpgp: Bump quickcheck to 1.0.3.Nora Widdecke
- Adapt to the new API: - Gen is now a struct, not a Trait, and replaces StdThreadGen. - The rand re-export has been removed. As a consequence, we need our own function to generate an arbitrary value from a range.
2021-12-13openpgp: Fix duration_round_up test.Nora Widdecke
- If the round_up clampes the value to u32::MAX, the precision does not apply. - Closes #784.
2021-11-29openpgp, sq: Drop unneeded clone on a Copy value.Nora Widdecke
- Found by clippy::clone_on_copy lint.
2021-11-29Drop unnecessary lifetime annotations.Nora Widdecke
- Continuation of e6a335b93a10620bcb7cbfa32e232949758f0c99.
2021-11-29Use range syntax.Nora Widdecke
- Use range syntac instad of manual comparisons. This is arguably better to read. - Found by clippy::manual_range_contains.
2021-11-18openpgp: Use a WASM-friendly SystemTime::now wrapper.Justus Winter
- Fixes #769.
2021-11-09openpgp: Fix documentation, add missing KeyFlags::clear_group_key.Justus Winter
2021-09-30Add an is_empty method when len is thereLars Wirzenius
It is customary for Rust data container structures to have both is_empty and len, methods, because is_empty can both more to the point and also faster to implement. Sometimes is_empty makes no sense, as it doesn't for openpgp::types::Curve, which isn't a container structure. Arguably it would be better to rename Curve::len to something like Curve::bits, but as that would change the API, I've opted to tell clippy that not having is_empty in this case is OK. Found by clippy lint len_without_is_empty: https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
2021-09-30Use .iter() instead of .into_iter()Lars Wirzenius
Just call the .iter() method instead of .into_iter() when either is OK. The shorter form is shorter and should thus be easier to read. Found by clippy lint into_iter_on_ref: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
2021-09-30Use a clearer and shorter += or /= operationLars Wirzenius
Rewrite: i = i + 1 as i += 1 For a simple variable this is shorter, and a little bit clearer. For more complex expressions it avoids making the reader having to visually check that the left and right hand side of the assignment really do have the same expression and that nothing tricky is going on. This was found by the clippy lint assign_op_pattern: https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
2021-09-21Avoid matching on &Foo, when a plain Foo pattern worksLars Wirzenius
The extra & in a pattern (match arm or if let) is unnecessary and only makes the code harder to read. In most places it's enough to just remove the & from the pattern, but in a few places a dereference (*) needs to be added where the value captured in the pattern is used, as removing the & changes the type of the captured value to be a reference. Overall, the changes are almost mechanical. Although the diff is huge, it should be easy to read. The clippy lint match_ref_pats warns about this. See: https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
2021-09-16openpgp: Don't assert that the NIST curves are supported.Justus Winter
2021-09-16openpgp: Make list of supported algorithms backend-dependent.Justus Winter
2021-08-27openpgp: Correct links.Nora Widdecke
- Some link targets have moved or were replaced since the link's creation. Make them point to the new location or replacement.
2021-08-27ffi, openpgp: Cleanup links after cargo intraconv.Nora Widdecke
- openpgp: Make broken relative links absolute: - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+packet),\1crate::packet,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+cert),\1crate::cert,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+parse),\1crate::parse,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+policy),\1crate::policy,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+serialize),\1crate::serialize,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+armor),\1crate::armor,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+types),\1crate::types,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!] *(\[`PacketPile`\]):).*$,\1 crate::PacketPile,' {} + - openpgp: Link to PacketParser and Policy structs, not the modules. - ffi: Make links to sequoia_openpgp and sequoia_net absolute - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+sequoia_openpgp),\1sequoia_openpgp,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+sequoia_net),\1sequoia_net,' {} +
2021-08-27Convert markdown to intra-doc links.Nora Widdecke
- Apply cargo intraconv.
2021-07-16openpgp: Add missing ValidCert::revocation_keys.Justus Winter
- The documentation refers to this function, however, until now it was missing. Adding it is simple enough, but technically breaks the API, because it breaks callers invoking ValidCert::revocation_keys, which would previously deref to Cert::revocation_keys. - Avoid the breakage by adding an optional argument, which should be None but can be Some(_) in order to appease existing users. See #725.
2021-06-28openpgp: Fix classification of unknown public key algorithms.Justus Winter
- Conservatively consider unknown algorithms encryption- and signing-capable. - Fixes parsing of PKESK and Signature packets using unknown algorithms. - Fixes #722.
2021-04-26openpgp: Expose low-level functions for attestation key signatures.Justus Winter
- See #335.
2021-04-09Lint: Use is_empty().Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#len_zero - https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
2021-04-09Lint: Use matches! macro.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
2021-04-09Lint: Remove redundant closures.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
2021-04-09Lint: Remove unnecessary conversions.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
2021-04-06openpgp: Fix SystemTime test.Nora Widdecke
- The size of SystemTime is an implementation detail of the standard library and does not give a direct indication whether values larger that i32::MAX will fit in it. - Adjust the test to observe if we are on a system can represent a large value as a SystemTime or not, and assert that the values are clamped correctly.
2021-04-06openpgp: Correct system_time_32_bit test.Daniel Kahn Gillmor
@nwalfield suggested this correction in #697
2021-04-06openpgp: Enable time_t overflow test on other 32-bit platforms.Daniel Kahn Gillmor
on Debian GNU/Linux systems, time_t is 4 octets for i386 (rust calls this platform target_arch "x86"), armel ("arm"), armhf ("arm"), and mipsel ("mips"). I've pulled these arch names from platforms [0]. [0] https://github.com/RustSec/platforms-crate/blob/main/src/target/arch.rs There are likely other platforms that have a 32-bit time_t (and indeed, some variants of 32-bit platforms like musl may have a 64-bit time_t [1]), so this gating mechanism still isn't quite right. But it's an improvement over the status quo of just gating on target_arch = "x86". [1] https://musl.libc.org/time64.html
2021-03-30Minor edits in documentation.Heiko
2021-03-05openpgp: Fix SystemTime from Timestamp on 32bit.Nora Widdecke
- SystemTime's underlying datatype may be only `i32`, e.g. on 32bit Unix. As OpenPGP's timestamp datatype is `u32`, there are timestamps (`i32::MAX + 1` to `u32::MAX`) which are not representable on such systems. - To keep the API stable, instead of making the conversion fallible, clamp those too large values to i32::MAX.
2021-02-10openpgp: Add HashAlgorithm::text_name.Justus Winter
2021-02-10openpgp: Make HashAlgorithm::from_str ignore case.Justus Winter
2021-01-19openpgp: Implement verification of attested key signatures.Justus Winter
- Note that the spec is still in flux, therefore we don't expose it.
2020-12-15openpgp: Use Feb. 1st instead of Jan. 1st as the cutoff day.Neal H. Walfield
- January 1st is a holiday in much of the world. - When we disable an algorithm, things will almost certainly break somewhere. - Reduce the chance that things break when people are on vacation by using February 1st as the cutoff day instead of January 1st.
2020-12-14openpgp: Add Duration::years.Neal H. Walfield
- Add `Duration::years`. - This function assumes that there are 365.2425 days in a year, which is the average number of days in a year in the Gregorian calendar.
2020-12-14openpgp: Make Duration::seconds a const fn.Neal H. Walfield
- Make `Duration::seconds` a const fn.
2020-12-11openpgp: Remove ComponentAmalgamation::revocation_keys.Wiktor Kwapisiewicz
- Remove the function. - Remove associated tests. - Cert::revocation_keys does examine all live self-signatures. - Fixes #629.
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-08openpgp: Make unnamed iterators Send + Sync.Justus Winter
- See #615.
2020-12-08openpgp: Add assert_send_and_sync! for more types.Azul
- All types that are `Send` and `Sync` are checked now. - Fixes #627.
2020-12-08openpgp: Use parens for assert_send_and_sync!.Azul