aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/keystore
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-072-9/+9
| | | | | 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: Make test module private again.Gabriela Moldovan2024-05-071-1/+1
| | | | | | | This doesn't need to be public anymore now that the test keys are exported from `test_utils`. Addresses https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2076#note_3016577
* tor-keymgr: Move TestSpecifier to test_utils.Gabriela Moldovan2024-05-072-26/+9
| | | | | | | 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-072-5/+2
| | | | | 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-103-4/+322
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Use tor_basic_utils::PathExt::display_lossyIan Jackson2024-03-051-4/+6
| | | | | Change Path::display to this new function, in call sites where it's being used for a diagnostic.
* Merge branch 'analyzer_windows_problems' into 'main'gabi-2502024-03-041-0/+1
|\ | | | | | | | | Fix rust-analyzer problems seen with default features on Windows See merge request tpo/core/arti!2009
| * tor-keymgr: Fix compilation on WindowsTobias Stoeckmann2024-02-291-0/+1
| | | | | | | | | | The PermissionsExt::from_mode function is not available on Windows and disabled in all other places of the file. Do so here as well.
* | keystore: Fix slugs creations on WindowsTobias Stoeckmann2024-03-011-2/+8
|/ | | | | | | The slugs used for ArtiPath must be separated by slashes, which Windows systems wouldn't do properly because paths are separated by backslashes. Implement a platform-independent way of slug creation.
* tor-keymgr: Use keystore_error_kind() to get the error kind.Gabriela Moldovan2024-01-151-1/+2
| | | | Closes #1215
* tor-keymgr: Turn a TODO HSS into #1118.Gabriela Moldovan2024-01-101-1/+1
|
* tor-keymgr: Turn a TODO HSS into #1095.Gabriela Moldovan2024-01-101-1/+1
|
* tor-keymgr: Update docs referencing outdated SSH algo names.Gabriela Moldovan2023-12-141-2/+2
|
* tor-keymgr: path errors: Add some xrefsIan Jackson2023-12-071-1/+6
|
* tor-keymgr: ArtiPathSyntaxError: rename from ArtiPathErrorIan Jackson2023-12-071-2/+2
| | | | | The previous name was ambiguous, and confusable with KeyPathError (of which it is, basically, a variant).
* tor-keymgr: Use CheckedDir::read_dir to validate dir permissions in list().Gabriela Moldovan2023-11-281-3/+13
| | | | | | | `ArtiNativeKeystore::list` now returns an error if the parent directory of any of its keys doesn't pass the `CheckedDir::read_dir` validation. Part of #1117
* tor-keymgr: Use the new CheckedDir::remove_file API.Gabriela Moldovan2023-11-281-20/+23
| | | | | | | This updates `ArtiNativeKeystore` to use the new `remove_file` API from arti!1759. Part of #1117
* tor-keymgr: Add an Arti keystore error type for keys with invalid key data.Gabriela Moldovan2023-11-211-0/+5
|
* tor-keymgr: Add a top-level error type.Gabriela Moldovan2023-11-211-0/+6
| | | | | | | | | | | | | Previously, the `tor_keymgr::Error` type was `Box<dyn KeystoreError>`. This forced us to impl `KeystoreError` for any error returned by the keymgr (including those that were not coming from a `Keystore` impl). Now, `tor_keymgr::Error` is an non-exhaustive enum and the `Box<dyn KeystoreError>` opaque error type is only returned from `Keystore` impls The reason we're keeping the `dyn KeystoreError` error type is because it enables `Keystore` implementors to use their own error types. Without it, they would have to choose from our (closed) set of error variants, which may not be suitable for their keystore. See #901.
* tor-keymgr: Inline SshKeyError variants into ArtiNativeKeystoreError.Gabriela Moldovan2023-11-201-2/+29
| | | | An `SshKeyError` *is* an Arti keystore error, so let's unify the two.
* tor-keymgr: Expand the ArtiNativeKeystore docs.Gabriela Moldovan2023-11-131-1/+19
|
* tor-keymgr: Clarify what ArtiPath are used for.Gabriela Moldovan2023-11-131-1/+3
|
* tor-keymgr: Fix broken doc link.Gabriela Moldovan2023-10-191-1/+1
|
* tor-keymgr: Rename KeyPathError to ArtiPathUnavailableError (fmt).Gabriela Moldovan2023-10-191-2/+3
|
* tor-keymgr: Rename KeyPathError to ArtiPathUnavailableError.Gabriela Moldovan2023-10-191-6/+6
|
* tor-keymgr: Apply cargo fmt.Gabriela Moldovan2023-10-192-4/+10
|
* tor-keymgr: Make error handling less repetitive using a closure.Gabriela Moldovan2023-10-191-9/+8
|
* tor-keymgr: Rework the ArtiPath error types.Gabriela Moldovan2023-10-192-14/+13
|
* tor-keymgr: Add function for listing all entries in a keystore.Gabriela Moldovan2023-10-191-3/+153
|
* tor-keymgr: Give KeyType an Unknown variant.Gabriela Moldovan2023-10-192-48/+51
|
* tor-keymgr: Use ArtiPathError for invalid ArtiPaths.Gabriela Moldovan2023-10-191-6/+31
|
* tor-keymgr: Add an error type for invalid key paths.Gabriela Moldovan2023-10-191-1/+29
|
* tor-keymgr: Encode whether the key is public or private in the file extension.Gabriela Moldovan2023-10-131-2/+2
| | | | | | | | | | | | | | There are 2 reasons to make this change: * because having the word `private` in the extension will make it more difficult to accidentally misuse or misplace a private key (see https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1618#note_2947461) * because `Keystore`s will soon grow a `list()` function returning all `(ArtiPath, KeyType)`s in the keystore, and in order for `ArtiNativeKeystore` to implement this function, it will need to be able to reverse the `KeyType -> file extension` mapping (if two different `KeyType`s are mapped to the same extension, `ArtiNativeKeystore`s won't be able to reverse the mapping)
* tor-keymgr: Implement ArtiNativeKeystore::insert for public keys.Gabriela Moldovan2023-10-031-3/+7
|
* tor-keymgr: Rename as_ssh_keypair_data to as_ssh_key_data.Gabriela Moldovan2023-09-261-1/+1
| | | | | This function no longer returns `KeypairData` (it now returns `SshKeyData`).
* tor-keymgr: Make EncodableKey support public keys too.Gabriela Moldovan2023-09-251-7/+17
| | | | | | | | | 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-keymgr: Represent unparsed ssh key as strings.Gabriela Moldovan2023-09-251-2/+2
| | | | | | | | The underlying representation of an `UnparsedOpenSshKey` is now a `String`. This will make it easier to support storing public keys in the keystores: in the future, we will use `PublicKey::from_openssh` to parse public keys, and `PublicKey::from_openssh` expects a string slice (unlike `PrivateKey::from_openssh`, which takes a `&[u8]`).
* tor-hsclient, arti-client, tor-keymgr, tor-netdoc: Use a keypair instead of ↵Gabriela Moldovan2023-09-251-1/+1
| | | | | | | | | | | | | 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-keymgr: Remove redundant _private suffix from key extension.Gabriela Moldovan2023-09-121-2/+2
| | | | The privateness of the keys is encoded in their name.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* tor-error: Remove KeystoreFsPermissions variant.Gabriela Moldovan2023-08-081-1/+1
| | | | | | | | According to the `ErrorKind` lumping guidelines, `KeystoreFsPermissions` should be lumped with `FsPermissions`: they represent the same type of error, and their "location" is the same ("Host"). Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1315#note_2916455
* keymgr: Implement SshEncodableKey for ed25519::Keypair.Gabriela Moldovan2023-08-021-3/+2
|
* keymgr: Remove KeyType::to_ssh_format.Gabriela Moldovan2023-08-021-1/+13
| | | | | | | | This function isn't actually needed (it's not the responsibility of `KeyType` to encode keys). This commit also rewrites `ArtiNativeKeystore::insert` to use the new `as_ssh_keypair_data` function instead of `to_ssh_format`.
* keymgr: Test whether insert() creates the missing directories.Gabriela Moldovan2023-07-241-9/+21
|
* keymgr: Create the parent directories as neededGabriela Moldovan2023-07-241-1/+12
|
* keymgr: Add a Keystore::contains accessor.Gabriela Moldovan2023-07-241-0/+4
|
* keymgr: Use KeystoreId instead of a static string.Gabriela Moldovan2023-07-211-7/+9
|