aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/keystore
Commit message (Collapse)AuthorAgeFilesLines
* Use new TimeBound name throughout the treeIan Jackson2026-07-161-1/+1
|
* arti, keymgr: s/IDEA/TODOGabriela Moldovan2026-06-171-1/+2
| | | | | | It's better to use "TODO" like we do in the rest of Arti, because otherwise this has a chance of being forgotten (because nobody really greps for "IDEA").
* arti: subcommands: keys: Rework output of keys listhjrgrn2026-06-171-0/+2
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-095-0/+5
| | | | | | | | | | | | 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: Update tests to stop using RawKeystoreEntry (fmt)Gabriela Moldovan2026-05-181-3/+1
|
* keymgr: Update tests to stop using RawKeystoreEntryGabriela Moldovan2026-05-181-4/+3
| | | | `RawKeystoreEntry` no longer exists, so these tests need to be updated.
* keymgr: Remove RawKeystoreEntry (fmt)Gabriela Moldovan2026-05-183-5/+5
|
* keymgr: Remove RawKeystoreEntryGabriela Moldovan2026-05-183-10/+11
| | | | | | | | | | | | I think this adds unnecessary indirection, and it's a bit confusing to have two separate keystore entry types (we have `KeystoreEntry` too). This type exists just to server as a wrapper over the `RawEntryId` of an unrecognized keystore entry, and the `KeystoreId` of the keystore it was found in. This commit folds `RawKeystoreEntry` into `UnrecognizedEntry`, which was previously a thin wrapper over `RawKeystoreEntry`.
* tor-cert: Ed25519CertBuilder: do builder fn renameIan Jackson2026-04-291-1/+1
| | | | | | Change all call sites. This completes the rename.
* 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()`).
* tor-keymgr: migrate to web-time-compat.Nick Mathewson2026-03-261-1/+1
|
* Fix typosTobias Stoeckmann2026-03-241-2/+4
| | | | Typos found with codespell
* keymgr: Make CTorPath more like the client/service specifiers (fmt)Gabriela Moldovan2026-01-062-8/+17
|
* keymgr: Make CTorPath more like the client/service specifiersGabriela Moldovan2026-01-062-40/+36
| | | | | | | | | | | | | This will make it easier to see the correspondence between CTorPaths and the HS client/service key specifiers. Initially, I was hoping this would make it easier to write a d-d macro that automatically derives a `CTorPath` variant (e.g. `HsClientDescEncKeypair`) from the KeySpecifier type name (`HsClientDescEncKeypairSpecifier`), but alas, I don't think d-d can "chop off" name suffixes ("Specifier", in this case). `from_ctor_path()`/`ctor_path()` implementations for converting `CTorPath`s to and from key specifiers.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-065-5/+5
| | | | Run maint/add_warning
* Lay foundations for RSA keys in keystore.Wesley Aptekar-Cassels2025-09-301-4/+4
| | | | | | This currently can't be used due to upstream limitations in the ssh_key crate, which will be removed likely in the next release. In the meantime, we can put in all the groundwork.
* misc: cleanup now that `_report!` macros support fieldsSteven Engler2025-08-181-1/+1
|
* clippy: fix `clippy::implicit_clone` errorsSteven Engler2025-08-112-2/+2
| | | | | | | | | | | | | | | | | ```text error: implicitly cloning a `String` by calling `to_string` on its dereferenced type --> crates/tor-config/src/lib.rs:109:32 | 109 | V::String(_, s) => s.to_string(), | ^^^^^^^^^^^^^ help: consider using: `s.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone note: the lint level is defined here --> crates/tor-config/src/lib.rs:20:9 | 20 | #![deny(clippy::implicit_clone)] | ^^^^^^^^^^^^^^^^^^^^^^ ```
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-077-70/+100
| | | | | | | | | | | | | | 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-147-52/+230
| | | | | | | | | | | | | | | | | | | * 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>>>`
* Typo fixes (automatic and hand-verified)Nick Mathewson2025-07-091-1/+1
| | | | Made with https://crates.io/crates/typos-cli
* tor-keymgr: BREAKING: Refactor API: Keystore::listhjrgrn2025-05-305-90/+291
| | | | | * Change return type `Result<Vec<(KeyPath, KeystoreItemType)>>` if favor of `Result<Vec<StdResult<(KeyPath, KeystoreItemType), UnrecognizedEntryError>>>`
* *: use std::io::Error::other in many placesNick Mathewson2025-05-151-4/+2
| | | | | | | The `IoError::other` function is an easier way to say `IoError::new(IoErrorKind::Other, ...)`. It's been around since 1.74, but clippy started warning about the more verbose version in 1.87.
* tor-keymgr: ephemeral type validationhashcatHitman2025-04-032-12/+77
|
* tor-keymgr: BREAKING: Refactor API: Keystore::insertplaybahn2025-04-024-49/+18
| | | | | | 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-022-6/+9
| | | | Makes param item_type redundant. Renames item_type -> _item_type.
* tor-keymgr: keystore::arti::ssh: Fix typo; simplify comments.playbahn2025-03-271-8/+7
| | | | Closes #1455
* tor-keymgr: keystore::arti: Rework tests: ssh-keygen interopplaybahn2025-03-261-7/+4
| | | | Closes #1455 [PATCH 4(v3)/4]
* tor-keymgr: keystore::arti::ssh: Rework tests: ssh-keygen interopplaybahn2025-03-261-37/+115
| | | | Part of #1455 [PATCH 3(v3)/4]
* tor-keymgr: test_utils: TestSpecifier::path_prefix: Drop methodplaybahn2025-03-261-1/+1
| | | | Part of #1455
* tor-keymgr: Fix clippy errorsplaybahn2025-03-261-1/+1
|
* tor-keymgr: keystore::arti::tests: More intuitive assert_eq!playbahn2025-03-261-2/+1
|
* tor-keymgr: keystore::arti: Rework ssh-keygen interop testsplaybahn2025-03-261-63/+82
| | | | Closes #1455 [PATCH 4(v2)/4]
* tor-keymgr: keystore::arti::ssh: Rework ssh-keygen interop testsplaybahn2025-03-261-30/+52
| | | | Part of #1455 [PATCH 3(v2)/4]
* tor-keymgr: Remove unused importsplaybahn2025-03-261-1/+0
| | | | _sigh_
* tor-keymgr: keystore::arti: Add tests for ssh-keygen interopplaybahn2025-03-261-65/+100
| | | | Closes #1455 [PATCH 4/4]
* tor-keymgr: keystore::arti::ssh: Add tests for ssh-keygen interopplaybahn2025-03-261-0/+61
| | | | | | | | | | | | Part of #1455 [PATCH 3/4] Abstract of the test(s): Encoded (key) A -> Decoded (key) A Decoded A -> Encoded B Encoded B -> Decoded B Assert that Decoded A == Decoded B
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* tor-keymgr: Rename test constants to match file names.Gabriela Moldovan2025-02-062-18/+18
| | | | Part of #1396
* tor-keymgr: Use ParsedEd25519Cert when decoding certs.Gabriela Moldovan2025-01-132-11/+11
| | | | | | | This helps us get rid of our uses of `KeyUnknownCert`. Needed because `KeyUnknownCert` can't readily be converted back to `EncodedEd25519Cert` (while `ParsedEd25519Cert` *can* -- see the `certs` module from `tor-relay-crypto`).
* tor-keymgr: Fix cert handling tests.Gabriela Moldovan2025-01-131-17/+43
| | | | | | This updates and reenables the cert management tests. Part of #1768
* tor-keymgr: Use Ed25519Cert::decode to parse the certs.Gabriela Moldovan2025-01-132-4/+14
|
* tor-keymgr: Add cert parse error variant.Gabriela Moldovan2025-01-131-2/+14
| | | | | | | This will soon be used, when we modify the `ArtiNativeKeystore` cert lookup code to actually parse certificates before returning them. Part of #1768
* 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-062-2/+2
|
* tor-keymgr: Add tests for ArtiNativeKeystore's handling of certs.Gabriela Moldovan2024-12-041-1/+29
|
* tor-keymgr: Add support for certs in ArtiNativeKeystore::insert().Gabriela Moldovan2024-12-041-5/+8
|
* tor-keymgr: Add support for certs in ArtiNativeKeystore::get().Gabriela Moldovan2024-12-041-8/+36
| | | | | This makes `ArtiNativeKeystore::get` deserialize the keystore item as a cert, if its `KeystoreItemType` is `Cert`.