aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/keystore/ephemeral.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* keymgr: Fix ephemeral keystore cert encoding bug (fmt)Gabriela Moldovan2026-04-081-6/+3
|
* keymgr: Fix ephemeral keystore cert encoding bugGabriela Moldovan2026-04-081-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug that was causing the ephemeral keystore to retrieve certs in a format that couldn't be handled by the `KeyMgr`. This caused all certificate retrievals from `EphemeralKeystore` done via the `KeyMgr` to fail with an internal error. For context, the only supported cert type is `TorEd25519Cert`, which is a pre-encoded certificate (i.e. a type wrapper over a `Vec<u8>`). These certificates are stored as-is by the Arti native keystore (the bytes are written to a file on disk). When retrieving a `TorEd25519Cert`, the Arti keystore uses `parse_certificate_erased()` to parse the cert into a `ParsedEd25519Cert` before returning it as a type-erased `ErasedKey`. This works as intended with the `KeyMgr` retrieval and downcasting logic, which expects the certificate to be returned in the `ParsedCert` format specified in the `ToEncodableCert` implementation. Before this change, the ephemeral keystore, on the other hand, did not play well with the `KeyMgr` when it came to cert retrieval: it would incorrectly store the `KeystoreItem` as-is, and retrieve it as an `ErasedKey` using the `ErasedKey::into_erased()` implementation. This would then cause the `KeyMgr` to fail to downcast the `ErasedKey` to the correct type (because the returned erased item was of a different type than `ParsedCert`). This commit also removes `KeystoreItem::into_erased()`, which was a footgun (because certificates are not actually supposed to be retrieved in the format returned by `CertData::into_erased()`).
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-48/+76
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* arti: keys: Add arti keys-rawhjrgrn2025-07-141-3/+29
| | | | | | | | | | | | | | | | | | | * 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-8/+10
| | | | | * Change return type `Result<Vec<(KeyPath, KeystoreItemType)>>` if favor of `Result<Vec<StdResult<(KeyPath, KeystoreItemType), UnrecognizedEntryError>>>`
* tor-keymgr: ephemeral type validationhashcatHitman2025-04-031-11/+69
|
* tor-keymgr: BREAKING: Refactor API: Keystore::insertplaybahn2025-04-021-11/+6
| | | | | | Drop redundant/unused param item_type: &KeystoreItemType from keystore::Keystore::insert. Method now uses param key: &dyn EncodableItem to obtain a KeystoreItemType
* tor-keymgr: keystore::ephemeral::insert: Drop item type validationplaybahn2025-04-021-20/+1
| | | | | | | | Motivation: Param _item_type is redundant since prev commit. No point in checking if key_data's item type and _item_type are the same, we do things as per key_data's item type from now on. - Removes a test for item type validation.
* tor-keymgr: Fix TODO: Refactor API: Keystore::insertplaybahn2025-04-021-3/+4
| | | | Makes param item_type redundant. Renames item_type -> _item_type.
* tor-key-forge: Split out ItemType as a separate trait.Gabriela Moldovan2025-01-131-1/+1
| | | | | | | | This is necessary because `ParsedCert`s will not be `EncodableItem`s. This is because we cannot (and don't want to) write certificates that have not yet been validated to the keystore. They do need to be retrievable from the keystore though, so we also change `ErasedKey` to be `Box<dyn ItemType>` instead.
* fix: fix typosDimitris Apostolou2025-01-061-1/+1
|
* tor-key-forge: Implement EncodableItem for Tor ed25519 certs.Gabriela Moldovan2024-12-041-3/+3
| | | | | This will enable us to store `tor_cert::EncodedEd25519Cert`s in the keystore.
* tor-keymgr: Replace as_ssh_key_data with as_keystore_item.Gabriela Moldovan2024-12-041-5/+6
|
* tor-keymgr: Replace KeyType with KeystoreItemType (fmt).Gabriela Moldovan2024-12-041-2/+10
|
* tor-keymgr: Replace KeyType with KeystoreItemType.Gabriela Moldovan2024-12-041-38/+45
| | | | | 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-4/+4
| | | | | | | | 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 disk-related docs to `ArtiEphemeralKeystore`Steven Engler2024-09-171-0/+6
|
* 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-4/+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]>
* Fix typosDimitris Apostolou2024-09-031-2/+2
|
* Revert "tor-keymgr: Fix now-failing test."Gabriela Moldovan2024-05-081-0/+16
| | | | This reverts commit 9ea35caeb1ed23fd029627d04819debc41d85c77.
* tor-keymgr: Validate the KeyType when inserting into the ephemeral keystore.Gabriela Moldovan2024-05-081-0/+20
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2131#note_3028014
* tor-keymgr: Update ephemeral keystore docs.Gabriela Moldovan2024-05-071-2/+2
|
* tor-keymgr: Test that the ephemeral store returns the correct type.Gabriela Moldovan2024-05-071-2/+6
|
* tor-keymgr: Fix now-failing test.Gabriela Moldovan2024-05-071-16/+0
| | | | | | Inserting a key that has the wrong key type no longer fails, because we now store the `KeyData` as-is, without attempting to parse it as a specific kind of SSH key.
* tor-keymgr: Simplify ephemeral keystore impl.Gabriela Moldovan2024-05-071-31/+6
| | | | Closes #1362 #1367
* tor-keymgr: Move parse_ssh_format_erased to UnparsedOpenSshKey.Gabriela Moldovan2024-05-071-3/+3
| | | | | I think it makes more sense for parse_ssh_format_erased to be a function of the key than of `KeyType`.
* tor-keymgr: Avoid using UnparsedOpenSshKey.Gabriela Moldovan2024-05-071-5/+6
| | | | | | | | | | `UnparsedOpenSshKey` was originally only meant to be used for the `ArtiNativeKeystore`. I am about to make it private to the arti module, so I'm updating the ephemeral keystore tests to not use it. Part of #1362
* tor-keymgr: Move TestSpecifier to test_utils.Gabriela Moldovan2024-05-071-3/+1
| | | | | | | This is used by `ArtiNativeKeystore` and the `EphemeralKeystore`. Moving it to test_utils means `EphemeralKeystore` no longer needs to import test helpers from the arti module.
* tor-keymgr: Move test constants to test_utils.Gabriela Moldovan2024-05-071-1/+1
| | | | | Closes #1363 and addresses a handful of TODOs about `include_str!`ing the same key multiple times from various test modules.
* tor-keymgr: added initial implementation for in-memory ArtiEphemeralKeystoreRichard Pospesel2024-04-101-0/+285