summaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'remove-impl' into 'main'Ian Jackson2023-11-301-9/+1
|\ | | | | | | | | tor-keymgr: Remove unnecessary impls for KeystoreCorruptionError. See merge request tpo/core/arti!1779
| * tor-keymgr: Remove unnecessary impls for KeystoreCorruptionError.Gabriela Moldovan2023-11-291-9/+1
| | | | | | | | | | | | | | These impl only exist because they were needed back when we didn't have the `tor_keymgr::Error` enum and all errors _had_ to implement `KeystoreError`. They are not used or required anymore, so let's remove them.
* | llcrypto: Hide the members of ExpandedKeypair.Nick Mathewson2023-11-292-2/+2
| | | | | | | | | | With this change, we no longer expose the ExpandedSecretKey unescorted, which makes it harder to misuse the API.
* | Remove RngCompatExt.Nick Mathewson2023-11-291-4/+2
| | | | | | | | | | | | | | | | | | | | This code was needed with the old version of dalek-cryptography, which wasn't compatible with up-to-date versions of the `rand` crate(s). But now that we've upgraded, we can drop this. (We could have left it around and deprecated it, but we are already making a breaking change to tor-llcrypto by upgrading dalek-cryptography.)
* | Convert to the latest versions of dalek-cryptographyNick Mathewson2023-11-292-13/+25
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes that we have to adjust for are as follows: * In x25519-dalek: * `StaticSecret` is now behind a feature. * `StaticSecret::new` is deprecated in favor of `StaticSecret::random_from_rng`. * StaticSecret no longer does its own clamping. * In ed25519-dalek: * `SecretKey` has (in effect) been renamed to `SigningKey`. The name `SecretKey` is now an alias for `[u8; 32]`. * `SigningKey` is effectively a keypair, since it contains a public key as well. * `PublicKey` has been renamed to `VerifyingKey`. * The functions to extract a signing key and verifying key have been renamed as you might expect. * `ExpandedSecretKey` has been moved to `hasmat` and no longer implements `sign`. * `ExpanededSecretKey` now has as its elements a scalar and a hash prefix. * Various functions that took `&[u8]` now take `&[u8; N]`. * We no longer need a wrapper for older versions of rand. There is a single test in tor-keymgr that does not pass. I've marked it as ignore for now, in hopes that @gabi-250 can help me figure it out. This closes #808. There are several changes I want to make before we merge, however. They are marked with TODO DALEK.
* tor-keymgr: Use CheckedDir::read_dir to validate dir permissions in list().Gabriela Moldovan2023-11-281-3/+13
| | | | | | | `ArtiNativeKeystore::list` now returns an error if the parent directory of any of its keys doesn't pass the `CheckedDir::read_dir` validation. Part of #1117
* tor-keymgr: Use the new CheckedDir::remove_file API.Gabriela Moldovan2023-11-281-20/+23
| | | | | | | This updates `ArtiNativeKeystore` to use the new `remove_file` API from arti!1759. Part of #1117
* tor-keymgr: Fix some broken docs linksIan Jackson2023-11-281-3/+3
|
* Merge branch 'keymgr-derive-builder' into 'main'gabi-2502023-11-283-52/+127
|\ | | | | | | | | | | | | tor-keymgr: Derive Builder for KeyMgr. Closes #1114 See merge request tpo/core/arti!1760
| * tor-keymgr: Write some KeyMgrBuilder functions by hand.Gabriela Moldovan2023-11-282-17/+93
| | | | | | | | | | | | | | Eventually these will need to be auto-generated, but that is not possible right now. Context: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1760#note_2969841
| * tor-keymgr: Abolish KeyMgr::new.Gabriela Moldovan2023-11-272-18/+0
| | | | | | | | We don't use this now that we have a `KeyMgrBuilder`.
| * tor-keymgr: Derive Builder for KeyMgr (fmt).Gabriela Moldovan2023-11-271-8/+11
| |
| * tor-keymgr: Derive Builder for KeyMgr.Gabriela Moldovan2023-11-273-37/+51
| | | | | | | | | | | | | | `KeyMgr` is soon going to have more fields, so now is a good time to derive `Builder` for it. Closes #1114
* | Merge branch 'keymgr-errors' into 'main'gabi-2502023-11-276-160/+155
|\ \ | | | | | | | | | | | | | | | | | | tor-keymgr: Add a top-level Error enum Closes #1113 See merge request tpo/core/arti!1751
| * | tor-keymgr: Return InvalidSshKeyData if the ssh key data is invalid (fmt).Gabriela Moldovan2023-11-211-2/+5
| | |
| * | tor-keymgr: Return InvalidSshKeyData if the ssh key data is invalid.Gabriela Moldovan2023-11-211-27/+20
| | | | | | | | | | | | | | | We were previously returning `internal!`, which is incorrect: this is a type of Arti keystore corruption error, not an internal error.
| * | tor-keymgr: Add an Arti keystore error type for keys with invalid key data.Gabriela Moldovan2023-11-211-0/+5
| | |
| * | tor-keymgr: Remove a TODO that is no longer relevant.Gabriela Moldovan2023-11-211-3/+0
| | | | | | | | | | | | | | | | | | `KeystoreCorruptionError` is now part of `tor_keymgr::Error` and no longer implements `KeystoreError` (the `KeystoreError` trait is now only for keystore-specific errors).
| * | tor-keymgr: Remove unnecessary trait function.Gabriela Moldovan2023-11-211-7/+0
| | | | | | | | | | | | We don't use this anymore.
| * | tor-keymgr: Add a top-level error type (fmt).Gabriela Moldovan2023-11-211-1/+4
| | |
| * | tor-keymgr: Add a top-level error type.Gabriela Moldovan2023-11-214-32/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the `tor_keymgr::Error` type was `Box<dyn KeystoreError>`. This forced us to impl `KeystoreError` for any error returned by the keymgr (including those that were not coming from a `Keystore` impl). Now, `tor_keymgr::Error` is an non-exhaustive enum and the `Box<dyn KeystoreError>` opaque error type is only returned from `Keystore` impls The reason we're keeping the `dyn KeystoreError` error type is because it enables `Keystore` implementors to use their own error types. Without it, they would have to choose from our (closed) set of error variants, which may not be suitable for their keystore. See #901.
| * | tor-keymgr: Add some derives for the dummy KeyType.Gabriela Moldovan2023-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | We are about to add a top-level `tor_keymgr::Error` enum that has a variant that contains a `KeyType`. The error enum needs to be `Clone`, so we need `KeyType` (both the dummy version and the "real" one, because the `err` module is not cfg'd behind the `keymgr` feature) to be `Clone`.
| * | tor-keymgr: Move ArtiPathError, KeystoreCorruptionError to err.rs.Gabriela Moldovan2023-11-213-54/+53
| | | | | | | | | | | | | | | | | | KeystoreCorruptionError is about to become a variant of the top-level keymgr Error enum (which doesn't exist yet but will be introduced in a future commit).
| * | tor-keymgr: Inline SshKeyError variants into ArtiNativeKeystoreError.Gabriela Moldovan2023-11-202-43/+34
| |/ | | | | | | An `SshKeyError` *is* an Arti keystore error, so let's unify the two.
* / tor-keymgr: impl ToEncodableKey for IPT keysIan Jackson2023-11-231-1/+25
|/
* Merge branch 'more-denotators' into 'main'gabi-2502023-11-201-14/+83
|\ | | | | | | | | | | | | tor-keymgr: Support encoding more than one denotator in an ArtiPath. Closes #1093 and #1112 See merge request tpo/core/arti!1747
| * tor-keymgr: Update ArtiPath docs.Gabriela Moldovan2023-11-201-5/+9
| |
| * tor-keymgr: Remove now-outdated TODO HSSs.Gabriela Moldovan2023-11-201-6/+0
| |
| * tor-keymgr: Support encoding more than one denotator in an ArtiPath.Gabriela Moldovan2023-11-201-3/+74
| | | | | | | | Closes arti#1112
* | Merge branch 'deprecate-hs-client-intro-auth' into 'main'gabi-2502023-11-201-14/+2
|\ \ | |/ |/| | | | | | | | | tor-hscrypto: Deprecate HsClientIntroAuth{Key, Keypair}. Closes #1037 See merge request tpo/core/arti!1749
| * tor-keymgr: Remove the ToEncodableKey impl of HsClientIntroAuthKeypair.Gabriela Moldovan2023-11-201-15/+0
| | | | | | | | | | `HsClientIntroAuthKeypair` is deprecated and no longer used as an "encodable key".
| * tor-keymgr: Allow the use of the newly deprecated HsClientIntroAuthKeypair ↵Gabriela Moldovan2023-11-201-4/+4
| | | | | | | | (fmt).
| * tor-keymgr: Allow the use of the newly deprecated HsClientIntroAuthKeypair.Gabriela Moldovan2023-11-201-1/+4
| |
* | tor-keymgr: Add TODO about possibly abolishing arti_pattern.Gabriela Moldovan2023-11-201-0/+3
| |
* | tor-keymgr: Make the arti_path_prefix() helper private.Gabriela Moldovan2023-11-201-1/+1
| |
* | tor-keymgr: Abolish the `role()` public key specifier function.Gabriela Moldovan2023-11-201-9/+0
| | | | | | | | We don't use this anymore.
* | tor-keymgr: Use ${for fields} to count the number of denotators (fmt).Gabriela Moldovan2023-11-201-5/+4
| |
* | tor-keymgr: Use ${for fields} to count the number of denotators.Gabriela Moldovan2023-11-201-8/+3
| |
* | tor-keymgr: Refactor a commonly used condition into a defcond.Gabriela Moldovan2023-11-201-5/+8
| |
* | tor-keymgr: Apply review suggestions to various doc comments.Gabriela Moldovan2023-11-202-6/+13
| |
* | tor-keymgr: Do not require owned types in arti_pattern().Gabriela Moldovan2023-11-201-3/+3
| | | | | | | | This also fixes a clippy warning about a needless borrow.
* | tor-keymgr: Suppress a confused clippy warning.Gabriela Moldovan2023-11-201-0/+2
| | | | | | | | | | | | | | Clippy is wrong here: it's complaining about us not using `$crate`, when we _are_ using `$crate`. See https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1733#note_2965924
* | tor-keymgr: Remove unused macro.Gabriela Moldovan2023-11-201-241/+0
| |
* | tor-keymgr: Rewrite define_key_specifier using derive-adhoc (fmt).Gabriela Moldovan2023-11-201-37/+36
| |
* | tor-keymgr: Rewrite define_key_specifier using derive-adhoc.Gabriela Moldovan2023-11-202-18/+150
| | | | | | | | | | | | | | | | For the most part, this is just code movement. The implementation was copied over to `define_derive_adhoc` from `define_key_specifier`, with some minor adjustments that were needed to make it compile. Closes #1093
* | tor-keymgr: Add tests for arti_prefix().Gabriela Moldovan2023-11-201-0/+11
| |
* | tor-keymgr: Add tests for arti_pattern().Gabriela Moldovan2023-11-201-0/+15
|/ | | | | | | | | `T::arti_pattern()` returns an `ArtiPath` pattern that can can match any key of type `T`, regardless of the values of its denotators (the denotators are replaced by wildcards in the pattern). These tests will allow us to check we're not breaking pattern matching when we transition to derive-adhoc.
* tor-keymgr: Add missing backticks (fmt).Gabriela Moldovan2023-11-132-3/+2
|
* tor-keymgr: Add missing backticks.Gabriela Moldovan2023-11-131-2/+2
|
* tor-keymgr: Move module-level docs to KeyMgr.Gabriela Moldovan2023-11-131-13/+13
| | | | The module is private so it won't show up in the public docs.