aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src
Commit message (Collapse)AuthorAgeFilesLines
...
* keymgr: Make Keystore::generate() return a Result.Gabriela Moldovan2023-07-272-8/+8
|
* keymgr: Move duplicated match block to KeyMgr::select_keystore().Gabriela Moldovan2023-07-241-22/+14
|
* keymgr: Add KeyMgr::generate() for generating new keys.Gabriela Moldovan2023-07-241-1/+69
|
* keymgr: Add function for generating EncodableKeys.Gabriela Moldovan2023-07-243-1/+35
|
* keymgr: Test whether insert() creates the missing directories.Gabriela Moldovan2023-07-241-9/+21
|
* keymgr: Return an unimplemented error instead of panicking.Gabriela Moldovan2023-07-241-2/+2
| | | | | | This will enable us to test the parts of `ArtiNativeKeystore::insert` that _are_ implemented (such as the part where it creates the missing directories).
* keymgr: Create the parent directories as neededGabriela Moldovan2023-07-241-1/+12
|
* keymgr: Add a Keystore::contains accessor.Gabriela Moldovan2023-07-243-0/+33
|
* Fix typosDimitris Apostolou2023-07-222-2/+2
|
* Merge branch 'keymgr-api-updates-minor-fixes' into 'keymgr-api-updates'gabi-2502023-07-211-9/+1
|\ | | | | | | | | Keymgr api updates minor fixes See merge request gabi-250/arti!1
| * keymgr: Use std::cfg instead of if_cfg.Gabriela Moldovan2023-07-201-9/+1
| |
* | keymgr: Use KeystoreId instead of a static string.Gabriela Moldovan2023-07-214-30/+50
| |
* | keymgr: Add a newtype for keystore identifiers.Gabriela Moldovan2023-07-211-0/+22
| |
* | keymgr, tor-error: Remove unused error type and HasKind.Gabriela Moldovan2023-07-211-20/+2
| |
* | keymgr: Use BadApiUsage instead of KeystoreMisuse.Gabriela Moldovan2023-07-211-9/+7
| | | | | | | | Trying to use a keystore that doesn't exist is `bad_api_usage!`.
* | keymgr: Remove unused KeystoreSelector::All variant.Gabriela Moldovan2023-07-212-30/+0
| | | | | | | | | | | | This also removes the corresponding `KeyMgrError::UnsupportedKeystoreSelector` error, because it's not needed anymore.
* | Revert "keymgr: Require callers to be explicit about which keystore to get ↵Gabriela Moldovan2023-07-211-16/+7
| | | | | | | | keys from." (fmt)
* | Revert "keymgr: Require callers to be explicit about which keystore to get ↵Gabriela Moldovan2023-07-212-34/+23
|/ | | | | | | | | keys from." This reverts commit 38a6c74c7894dc96b16c9039cacc2a4023977b05. This also updates some tests to make them compile with the reverted version of the code.
* keymgr: Require callers to be explicit about where to remove keys from.Gabriela Moldovan2023-07-201-15/+66
| | | | | As with `KeyMgr::insert`, only `KeystoreSelector::Id` and `KeystoreSelector::Default` are supported.
* keymgr: Add tests for KeyMgr.Gabriela Moldovan2023-07-201-0/+213
|
* keymgr: Add EncodableKey::to_bytes for encoding keys.Gabriela Moldovan2023-07-201-0/+12
| | | | We'll need this to implement `Keystore::insert`.
* keymgr: Add some extra derives to ArtiPath and KeyType.Gabriela Moldovan2023-07-202-4/+3
|
* keymgr: Require callers to be explicit about which keystore to get keys from.Gabriela Moldovan2023-07-202-7/+20
|
* keymgr: Move KeyMgr::get impl to Keymgr::get_from_store.Gabriela Moldovan2023-07-201-26/+36
| | | | | | This refactoring will make more sense later, when we give `KeyMgr::get` an extra parameter that specifies which keystore to retrieve the key from.
* keymgr: Remove unimplemented/unnecessary has_key_bundle function.Gabriela Moldovan2023-07-202-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The concept of a "key bundle" would introduce a lot of complexity while providing little to no gain. Some context: ``` Originally, "key bundles" were meant to be the answer to the question "which keystore should insert place keys in?": https://gitlab.torproject.org/tpo/core/arti/-/blob/36606a66ddca9abd1595d13c9397bc812bf24cb5/crates/tor-keymgr/src/mgr.rs#L60-69 However, I'm not so sure anymore that "key bundles" are the answer. I don't think there is any way we can "guess" where a key should go. When inserting/generating a new key, we should either: always write to the same, primary key store, OR require the user to be explicit about which key store the new key should go in (by assigning an ID to each key store and expecting the user to provide it when inserting/generating new keys) I prefer the latter option, because it provides more flexibility, which we're going to need when implementing the key management CLI (which I think should allow users to generate keys anywhere they want, e.g. arti keymgr generate <key type> --keystore hsm ...) ``` For more details, see the discussion on #903. Closes #903
* keymgr: Require callers to specify which keystore to insert keys in.Gabriela Moldovan2023-07-202-28/+32
| | | | | | | | | | The caller uses `KeystoreSelector` to specify which keystore to insert the new key into (only `KeystoreSelector::Id` and `KeystoreSelector::Default` are supported for `insert`). The ability to insert keys in a particular keystore will come in handy when we implement the key management CLI (the CLI will have an option for specifying the keystore to access/modify).
* keymgr: Add a convenience function for boxing keystore errors.Gabriela Moldovan2023-07-202-7/+7
|
* keymgr: Add an error type for misuse errors.Gabriela Moldovan2023-07-201-2/+28
| | | | | | This error will be returned by `KeyMgr` if the caller tries to access a keystore that does not exist, or if the requested `KeystoreSelector` cannot be applied.
* keymgr: Add type for specifying which keystore to access.Gabriela Moldovan2023-07-201-0/+13
|
* keymgr: Add a function for looking keystores up by ID.Gabriela Moldovan2023-07-201-0/+5
| | | | | This will be used by `KeyMgr::insert` after we add an additional argument to `insert` for specifying the keystore it should be using.
* keymgr: Add an `id` function to `Keystore`.Gabriela Moldovan2023-07-202-0/+12
| | | | | | This will enable the `KeyMgr` to look up `Keystore`s by ID (which is a requirement for disambiguating the semantics of `insert`, which currently tries to "guess" which keystore it should be using).
* keymgr: Iterate over all the stores, not just the secondary ones.Gabriela Moldovan2023-07-201-1/+7
|
* keymgr: Explicitly specify the default keystore for `KeyMgr`.Gabriela Moldovan2023-07-202-5/+12
|
* keymgr: Add a type alias for `Box<dyn Keystore>`.Gabriela Moldovan2023-07-201-2/+5
| | | | This makes the code slightly less verbose.
* keymgr-config: Make fields private, add function for checking if keystore is ↵Gabriela Moldovan2023-07-201-2/+17
| | | | | | | | | enabled. Hiding the underlying value of `enabled` enables us to give it a different `auto` value depending on whether the `keymgr` feature is enabled or not (it defaults to `true` if `keymgr` is enabled, and `false` otherwise).
* tor-keymgr: Add ArtiNativeKeystoreConfig.Gabriela Moldovan2023-07-133-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the keystore config consisted of a single field in `StorageConfig`, which encoded 2 bits of information: whether the keystore is enabled, and its root directory: ``` [storage] # use this path, fail if compiled out # keystore = "/path/to/arti/keystore" # # use default path, fail if compiled out # keystore = true # # disable # keystore = false ``` This commit adds `ArtiNativeKeystoreConfig`, which will replace the multi-purpose `keystore` field. The new config will look like this: ``` #[storage.keystore] # Whether the keystore is enabled. # # If the `keymgr` feature is enabled and this option is: # * set to false, we will ignore the configured keystore path. # * set to "auto", the configured keystore, or the default keystore, if the # keystore path is not specified, will be used # * set to true, the configured keystore, or the default keystore, if the # keystore path is not specified, will be used # # If the `keymgr` feature is disabled and this option is: # * set to false, we will ignore the configured keystore path. # * set to "auto", we will ignore the configured keystore path. # # Setting this option to true when the `keymgr` feature is disabled is a # configuration error. #enabled = "auto" # The root directory of the arti keystore #path = "${ARTI_LOCAL_DATA}/keystore" ``` While `ArtiNativeKeystoreConfig` currently only has 2 fields, `enabled` and `path`, future versions of the keystore might require additional config options.
* Merge branch 'clippy-allow' into 'main'Ian Jackson2023-07-115-0/+5
|\ | | | | | | | | clippy: Allow some of our existing code patterns See merge request tpo/core/arti!1396
| * Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-105-0/+5
| |
* | keymgr: Use Box<dyn EncodableKey> instead of Box<dyn Any>.Gabriela Moldovan2023-07-103-10/+19
|/ | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1337#note_2917701 This will make it harder to accidentally return the wrong value from `Keystore::get` (the returned value is now at least guaranteed to implement `EncodableKey`). Closes #937
* Remove explicit allows for missing_panics_docs.Nick Mathewson2023-07-061-1/+0
| | | | These are no longer needed.
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* keymgr: Explain why the TODO regarding EncodableKey can't be addressed.Gabriela Moldovan2023-07-051-1/+12
|
* Merge branch 'arti-path-bug' into 'main'gabi-2502023-06-301-9/+22
|\ | | | | | | | | keymgr: Allow periods in ArtiPath and ArtiPathComponent. See merge request tpo/core/arti!1358
| * keymgr: Update ArtiPath and ArtiPathComponent docs.Gabriela Moldovan2023-06-301-2/+2
| | | | | | | | | | The docs were lying, we actually support UTF-8 paths (though we might later decide to restrict the charset further).
| * keymgr: Allow periods in ArtiPath and ArtiPathComponent.Gabriela Moldovan2023-06-301-9/+22
| | | | | | | | | | | | | | The `ArtiPath` of a client auth key contains the `HsId` of the onion Since the `HsId` contains a `.onion` component, let's allow `.` for now. In the future, we may want to update the code (and keystore structure) to strip away the `.onion` part before building the `ArtiPath`.
* | keymgr: Downgrade "TODO hs" to "TODO HSS"Gabriela Moldovan2023-06-301-0/+3
|/ | | | This TODO doesn't need to block the release.
* keymgr: Rename KeyStore to Keystore globally.Gabriela Moldovan2023-06-298-35/+35
| | | | | We've been capitalizing the "s" in "KeyStore" inconsistently. This `s/KeyStore/Keystore/g` across the codebase.
* keymgr: Remove unstable ErrorKind, use internal! for ArtiPath errors.Gabriela Moldovan2023-06-291-21/+7
|
* keymgr: Validate the individual ArtiPahtComponents of ArtiPath.Gabriela Moldovan2023-06-291-37/+25
| | | | | This also implicitly forbids leading and trailing slashes in an `ArtiPath`.
* keymgr: Rephrase ArtiPath docs.Gabriela Moldovan2023-06-291-14/+5
| | | | This updates the docs with Diziet's suggested doc improvements.