aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/keystore.rs
Commit message (Collapse)AuthorAgeFilesLines
* keymgr: Rephrase the remove_unchecked docs for clarityGabriela Moldovan2026-05-181-5/+5
|
* keymgr: Clarify that not all keystores support stringly-typed entry IDsGabriela Moldovan2026-05-181-0/+12
|
* keymgr: Remove a couple unused From<> implsGabriela Moldovan2026-05-181-10/+0
| | | | | These are unused, and I don't think they're needed by our API users either, since `KeystoreEntryResult` is just a type alias for `Result`.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-1/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* Fix errors from rustdoc nightly.Nick Mathewson2025-08-051-1/+1
|
* arti: keys: Add arti keys-rawhjrgrn2025-07-141-3/+45
| | | | | | | | | | | | | | | | | | | * CLI: Add `keys-raw` and subcommand `remove-by-path` * arti: Add `arti::subcommand::raw` for the CLI `keys-raw` * tor-keymgr: Add `ArtiNativeKeystoreError::UnexpectedRawEntry`, `ArtiEphemeralKeystoreError::NotSupported` * tor-keymgr: Add `tor-keymgr::raw` module * tor-keymgr: Add `Keystore::remove_unchecked` * tor-keymgr: Change `Keystore::list` to return `KeystoreEntry` * tor-keymgr: Add field `KeystoreEntry::raw_id` * doc: Update keys.md * doc: Add raw.md * tor-keymgr: BREAKING: `UnrecognizedEntryError::new` associated function is now only accessible within the crate `tor-keymgr` * tor-keymgr: BREAKING: `UnrecognizedEntryId` is renamed to `UnrecognizedEntry` * tor-keymgr: BREAKING: `KeyMgr::list()` and `Keystore::list()` now return `Result<Vec<KeystoreEntryResult<KeystoreEntry>>>`
* tor-keymgr: BREAKING: Refactor API: Keystore::listhjrgrn2025-05-301-3/+10
| | | | | * Change return type `Result<Vec<(KeyPath, KeystoreItemType)>>` if favor of `Result<Vec<StdResult<(KeyPath, KeystoreItemType), UnrecognizedEntryError>>>`
* tor-keymgr: BREAKING: Refactor API: Keystore::insertplaybahn2025-04-021-9/+1
| | | | | | Drop redundant/unused param item_type: &KeystoreItemType from keystore::Keystore::insert. Method now uses param key: &dyn EncodableItem to obtain a KeystoreItemType
* tor-keymgr: Fix TODO: Refactor API: Keystore::insertplaybahn2025-04-021-16/+3
| | | | Makes param item_type redundant. Renames item_type -> _item_type.
* tor-keymgr: Update docs post-renaming.Gabriela Moldovan2024-12-041-9/+9
|
* tor-keymgr: Replace KeyType with KeystoreItemType (fmt).Gabriela Moldovan2024-12-041-2/+10
|
* tor-keymgr: Replace KeyType with KeystoreItemType.Gabriela Moldovan2024-12-041-6/+6
| | | | | This is part of the work needed to support storing certificates in the keystore (they won't have a `KeyType`, but rather `CertType`).
* tor-key-forge: Rename EncodableKey to EncodableItem.Gabriela Moldovan2024-12-041-6/+6
| | | | | | | | This is the first step in replacing `EncodableKey` with the new `EncodableItem` trait (see doc/dev/keymgr-certificates.md). (this refactoring is split over multiple commits to make reviewing easier)
* tor-keymgr: Add a keystore for C Tor service keys.Gabriela Moldovan2024-10-081-0/+2
|
* tor-keymgr: Move the checked_op utils out of the arti module.Gabriela Moldovan2024-10-081-0/+1
| | | | We are about to use this for the ctor keystore implementation too.
* tor-keymgr: put ephemeral keystore behind experimental featureSteven Engler2024-09-171-0/+2
| | | | Feature is named "ephemeral-keystore".
* Rename tor-keys crate to tor-key-forgeDavid Goulet2024-09-041-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-keymgr: Use tor-keys crate and remove dead codeDavid Goulet2024-09-041-535/+2
| | | | | | | | | | | Everything copied in the previous commits to tor-keys is now removed and tor-keys crate is used accross the code. Minor changes to tor-keys to accomodate this change. Part of #1137 Signed-off-by: David Goulet <[email protected]>
* tor-keys: Automatically implement keymgr traitDavid Goulet2024-09-041-28/+5
| | | | | | | | | | | | | | | | | The derive ed25519 keypair macro now implements the keymgr trait so the key wrapper can now be used with a keystore without needing to specify it in the tor-keymgr crate. For this to work, a slight change to the KeygenRng trait was needed as in to expect the CryptoRngCore trait which is what ed25519-dalek requires. And also, the removal of the Sealed trait since now it is accepted to implement these traits outside tor-keymgr. Fixes #1137 Signed-off-by: David Goulet <[email protected]>
* Fix typosDimitris Apostolou2024-09-031-2/+2
|
* tor-keymgr: Fix nightly warnings.Gabriela Moldovan2024-05-091-6/+6
| | | | This is a follow-up from !2131
* tor-keymgr: Add function for extracting the KeyType of an ssh key.Gabriela Moldovan2024-05-081-0/+11
|
* tor-keymgr: Fix newly failing tests.Gabriela Moldovan2024-05-081-3/+4
| | | | | | | | | | | | | | | | | This updates the keymgr tests to be slightly more robust. These tests attach some metadata to each key, such as the "nickname" of the key (which only exists for testing purposes), whether the key was auto-generated, and the keystore ID of the keystore from which the key was retrieved. Previously, the metadata was encoded in the key "material" itself (the test "keys" were actually just `String`s with a hacky `EncodableKey` implementation that abused the "encrypted" variant of `KeypairData`). This was only possible because we had access to the key internals (through `SshKeyData::Public`/`SshKeyData::Private`), but since the internals are inaccessible now, the tests need to be updated.
* tor-keymgr: Make SshKeyData an opaque type.Gabriela Moldovan2024-05-071-63/+72
| | | | | | This helps prevent external users from creating `SshKeyData` out of unsupported types of `ssh_key::public::KeyData` and `ssh_key::private::KeypairData`.
* tor-keymgr: Do not make SshKeyData infallibly convertible from ↵Gabriela Moldovan2024-05-071-7/+45
| | | | KeyData/KeypairData.
* tor-keymgr: Seal the EncodableKey trait.Gabriela Moldovan2024-05-071-1/+30
| | | | | | | | | | | | | | | | | | | | As explained in the docs, this trait should not be implementable outside of the `tor-keymgr` crate. The `SshKeyData::into_erased` and `UnparsedOpensshKey::parse_ssh_format_erased` impls assume the types implementing `EncodableKey` form a statically known closed set. If we later decide to make the supported key types an open set, we should make this trait implementable outside of `tor-keymgr` too. External types wanting to create custom "key types" for use in the keymgr should use the non-sealed `ToEncodableKey` trait, which specifies the `EncodableKey` type to use. This trait is mainly used to create `SshKeyData` IMO, we should make `SshKeyData` opaque, since it's not meant to be constructed through other means (`SshKeyData` is currently a public enum, so its variants and the `ssh_key` types they wrap are public). A future commit will make it opaque.
* tor-keymgr: Dedupe all the convert functions.Gabriela Moldovan2024-05-071-2/+0
|
* tor-keymgr: Move arti-specific ssh code to arti module.Gabriela Moldovan2024-05-071-3/+1
| | | | | | | | | Some of the types and impls from `key_type/ssh.rs` (such as `UnparsedOpenSshKey`) have nothing to do with `KeyType`, and are only used by the `ArtiNativeKeystore`, so I'm moving them to the `arti` keystore module. The shared ssh-related stuff now lives in the top-level `ssh.rs`.
* tor-keymgr: Make SshKeyData convertible to ErasedKey.Gabriela Moldovan2024-05-071-3/+151
| | | | | | | | | | | | | | | | | | | | This adds an `SshKeyData::into_erased` function that returns the `SshKeyData` as a type-erased concrete key type (e.g. a type-erased `ed25519::Keypair`). This commit duplicates all of the `convert_*` functions from `key_type/ssh.rs`. A future commit will rewrite the code from `key_type/ssh.rs` to use `SshKeyData::into_erased`, and to remove the duplicate functions. Previously, `EncodableKey` returned an encoded `SshKeyData`, which doesn't implement `EncodableKey`. This was rather inconvenient for `Keystore` implementers. For instance, for the in-memory keystore we ended up working around this limitation by serializing and deserializing `EncodableKey`s to and from `String`. For the full context, see https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2076#note_3016460 Needed for #1362 #1367
* tor-keymgr: added initial implementation for in-memory ArtiEphemeralKeystoreRichard Pospesel2024-04-101-0/+1
|
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* tor-keymgr: Downgrade a TODO to a Note.Gabriela Moldovan2024-02-051-3/+3
| | | | | | | I don't think we need to do this right now, so I am downgrading this TODO. Part of #1115
* tor-keymgr: Remove a TODO about renaming Keystore.Gabriela Moldovan2024-02-051-4/+0
| | | | | | I think the current naming is fine. Part of #1115
* tor-keymgr: Turn some TODOs into #1115.Gabriela Moldovan2024-01-101-2/+2
|
* Fix typosDimitris Apostolou2024-01-081-2/+2
|
* llcrypto: Hide the members of ExpandedKeypair.Nick Mathewson2023-11-291-1/+1
| | | | | 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-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: impl ToEncodableKey for IPT keysIan Jackson2023-11-231-1/+25
|
* 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 function for listing all entries in a keystore.Gabriela Moldovan2023-10-191-1/+4
|
* tor-keymgr: Give KeyType an Unknown variant.Gabriela Moldovan2023-10-191-4/+4
|
* tor-keymgr: Factor the generate() function into a separate trait.Gabriela Moldovan2023-10-091-41/+36
| | | | | | `EncodableKey` is a trait for encoding keypairs and public keys. Keygen only makes sense for key_pairs_ (it doesn't make sense for public keys), so it makes sense to move `generate()` out of `EncodableKey`,
* tor-hsservice: Add more key roles.Gabriela Moldovan2023-10-031-2/+26
| | | | | | This adds a couple of new `HsSvcKeyRoles` for: * `KS_hs_id` keypairs * `KP_hs_blind_id` public keys keys
* Merge branch 'keymgr-blinded-keys' into 'main'gabi-2502023-09-261-5/+37
|\ | | | | | | | | tor-keymgr: Support storing `ed25519::ExpandedKeypair`s in the keystore See merge request tpo/core/arti!1619
| * tor-keymgr: Implement EncodableKey for ExpandedKeypair.Gabriela Moldovan2023-09-261-5/+37
| |
* | tor-keymgr: Make SshKeyData accessors more idiomatic.Gabriela Moldovan2023-09-261-8/+10
| |
* | tor-keymgr: Make SshKeyData non-exhaustive.Gabriela Moldovan2023-09-261-1/+1
| | | | | | | | | | We will need to add another variant to this when we add support for certificates.