summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2024-01-26anyhow -> 1.0.76neal/performanceNeal H. Walfield
2024-01-26anyhow -> 1.0.77Neal H. Walfield
2024-01-26anyhow -> 1.0.78Neal H. Walfield
2024-01-26anyhow 1.0.75 -> 1.0.79Neal H. Walfield
2024-01-26Disable most ci jobs.Neal H. Walfield
2024-01-26Revert dependency update.Neal H. Walfield
2024-01-25openpgp: Release 1.18.0.Neal H. Walfield
2024-01-25openpgp: Upgrade idna.Neal H. Walfield
2024-01-25Update dependencies.Neal H. Walfield
2024-01-25openpgp: Implement Arbitrary for KeyHandle, add tests.Justus Winter
2024-01-25openpgp: Make KeyHandle::partial_cmp transitive.Justus Winter
- Previously, KeyHandle::partial_cmp tried to sort aliasing handles together. However, this made the function not transitive, which is required by implementations of PartialOrd. - Fix this by simply comparing the byte representations, and computing aliasing in KeyHandle::aliases. - Note: This makes PartialOrd (and PartialEq) total, but we still don't implement Ord (and Eq) to prevent naive comparisons.
2024-01-25openpgp: Improve deprecation note.Justus Winter
2024-01-25openpgp: Deprecate Cert::into_packets.Justus Winter
2024-01-25openpgp: Add Cert::into_packets2, TSK::into_packets.Justus Winter
- Cert::into_packet is problematic because it does not protect from accidentally leaking secret key material. The documentation even warns about that, but it still happened. Hence, this is a violation of our safe-by-default principle guiding the API, and we should fix it. - The replacement, Cert::into_packets2, strips secret key material just as serializing a cert does. To convert to a sequence of packets while keeping the secret key material, a new function is added: TSK::into_packets, analogous to how TSK serializes secret key material.
2024-01-25openpgp: Factor out code adding a secret key stub.Justus Winter
2024-01-25openpgp: Make TSK optionally own the Cert.Justus Winter
2024-01-25openpgp: Tweak lifetime of filter function's argument.Justus Winter
- Previously, the filter operated on references with the lifetime 'a only, which is the lifetime associated with the Cert the TSK object references. Change the signature to take a reference with an anonymous lifetime instead. - This makes the filter more general, but it can no longer rely on the fact that the references are live for 'a. However, the function is a Fn, not a FnMut, and returns a bool, so the function cannot store the reference anywhere, so this shouldn't make a difference in practice. - Annoyingly, there is a wrinkle. If a closure bound to an identifier is given to TSK::set_filter, the Rust compiler incorrectly (or over eagerly?) specializes the function in a way that it doesn't match the callback's prototype: error[E0308]: mismatched types --> openpgp/src/serialize/cert.rs:946:16 | 946 | check!(tsk_0.as_tsk().set_filter(no_secrets), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected trait `for<'a> Fn<(&'a packet::Key<packet::key::SecretParts, packet::key::UnspecifiedRole>,)>` found trait `Fn<(&packet::Key<packet::key::SecretParts, packet::key::UnspecifiedRole>,)>` note: this closure does not fulfill the lifetime requirements --> openpgp/src/serialize/cert.rs:940:26 | 940 | let no_secrets = |_| false; | ^^^ note: the lifetime requirement is introduced here --> openpgp/src/serialize/cert.rs:318:23 | 318 | where P: 'a + Fn(&key::UnspecifiedSecret) -> bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of `FnOnce` is not general enough --> openpgp/src/serialize/cert.rs:946:16 | 946 | check!(tsk_0.as_tsk().set_filter(no_secrets), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 packet::Key<packet::key::SecretParts, packet::key::UnspecifiedRole>) -> bool` must implement `FnOnce<(&'1 packet::Key<packet::key::SecretParts, packet::key::UnspecifiedRole>,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 packet::Key<packet::key::SecretParts, packet::key::UnspecifiedRole>,)>`, for some specific lifetime `'2` This is easily fixed by providing a partial type for the callback's argument. This commit includes a tweak for our test.
2024-01-25net: Derive Clone for KeyServer.Justus Winter
2024-01-25openpgp: Reject short key IDs.Neal H. Walfield
- When parsing a key ID string, reject short key IDs. - Note: we can't reject short key IDs in `KeyID::from_bytes`, because that function in infallible. But, that function does return `KeyID::Invalid` when presented with a short key ID. - Fixes #388.
2024-01-24openpgp: Improve example.Neal H. Walfield
- Simplify initialization. - Use `KeyHandle::aliases` to compare two `KeyHandle`s.
2024-01-24openpgp: Improve documentation.Neal H. Walfield
- Add references to related functions.
2024-01-24openpgp: Use SubpacketAreas::issuers to get issuer subpackets.Neal H. Walfield
- When checking for an issuer subpacket, `SubpacketAreas::issuers`, not `SubpacketAreas::get_issuers`.
2024-01-24openpgp: Use KeyHandle::aliases to check for a fingerprint.Neal H. Walfield
- When checking of a list of issuers contains a fingerprint, use `KeyHandle::aliases`, don't search for the fingerprint, and then the key ID.
2024-01-24openpgp: Add UserID::from_static_bytes, which is constant.Neal H. Walfield
- Add `UserID::from_static_bytes`, which is equivalent to `UserID::from` for a byte slice, but is a constant function.
2024-01-23openpgp: Avoid unnecessary heap allocations when creating UserIDs.Neal H. Walfield
- When creating a `UserID`, avoid unnecessary heap allocations by making better use of what we have. For example, we can directly convert a `String` to a `Vec<u8>` without allocating a `Vec<u8>`, and copying the contents.
2024-01-23openpgp: Fix comparing SKESK5 objects.Justus Winter
- See !1592.
2024-01-23Fix example.Justus Winter
- Previously, the if let was infallible, and rightfully flagged by rustc.
2024-01-23buffered-reader: Implement BufferedReader for &mut BufferedReader.Neal H. Walfield
- Implement `BufferedReader` for `&mut T` where `T: BufferedReader`. - Implementing `BufferedReader` for `&mut T` where `T: BufferedReader` means that we can pass a mutable reference to a buffered reader where a buffered reader is required, and when the reference is dropped, we can continue to use the buffered reader.
2024-01-23openpgp: Only export a certificate if it is exportable.Neal H. Walfield
- Currently, we are careful to not export components (user IDs, and subkeys) if they don't have any exportable self signatures, however, we still export the primary key. Further, the primary user ID is leaked when the output is armored. - When exporting a certificate, correctly check if the certificate is exportable. If it isn't, don't export anything.
2024-01-23openpgp: Add Cert::exportable.Neal H. Walfield
- Add `Cert::exportable` to return whether a certificate is exportable or not. - A certificate should only be exported if it has at least one exportable direct key signature, or there is at least one user ID or user attribute with at least one exportable self-signature.
2024-01-23openpgp: Add a method to CertBuilder to make non-exportable certs.Neal H. Walfield
- Add `CertBuilder::set_exportable`, which sets the exportable flag accordingly on all generated signatures. - This allows the easy creation of non-exportable certificates, which is recommended by the OpenPGP Certificate Directory specification for the local trust root: > The trust root is an OpenPGP certificate that is stored under > the special name trust-root. > > The certificate: > > SHOULD use direct key signatures or binding signatures that are marked as non-exportable. https://www.ietf.org/archive/id/draft-nwjw-openpgp-cert-d-00.html#section-3.5.1 - Fixes #1082.
2024-01-23openpgp: Fix the documentation for Key4::import_public_ed25519.Neal H. Walfield
- Ed25519 keys use the EdDSA signature algorithm, but the documentation mentions parameters for ECDH. - It appears that the documentation was copied from `Key4::import_public_cv25519`, and not adjusted. - Fix it.
2024-01-23openpgp: Fix the documentation for Key4::import_secret_ed25519.RyanSquared
- Ed25519 keys use the EdDSA signature algorithm, but the documentation mentions parameters for ECDH. - It appears that the documentation was copied from `Key4::import_secret_cv25519`, and not adjusted. - Fix it.
2024-01-22openpgp: Add Parse::from_buffered_reader.Justus Winter
- Add a buffered-reader-based function to trait Parse. This allows us to manipulate the buffered reader stack before and after parsing, e.g. to parse several armored objects in one stream. The CertParser also does this, but uses internal interfaces for that.
2024-01-22openpgp: Rename every from_buffered_reader to from_cookie_reader.Justus Winter
- This is an internal interface that uses our reader stack's cookie. We need this to traverse the buffered reader stack. We did not, however, expose it as an external interface, because we didn't want to bake in the cookie type into the API. - Having a public API that operates on buffered readers is convenient: the current Parser::from_reader operates on io::Readers, and will most likely construct a buffered_reader::Generic from it. This will eagerly buffer some data, making this interface unsuitable if you want to read in one artifact (e.g. an MPI) without consuming more data. - Renaming the internal functions gives us a chance to add a more general buffered reader interface.
2024-01-22openpgp: Simplify Parse implementations by using the macro.Justus Winter
2024-01-18openpgp: Serialize TSKs without secrets with appropriate label.Justus Winter
- Previously, we emitted the PRIVATE KEY label when armoring TSKs that don't in fact contain secrets, confusing users. - See https://gitlab.com/sequoia-pgp/sequoia-sq/-/issues/14 - Fixes #1075.
2024-01-18openpgp: Improve test.Justus Winter
2024-01-13openpgp: Fix Key conversions.Neal H. Walfield
- The public ABI has a bug. - The documentation for `Key` says that a `Key<SecretParts, R>` must have secret key material: > If P is key::SecretParts, then the key definitely contains > secret key material (although it is not guaranteed that the secret > key material is valid), and methods that require secret key > material are available. https://gitlab.com/sequoia-pgp/sequoia/-/blob/a9982139/openpgp/src/packet/mod.rs#L1249-1256 - Unfortunately, we accidentally provided infallible conversions from `Key<PublicParts, R1>` to `Key<SecretsParts, R2>` and `Key<UnspecifiedParts, R1>` to `Key<SecretsParts, R2>` where `R1 != R2`. - These conversions are wrong, and useless: attempting to use a method on a `Key<SecretsParts, R2>` that expects the `Key` to have secret key material, but doesn't results in a panic. - Removing these methods converts run-time errors into compile-time errors. As such, we do not consider this change to result in a change to the semantic version. - Make the conversions to `Key<key::SecretsParts, R>` fallible. - Fixes #740.
2024-01-12Update contribution guidelines.Neal H. Walfield
2024-01-12guide: Fix references to the sq and sqv repositories.Neal H. Walfield
- We've split `sq` and `sqv` into their own repositories. Update the links. - #999.
2024-01-12openpgp: Wrap bare email addresses in angle brackets.Neal H. Walfield
- Change `UserID::from_address` to wrap a bare address in angle brackets. That is, change `UserID::from_address` so that `UserID::from_address(None, None, "alice@example.org")` maps to `<alice@example.org>` not `alice@example.org`. This has the advantage that the standard regular expression for scoping CAs can match bare email addresses, see: https://docs.sequoia-pgp.org/sequoia_openpgp/regex/index.html#caveat-emptor - Fixes #1076.
2024-01-12openpgp: Simplify validating third-party revocations.Neal H. Walfield
- Add `UserIDAmalgamation::valid_third_party_revocations_by_key` and `KeyAmalgamation::valid_third_party_revocations_by_key`, which return third-party revocations that were made by a particular key at a particular time, i.e., they also verify that the signatures are valid.
2024-01-12openpgp: Simplify validating third-party certifications.Neal H. Walfield
- Add `UserIDAmalgamation::valid_certifications_by_key` and `KeyAmalgamation::valid_certifications_by_key`, which return third-party certifications that were made by a particular key at a particular time, i.e., they also verify that the signatures are valid. - Add `UserIDAmalgamation::active_certifications_by_key` and `KeyAmalgamation::active_certifications_by_key`, which return the active certifications made by a particular key at a particular time.
2024-01-12openpgp: Simplify working with third-party certifications.Neal H. Walfield
- Add `ComponentAmalgamation::certifications_by_key`, which returns third-party certifications that appear to be made by a particular key. Specifically, this function only checks that the certificates include a matching issuer or issuer fingerprint subpacket; the certifications are not verified.
2024-01-02net: Make the tempfile dependency a dev-dependency.Justus Winter
2024-01-02openpgp: Require the rand crate only for tests and RustCrypto.Justus Winter
- Also, disable the default features and enable only what we need.
2024-01-02openpgp: Use the dep: syntax to avoid creating features.Alexander Kjäll
- Previously, all optional dependencies created implicit features. This is unnecessary in our case, and may cause friction for packagers. See https://doc.rust-lang.org/cargo/reference/features.html
2023-12-21openpgp: Make VerificationError implement std::error::ErrorRyanSquared
- This allows the use of `Into::into(e)` in `VerificationHandler` to transform the error into an `anyhow::Error`.
2023-12-05openpgp: Preserve more information when cloning packet::Unknown.Justus Winter
- anyhow::Error isn't Clone, so we cannot, in general, duplicate the error without losing information. We can try to downcast to the most likely errors, and clone them, but this can never cover all possibilities. - Further, the error wrapped in std::io::Error isn't clone, so we necessarily lose information when cloning this, even after we changed Sequoia to return concrete errors. - I think this is the best we can do, at least for now. - Fixes #1068.