aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/keystore.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* | tor-keymgr: Derive Clone, Debug for SshKeyData.Gabriela Moldovan2023-09-261-1/+1
|/
* tor-keymgr: Rename as_ssh_keypair_data to as_ssh_key_data.Gabriela Moldovan2023-09-261-5/+5
| | | | | This function no longer returns `KeypairData` (it now returns `SshKeyData`).
* tor-keymgr: Implement ToEncodableKey for HsIdKey.Gabriela Moldovan2023-09-251-3/+3
|
* tor-keymgr: Implement EncodableKey for ed25519 public keys.Gabriela Moldovan2023-09-251-3/+5
|
* tor-keymgr: Implement EncodableKey for x25519 public keys.Gabriela Moldovan2023-09-251-0/+26
|
* tor-keymgr: Make EncodableKey support public keys too.Gabriela Moldovan2023-09-251-9/+38
| | | | | | | | | Previously, `EncodableKey::to_keypair_data` could only be used for encoding private keys (its return type was `KeypairData`). Now `EncodableKey::to_keypair_data` can return public key data (`KeyData`) too. Note: `to_keypair_data()` will be renamed in a future commit.
* tor-hsclient, arti-client, tor-keymgr, tor-netdoc: Use a keypair instead of ↵Gabriela Moldovan2023-09-251-2/+4
| | | | StaticSecret (fmt).
* tor-hsclient, arti-client, tor-keymgr, tor-netdoc: Use a keypair instead of ↵Gabriela Moldovan2023-09-251-10/+12
| | | | | | | | | | | | | StaticSecret. Previously, when retrieving `KS_hsc_desc_enc` keys (or any other x25519 keys) from the keystore, the keymgr would discard the public part of the key (SSH private keys contain the public part of the key too). Instead of discarding the public key and returning just the `StaticSecret`, the keymgr now returns a `StaticKeypair`. This makes the x25519 `EncodableKey`/`ToEncodableKey` implementation consistent with the ed25519 one (which retrieves key pairs rather than "unescorted" secrets).
* tor-hsservice: Support storing desc signing keys in the keystore.Gabriela Moldovan2023-09-221-1/+14
|
* tor-hsservice: Support storing HsIdKeys in the keystore.Gabriela Moldovan2023-09-221-1/+35
|
* tor-hsservice: Add key specifier for blinded_id keypairs.Gabriela Moldovan2023-09-221-1/+13
|
* 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.
* tor-keymgr: Re-export ssh-key.Gabriela Moldovan2023-08-161-9/+7
| | | | | | | | | | 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: Add TODO regarding SshEncodableKey impl for x25519.Gabriela Moldovan2023-08-021-0/+1
|
* keymgr: Implement SshEncodableKey for ed25519::Keypair.Gabriela Moldovan2023-08-021-1/+8
|
* keymgr: Replace EncodableKey::to_bytes() with SSH-specific function.Gabriela Moldovan2023-08-021-7/+9
| | | | | | | | | | | 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: Make Keystore::generate() return a Result.Gabriela Moldovan2023-07-271-5/+5
|
* keymgr: Add function for generating EncodableKeys.Gabriela Moldovan2023-07-241-0/+27
|
* keymgr: Add a Keystore::contains accessor.Gabriela Moldovan2023-07-241-0/+3
|
* Fix typosDimitris Apostolou2023-07-221-1/+1
|
* keymgr: Use KeystoreId instead of a static string.Gabriela Moldovan2023-07-211-5/+6
|
* keymgr: Add EncodableKey::to_bytes for encoding keys.Gabriela Moldovan2023-07-201-0/+12
| | | | We'll need this to implement `Keystore::insert`.
* keymgr: Remove unimplemented/unnecessary has_key_bundle function.Gabriela Moldovan2023-07-201-3/+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: Add an `id` function to `Keystore`.Gabriela Moldovan2023-07-201-0/+5
| | | | | | 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: Use Box<dyn EncodableKey> instead of Box<dyn Any>.Gabriela Moldovan2023-07-101-3/+5
| | | | | | | | | | 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
* keymgr: Explain why the TODO regarding EncodableKey can't be addressed.Gabriela Moldovan2023-07-051-1/+12
|
* keymgr: Rename KeyStore to Keystore globally.Gabriela Moldovan2023-06-291-5/+5
| | | | | We've been capitalizing the "s" in "KeyStore" inconsistently. This `s/KeyStore/Keystore/g` across the codebase.
* keymgr: Downgrade "TODO hs" to "TODO HSS".Gabriela Moldovan2023-06-281-2/+2
| | | | | These TODOs can be deferred for now: we're not declaring the keymgr APIs stable until we add support for hidden services.
* keymgr: Downgrade 2 "TODO hs" to "TODO HSS".Gabriela Moldovan2023-06-221-1/+1
|
* keymgr: Remove Error::NotFound, update KeyMgr, KeyStore APIs.Gabriela Moldovan2023-06-211-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the `NotFound` `tor_keymgr::Error` variant. Since `KeyMgr` and `KeyStore` users will need to be able to distinguish between "not found" errors and other I/O errors, this also changes the return types of the `get()` and `remove()` functions of `KeyStore` and `KeyMgr`, which now return `Ok(None)` instead of `Error::NotFound`. This makes the `KeyStore` API consistent with `KeyMgr::get`, which already has a return type of `Result<Option<K>>` (rather than `Result<K>`). This also prepares us for #901, which will make key store errors opaque. Without this change: * we'd have to create a `struct NotFoundError;` error type. Its `HasKind` impl would need to return a new `ErrorKind::KeyStoreErrorNotFound` `ErrorKind` variant * callers would have to match the `error_kind()` of the error to figure out whether the key simply can't be found (`ErrorKind::KeyStoreErrorNotFound`), or if something went wrong (any other `ErrorKind`). Given the above, I think `Result<Option<()>>` makes for a more ergonomic API. Part of #901
* keymgr: Add TODO regarding KeyStore rename.Gabriela Moldovan2023-06-151-0/+4
|
* keymgr: Introduce ToEncodableKey to simplify lookups.Gabriela Moldovan2023-06-151-0/+39
| | | | | | | This means `KeyMgr` users don't need to specify the underlying key type (e.g. `ed25519::Keypair`) when retrieving keys. Instead, they can just specify the type required (as long as it implements `ToEncodableKey`), e.g. `HsClientIntroAuthKeypair`.
* keymgr: Add ArtiNativeKeyStore implementation skeleton.Gabriela Moldovan2023-06-151-0/+76
This adds implementation stubs for `ArtiNativeKeyStore`, and introduces the traits needed to make the `KeyStore` APIs work.