aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src
Commit message (Collapse)AuthorAgeFilesLines
* tor-keymgr: Remove redundant _private suffix from key extension.Gabriela Moldovan2023-09-122-4/+4
| | | | The privateness of the keys is encoded in their name.
* tor-keymgr, tor-hsservice: Run rustfmt to make derives uglierIan Jackson2023-08-231-3/+13
|
* tor-keymgr, tor-hsservice: deser for ArtiPathComponent and HsNicknameIan Jackson2023-08-231-0/+25
|
* tor-keymgr: Improve ArtiPathComponent a bitIan Jackson2023-08-231-0/+15
| | | | And add a TODO about the error type.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-235-0/+5
|
* Resolve warnings about ambiguous/redundant doc linksNick Mathewson2023-08-221-1/+1
| | | | | Nightly rustdoc now warns if you have a link that isn't necessary, and if you have a link that might refer to two different things.
* keymgr: Write a registry sketch.Gabriela Moldovan2023-08-161-2/+49
| | | | This comment will form the basis for the protocol name registry.
* tor-keymgr: Re-export ssh-key.Gabriela Moldovan2023-08-163-13/+14
| | | | | | | | | | The `KeypairData` type from [ssh-key] at some point leaked into the keymgr API (via the `EncodableKey` trait). Instead of re-exporting just `KeypairData`, let's re-export the entire `ssh_key` crate (`EncodableKey` implementors would need additional types from `ssh_key` to construct a `KeypairData` object anyway). [ssh-key]: https://crates.io/crates/ssh-key
* keymgr: Implement as_ssh_keypair_data for curve25519 keys.Gabriela Moldovan2023-08-161-4/+13
|
* keymgr: Import internal! (fmt).Gabriela Moldovan2023-08-161-4/+2
|
* keymgr: Import internal!.Gabriela Moldovan2023-08-161-3/+3
|
* keymgr: Remove unused helper.Gabriela Moldovan2023-08-161-33/+0
| | | | | This helper is no longer needed (the logic from `parse_ssh_format_erased` changed).
* tor-keymgr: Test x25519 key parsing.Gabriela Moldovan2023-08-161-0/+30
|
* keymgr: Do not expect x25519 keys to be stored as ed25519 ssh keys.Gabriela Moldovan2023-08-161-13/+48
| | | | | | | | | | | | | | | | | | | | | | Previously, the Arti key store would store x25519 secret keys as ed25519 OpenSSH keys, which it would convert to x25519 upon loading (using the conversion function added in !1297 (merged)). This approach isn't good enough though: most people will probably want to bring their existing x25519 keys, and in order to store those in OpenSSH format, we'd need convert them to ed25519, which is impossible (because the secret part of an x25519 key contains a SHA512'd secret, whereas the corresponding, "un-expanded", ed25519 secret key contains the secret itself rather than the SHA). Now that `ssh-key` has support for ssh keys with [custom algorithm names], we can store x25519 in OpenSSH format directly. This commit changes the storage format used by the keymgr for x25519 client auth keys (from ed25519-ssh to our own custom key type with an algorithm name of `"[email protected]"`). Closes #936 [custom algorithm names]: https://github.com/RustCrypto/SSH/pull/136
* keymgr: Bump ssh-key to 0.6.0.Gabriela Moldovan2023-08-161-1/+10
| | | | This brings in the changes from #936.
* tor-error: Remove KeystoreFsPermissions variant.Gabriela Moldovan2023-08-081-1/+1
| | | | | | | | According to the `ErrorKind` lumping guidelines, `KeystoreFsPermissions` should be lumped with `FsPermissions`: they represent the same type of error, and their "location" is the same ("Host"). Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1315#note_2916455
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* keymgr: Add TODO regarding SshEncodableKey impl for x25519.Gabriela Moldovan2023-08-021-0/+1
|
* keymgr: Implement SshEncodableKey for ed25519::Keypair.Gabriela Moldovan2023-08-022-4/+10
|
* keymgr: Remove KeyType::to_ssh_format.Gabriela Moldovan2023-08-022-11/+15
| | | | | | | | This function isn't actually needed (it's not the responsibility of `KeyType` to encode keys). This commit also rewrites `ArtiNativeKeystore::insert` to use the new `as_ssh_keypair_data` function instead of `to_ssh_format`.
* keymgr: Replace EncodableKey::to_bytes() with SSH-specific function.Gabriela Moldovan2023-08-023-12/+18
| | | | | | | | | | | The `EncodableKey::to_bytes` function didn't make much sense, because not all keys have a canonical byte representation. This commit replaces `EncodableKey::to_bytes` with `EncodableKey::as_ssh_keypair_data`. In the future, `EncodableKey` will grow functions for encoding keys in other storage formats too. Closes #965
* keymgr: Add TODO regarding generate() being racy.Gabriela Moldovan2023-07-271-0/+3
|
* keymgr: Document the TOCTOU issue with generate().Gabriela Moldovan2023-07-271-0/+16
|
* keymgr: Make the return value of generate() indicate if a new key was created.Gabriela Moldovan2023-07-271-3/+5
|
* 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).