summaryrefslogtreecommitdiffstats
path: root/openpgp/src/cert.rs
AgeCommit message (Collapse)Author
2022-06-27openpgp: Make Cert::insert_packets_merge take a FnMut.Justus Winter
- This way, the callback can have side-effects.
2022-06-15openpgp: Fix typo.Justus Winter
2022-06-14openpgp: Add a subkey builder.Neal H. Walfield
- Add `KeyBuilder` and `SubkeyBuilder` for creating a key, and attaching a subkey to a certificate. - See #483.
2022-06-14openpgp: Add Cert::insert_packets2 and Cert::insert_packets_merge.Justus Winter
- Cert::insert_packets2 is a variant of Cert::insert_packets that returns whether the certificate actually changed. Fixes #528. - Cert::insert_packets_merge is a variant of Cert::insert_packets2 that allows one to control how duplicate packets are handled. Fixes #494.
2022-06-08openpgp: New error condition, UnsupportedCert2.Justus Winter
- In contrast to UnsupportedCert, this variant carries all the packets that we failed to parse into a cert. Notably, this includes primary keys that we don't understand. Keeping the packets with the errors allows us to at least roundtrip the packets.
2022-06-08openpgp: Accept unknown packets in production rules.Justus Winter
- We validate certificate structures based on packet tags. In the past, this lead to problems where a secret key packet was parsed to an unknown packet because the secret bits were malformed. This lead to a crash in the generated parser because it was assuming to see a secret key packet, but got an unknown packet. - This was changed in cd5eb82edfb326d7cbde29ee105f9f88e045c240 so that we validate the certificate structure based on packet kinds, i.e. we would only consider a packet a secret key packet if we managed to parse it into one. However, this caused the parser to be overly strict, causing problems with forward compatibility, and the parser to return an Error::MalformedCert instead of an Error::UnsupportedCert (see #170). - Return to validating on packet tags, but make the parser code aware that we may have parsed some packets (like secret key packets) to unknown packets. - This effectively reverts commit cd5eb82edfb326d7cbde29ee105f9f88e045c240. - Fixes #170.
2022-05-06autocrypt, net: openpgp: Rewrite all usages of `Reader::new`.Wiktor Kwapisiewicz
2022-04-27openpgp: Make Cert::merge_public_and_secret safe and usable.Justus Winter
- Previously, Cert::merge_public_and_secret was not predictable with respect to which secrets are kept (due to unstable sorting). It also didn't document which secrets would be kept. All in all that made the function unpredictable, and hence unsafe and not usable. - Document that the secrets in `other` are preferred over the ones in `self`. Implement that by first sorting components using a stable sort algorithm, then preferring the merged in (now predictably the latter) secrets over existing ones. Add a test. - Fixes #843.
2022-04-27openpgp: Improve test.Justus Winter
2022-03-03openpgp: Avoid unnecessarily allocating a Vec.Neal H. Walfield
2022-02-28openpgp: Improve tracing.Justus Winter
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-11-29Remove unnecessary conversions.Nora Widdecke
- Found with clippy::useless_conversion.
2021-11-29Use std::mem::take instead of std::mem::replace, for clarity.Nora Widdecke
- Replace let bar = std::mem::replace(&foo, Default::Default()); with let bar = std::mem::take(&foo); The new version seems a little clearer. - Found by clippy: https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default
2021-11-29Remove unnecessary slicing.Nora Widdecke
- Found by clippy::redundant_slicing.
2021-11-29Remove unnecessary borrows.Nora Widdecke
- Fixed with the help of clippy::needless_borrow.
2021-11-23openpgp: Implement From instead of Into.Nora Widdecke
2021-11-18openpgp: Use a WASM-friendly SystemTime::now wrapper.Justus Winter
- Fixes #769.
2021-10-11openpgp: Correct links.Nora Widdecke
2021-10-05Fix typos.Neal H. Walfield
2021-09-30Remove evaluation order dependenceLars Wirzenius
In this code: self.user_attributes.retain(|_| (keep[i], i += 1).0); it can be unclear to the reader that the increment of i actually happens before keep is indexed. Especially so for people who've been inflicted by C and its many surprising reasons for undefined behavior. It seems better to write this using an iterator. Found by clippy lint eval_order_dependence: https://rust-lang.github.io/rust-clippy/master/index.html#eval_order_dependence
2021-09-16openpgp: Skip tests if a required algorithm is not supported.Justus Winter
2021-09-16openpgp: Avoid generating RSA keys longer than 2k in tests.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-08-27openpgp: Fix links in documentation.Nora Widdecke
2021-08-27openpgp: De-duplicate cert components before checking signatures.Justus Winter
- Before we do anything, we'll order and deduplicate the components. If two components are the same, they will be merged, and their signatures will also be deduplicated. This improves the performance considerably when we update a certificate, because the certificates will be most likely almost identical, and we avoid about half of the signature verifications. - And indeed, benchmarking shows a 45% performance improvement on a typical cert. - Fixes #644.
2021-08-27openpgp: Improve cert canonicalization.Justus Winter
- When reconsidering signatures on unknown components, consider all signatures in the bundle.
2021-08-27openpgp: Improve tracing.Justus Winter
2021-08-27openpgp: Update NEWS.Justus Winter
2021-08-19openpgp: Implement PartialEq for TSK.Justus Winter
- Comparing Certs ignores any secret key material, in accordance with our definition of equality based on the serialized form. To take secret key material into account, define equality of TSKs. - Fixes #701.
2021-08-17openpgp: Hint at how to encrypt and decrypt keys in a cert.Justus Winter
- Fixes #731.
2021-08-17openpgp: Word secret in 'secret key material' was duplicated.Alexander Kjäll
2021-07-16openpgp: Fix and improve documentation.Justus Winter
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-07-08cert: support policy_uri subpacketEli Flanagan
- adds a new method to support the [Policy URI subpacket](https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.20). Close #536.
2021-05-19openpgp: Improve Cert::insert_packets.Neal H. Walfield
- The current implementation of `Cert::insert_packets` is O(n*m) where n is the number of signatures in the certificate and m is the number of signatures in the packets to insert. - Be smarter. Put the signatures in a BTreeMap and search it instead of doing a linear scan to see if we already have a given packet. - Fixes #706.
2021-04-26openpgp: Add high-level interface for attested certifications.Justus Winter
- Fixes #335.
2021-04-26openpgp: Implement ComponentBundle::attestations, improve example.Justus Winter
- See #335.
2021-04-26openpgp: Expose low-level functions for attestation key signatures.Justus Winter
- See #335.
2021-04-26openpgp: Expose support for attested certifications.Justus Winter
- This is a low-level interface. We will provide nicer abstractions in a followup. - See #335.
2021-04-20openpgp: Fix some more links.Justus Winter
2021-04-09Lint: Use next instead of nth(0).Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero
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: Remove unnecessary conversions.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
2021-04-09openpgp, sq: Remove redundant semicolons.Wiktor Kwapisiewicz
- Compiling with 1.51 toolchains prints warnings about redundant semicolons. Remove them.
2021-03-29Clarify/fix wording in documentation.Heiko
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.
2021-03-17openpgp: Improve tests related to encrypted keys.Justus Winter
- Add a test exercising key encryption. - Demonstrate that key packets are correctly replacing existing packets when using Cert::insert_packets.