summaryrefslogtreecommitdiff
path: root/crates/tor-keymgr
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-163-0/+44
|
* 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-162-2/+11
| | | | 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-023-11/+16
| | | | | | | | 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-024-12/+20
| | | | | | | | | | | 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
* Remove semver.md files now that 1.1.7 is out.Nick Mathewson2023-08-011-18/+0
|
* Merge branch 'bump_versions_117' into 'main'arti-v1.1.7Nick Mathewson2023-08-011-5/+5
|\ | | | | | | | | Vesion bumps for 1.1.7. See merge request tpo/core/arti!1458
| * Increment patchlevel versions of crates with minor changesNick Mathewson2023-08-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates are at version 0.x.y, so we don't need to distinguish new-feature changes from other changes: ``` tor-basic-utils fs-mistrust tor-error tor-geoip tor-checkable tor-linkspec tor-netdoc tor-netdir tor-persist tor-ptmgr tor-hsservice ``` This crate has a breaking change, but only when the semver-breaking feature `experimental-api` is enabled: ``` tor-config ``` This crate is at version 1.x.y, but has no new public APIs, and therefore does not need a minor version bump: ``` arti ```
| * Update minor versions on crates that have had breaking changesNick Mathewson2023-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates had first-order breaking changes: ``` retry-error tor-keymgr tor-proto tor-hsclient tor-rtmock ``` Additionally, these broke because they re-exposed RetryError: ``` tor-circmgr ``` Additionally, these broke because they may re-expose something from tor-proto: ``` arti-client tor-chanmgr tor-dirclient tor-dirmgr tor-guardmgr ``` Additionally, these broke for other fiddly reasons: `tor-ptmgr` implements traits from tor-chanmgr, which has a breaking change above. `arti-hyper` exposes types from arti-client in its API.
* | Run "fixup features" in preparation for a release.Nick Mathewson2023-08-011-1/+1
|/
* 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-243-1/+71
|
* keymgr: Add function for generating EncodableKeys.Gabriela Moldovan2023-07-245-1/+38
|
* 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-244-1/+34
|
* Fix typosDimitris Apostolou2023-07-222-2/+2
|
* Merge branch 'keymgr-api-updates-minor-fixes' into 'keymgr-api-updates'gabi-2502023-07-212-10/+1
|\ | | | | | | | | Keymgr api updates minor fixes See merge request gabi-250/arti!1
| * keymgr: Remove unnecessary dependency.Gabriela Moldovan2023-07-201-1/+0
| |
| * 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-213-35/+24
|/ | | | | | | | | 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-202-16/+67
| | | | | 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-202-0/+13
| | | | We'll need this to implement `Keystore::insert`.
* keymgr: Add some extra derives to ArtiPath and KeyType.Gabriela Moldovan2023-07-203-4/+5
|
* keymgr: Require callers to be explicit about which keystore to get keys from.Gabriela Moldovan2023-07-203-8/+21
|
* 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-203-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-203-28/+34
| | | | | | | | | | 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-203-7/+8
|
* 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-202-0/+14
|
* 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-203-0/+13
| | | | | | 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).