summaryrefslogtreecommitdiff
path: root/crates/tor-keymgr
Commit message (Collapse)AuthorAgeFilesLines
* Bump arti- and tor- crates to 0.23.0Nick Mathewson2024-09-301-9/+9
| | | | | | | | | | | | | | Per our policy, every one of these gets a minor bump. Generated with: ``` for crate in $(./maint/list_crates | grep '^\(tor\|arti\)-' ); do cargo set-version --bump minor -p $crate; done ``` (Note the use of `-` at the end end of the grep pattern to prevent matching the `arti` crate.)
* Minor bumps on non-tor/arti cratesNick Mathewson2024-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates are not in the tor/arti namespace, but we have given them MSRV bumps: ``` oneshot-fused-workaround slotmap-careful fslock-guard hashx equix caret fs-mistrust safelog test-temp-dir retry-error ``` We are counting this as a breaking change. Since all of these crates are at 0.x.x, we have indicated the breaking change with a minor version bump. This commit was generated with the following script: ``` BUMPS=" oneshot-fused-workaround slotmap-careful fslock-guard hashx equix caret fs-mistrust safelog test-temp-dir retry-error " for crate in $BUMPS; do cargo set-version --bump minor -p $crate; done ```
* Merge branch 'msrv-1.77-and-rusqlite-update' into 'main'David Goulet2024-09-261-1/+1
|\ | | | | | | | | Upgrade MSRV to 1.77 , and rusqlite to 0.32.1 See merge request tpo/core/arti!2451
| * Upgrade MSRV to 1.77Nick Mathewson2024-09-251-1/+1
| | | | | | | | This will allow us to upgrade to the latest version of rusqlite.
* | Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-252-4/+6
|/ | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* tor-keymgr: Rename keystore.type to keystore.kind.Gabriela Moldovan2024-09-231-2/+2
| | | | | In !2394 we settled on `kind`. This updates the error messages to reference the new field name.
* tor-keymgr: Move keystore config under keystore.primary.Gabriela Moldovan2024-09-231-3/+16
| | | | | The keystore settings only configure the *primary* keystore, so they should be under `keystore.primary`.
* arti: Reinstate the keystore.enabled option.Gabriela Moldovan2024-09-231-51/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up from !2394 I want to keep the `keystore.enabled` option, because I'm planning on extending `ArtiKeystoreConfig` to support configuring secondary keystores too (currently, the only supported setting is `keystore.kind`, which configures the primary keystore). `keystore.enabled` will disable keystore use altogether (i.e. both primary and secondary). Currently, we only support configuring the "primary" (previously known as "default") keystore, which can be either "native" (the on-disk Arti keystore), or "ephemeral" (an in-memory keystore). To implement #858, we will need to support configuring additional keystores too, so we will need to move to a config of the form ```toml [storage.keystore] # Whether the keystore is enabled. #enabled = "auto" # Configure the primary keystore. [storage.keystore.primary] # The type of primary keystore to use kind = "auto" | "native" | "ephemeral" # Optionally configure C Tor keystores for arti to use. # # Note: The keystores listed here are read-only (keys are only # ever written to the primary keystore, configured in # `storage.keystore.primary`). [[storage.keystore.ctor]] # If the `kind` is `service`, this should be set to the `HiddenServiceDirectory` # of your hidden service. Arti will read `HiddenServiceDirectory/hostname` # and `HiddenServiceDirectory/private_key`. (Note: if your service is running # in restricted discovery mode, you must set the # `[[onion_services."<the nickname of your svc>".restricted_discovery.key_dirs]]` # to `HiddenServiceDirectory/client_keys` # # If the `kind` is `client`, this should be set to `ClientOnionAuthDir` of # your client. If Arti is configured to run as a client (i.e. if it runs in SOCKS # proxy mode), it will read the client restricted discovery keys from this path. path = "/foo/bar" # The type of keystore `path` should be interpreted as kind = "client" | "service" ``` This moves the current keystore settings to `storage.keystore.primary` in preparation for that change.
* tor-keymgr: Add back ArtiKeystoreConfig::is_enabled().Gabriela Moldovan2024-09-232-1/+7
| | | | | I am adding `is_enabled()` back because I plan to un-deprecate the `enabled` setting.
* tor-keymgr: Rename the primary keystore for clarity.Gabriela Moldovan2024-09-234-26/+28
| | | | | | | | | | Previously, arti's primary keystore was referred to as its "default" keystore. However, "default" is inaccurate here: there is no way to meaningfully override this "default" (the "default" store acts as the main keystore). Throughout the codebase, we query all keystores for keys (including the secondary ones), but only ever write to the default/primary keystore. This is OK for now, because it enables us to have one mutable keystore, and multiple secondary, read-only stores.
* tor-keymgr: added dummy implementation of ArtiEphemeralKeyStoreMorgan2024-09-201-0/+14
|
* tor-keymgr: added support for specifying keystore kind to ArtiKeystoreConfigMorgan2024-09-203-17/+83
|
* tor-keymgr: renamed ArtiNativeKeystoreConfig to ArtiKeystoreConfigMorgan2024-09-202-5/+6
|
* Merge branch 'ticket1604_01' into 'main'David Goulet2024-09-181-0/+1
|\ | | | | | | | | | | | | relay: Declare keys and add a KeyMgr to TorRelay Closes #1604 See merge request tpo/core/arti!2411
| * tor-keymgr: Set KeySpecifier deftly exported struct non_exhaustiveDavid Goulet2024-09-181-0/+1
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tor-keymgr: Enable the keymgr feature by default.Gabriela Moldovan2024-09-181-1/+1
|/ | | | `tor-keymgr` users now get the real keymgr implementation by default.
* tor-keymgr: put ephemeral keystore behind experimental featureSteven Engler2024-09-173-2/+11
| | | | Feature is named "ephemeral-keystore".
* Merge branch 'ephemeral-keystore-docs' into 'main'gabi-2502024-09-171-0/+6
|\ | | | | | | | | tor-keymgr: add disk-related docs to `ArtiEphemeralKeystore` See merge request tpo/core/arti!2424
| * tor-keymgr: add disk-related docs to `ArtiEphemeralKeystore`Steven Engler2024-09-171-0/+6
| |
* | Bump MSRV from 1.70 to 1.75.Wesley Aptekar-Cassels2024-09-161-1/+1
|/
* tor-keymgr: add an overwrite flag to KeyMgr::insert()Morgan2024-09-101-8/+47
|
* rename get_keypair_specifier() to keypair_specifier()Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-094-8/+8
| | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2393#note_3073480
* tor_keymgr: teach the KeyStore how to satisfy public key requests using a ↵Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-1/+9
| | | | | | | | | | | | | | | keypair Now that: - KeySpecifier::get_keypair_specifier() can be used to convert the KeySpecifier for a public key into the KeySpecifier for its secret key - ToEncodableKey<Key=PublicKey> has a "type level pointer" to ToEncodableKey<Key=KeyPair> We can use these two features together to automatically satisfy any request to get a public key using the corresponding secret key (if available).
* tor_key_forge::traits::ToEncodableKey: add KeyPair associated typeAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-0/+2
| | | | | | | | | | This comment adds a second associated type `KeyPair` to ToEncodableKey. For a `ToEncodableKey` which represents a (secret) KeyPair, this type is Self. For a `ToEncodableKey` which represents a public key, this is the `ToEncodableKey` whose `Key` is the pair of which this is the public part. This is essentially a "type level pointer" from the ToEncodableKey for a public key to the ToEncodableKey for its secret key.
* tor_keymgr: add get_keypair_specifier() to KeySpecifier, and derive itAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-094-0/+32
| | | | | | | This commit adds a new method `get_keypair_specifier()` to `KeySpecifier`. This method is used to indicate when one KeySpecifier (e.g. `KP_hs_id`) is the public part of another keypair (e.g. `KS_hs_id`). It will return the containing keypair in this case, and `None` otherwise.
* tor_hsservice: add `impl From<&FooPublicKeySpecifier> for ↵Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-0/+6
| | | | | | | | | | | | | FooKeypairSpecifier` instances This adds the following trivial `From` instances: - tor_hsservice: impl From<&HsIdPublicKeySpecifier> for HsIdKeypairSpecifier - tor_hsservice: impl From<&BlindIdPublicKeySpecifier> for BlindIdKeypairSpecifier - tor_hscrypto::pk: impl From<HsBlindIdKeypair> for HsBlindIdKey - tor_llcrypto::pk::ed25519: impl From<ExpandedKeypair> for PublicKey - tor_keymgr::mgr: impl From<TestKey> for TestPublicKey - tor::hscrypto::pk: impl From<HsIdKeypair> for HsIdKey
* Rename tor-keys crate to tor-key-forgeDavid Goulet2024-09-0410-16/+17
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-keymgr: Use tor-keys crate and remove dead codeDavid Goulet2024-09-0412-841/+51
| | | | | | | | | | | 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-042-33/+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]>
* Bump all the unstable tor- and arti- crates to 0.22.0.Gabriela Moldovan2024-09-031-8/+8
| | | | | | | | | | Done using: ``` for crate in $(./maint/list_crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.22.0 done ```
* Fix typosDimitris Apostolou2024-09-032-4/+4
|
* tor-keymgr: Remove unnecessary io::Error handling.Gabriela Moldovan2024-08-081-6/+0
| | | | | | `fs-mistrust` always maps `io::ErrorKind::NotFound` to `fs_mistrust::Error::NotFound`, so these `io::ErrorKind::NotFound` branches were unreachable.
* tor-keymgr: Use CheckedDir::metadata() instead of PathBuf::try_exists().Gabriela Moldovan2024-08-082-12/+48
| | | | | We now use `CheckedDir::metadata()` to check if the path exists and is of the correct type.
* tor-keymgr: Use the new relative path wrapper (fmt).Gabriela Moldovan2024-08-081-9/+15
|
* tor-keymgr: Use the new relative path wrapper.Gabriela Moldovan2024-08-082-43/+24
|
* tor-keymgr: Add new rel_path module with helpers for handling relative paths.Gabriela Moldovan2024-08-082-0/+77
|
* tor-keymgr: Add private RelKeyPath type for relative paths.Gabriela Moldovan2024-08-081-10/+22
| | | | | | | | This makes `rel_path` return a `RelKeyPath` instead of a `PathBuf` to prevent the accidental misuse of relative key paths (like the one from #1492). Closes #1494
* Don't need to tell docs.rs to enable `docsrs` cfgKunal Mehta2024-08-021-1/+0
| | | | | It now does it automatically, see <https://docs.rs/about/builds#detecting-docsrs>.
* Remove semver.md files post-release.Nick Mathewson2024-08-011-1/+0
|
* Bump versions for tor- and arti- crates to 0.21.0Nick Mathewson2024-08-011-8/+8
| | | | | | | | | | This is the result of: ``` for crate in $( ./maint/list_crates |grep '^\(tor\|arti-\)' ); do cargo set-version -p $crate 0.21.0 done ```
* tor-keymgr: Use Path::try_exists() instead of Path::exists().Gabriela Moldovan2024-07-301-3/+10
|
* Fix new "clippy::needless-maybe-sized" warning on nightlyNick Mathewson2024-07-281-1/+1
| | | | | This warning complains when we say `where T: SomeTrait + ?Sized` when `SomeTrait` is inherently Sized.
* tor-keymgr: Fix ArtiNativeKeystore::contains() bug.Gabriela Moldovan2024-07-171-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug in `ArtiNativeKeystore`'s `Keystore::contains()` implementation: previously, it called Path::exists() on the relative path (built by concatenating the key specifier and the extension), so unless your current directory happened to be the root of the keystore, `contains()` would always return `false`. `KeyMgr::generate` uses `Keystore::contains()` under the hood, so it was affected by this bug too: if called `overwrite = false`, it would misbehave and overwrite any existing keys. Internally, we call `KeyMgr::generate` in a couple of places: * `tor-hsservice/src/lib.rs`, to generate the `hsid` if it doesn't already exist. This callsite is not affected by the bug, because `KeyMgr::generate` is only called if `KeyMgr::get` returns `None` * `tor-hsservice/src/ipt_mgr.rs`, to generate `KS_hss_ntor` and `KS_hs_ipt_sid` keys for intro point establishment. This callsite is also not affected (because it too calls `get()` before attempting to `generate()`) The bug affects any downstream users that use `KeyMgr::generate` with a key manager backed by `ArtiNativeKeystore`. ------ `KeyMgr::get_or_generate` is not affected, even though it calls `Keymgr::generate` (it performs a separate extra check before calling `generate()`). (Both suffer from a known TOCTOU race, but that's a separate matter.) As an aside, I'd like to somehow unify `KeyMgr::get_or_generate` and `KeyMgr::get` (I've had some attempts in the past but ended up abandoning them because the result was more unergonomic than the existing APIs). Part of #1492
* tor-keymgr: Rename function to clarify it returns a relative path (fmt).Gabriela Moldovan2024-07-171-1/+2
|
* tor-keymgr: Rename function to clarify it returns a relative path.Gabriela Moldovan2024-07-171-15/+15
|
* tor-keymgr: Add test for ArtiNativeKeystore::contains.Gabriela Moldovan2024-07-171-0/+2
| | | | | | | | | | This new assertion fails, because the implementation of `ArtiNativeKeystore::contains()` is buggy: it calls Path::exists() on the relative path built by concatenating the key specifier and the extension (so unless your current directory happens to be the root of the keystore, contains() is always going to return false). Part of #1492
* tor-keymgr: Correct message for mistrust errorIan Jackson2024-07-102-4/+4
|
* Merge branch 'fix-time-period-parsing-bug' into 'main'gabi-2502024-07-081-5/+7
|\ | | | | | | | | tor-keymgr: Use collect_tuple in TimePeriod::from_slug. See merge request tpo/core/arti!2248
| * tor-keymgr: Use collect_tuple in TimePeriod::from_slug (fmt).Gabriela Moldovan2024-07-081-1/+2
| |
| * tor-keymgr: Use collect_tuple in TimePeriod::from_slug.Gabriela Moldovan2024-07-081-5/+5
| | | | | | | | | | | | The previous approach was buggy: collecting the parts of the time period into an `ArrayVec` of length 3 would panic if the number of parts was greater than 3.