| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
|
| |
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`.
|
| |
|
|
|
|
|
|
|
| |
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]>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>>>`
|
| |
|
|
|
| |
* Change return type `Result<Vec<(KeyPath, KeystoreItemType)>>` if favor
of `Result<Vec<StdResult<(KeyPath, KeystoreItemType), UnrecognizedEntryError>>>`
|
| |
|
|
|
|
| |
Drop redundant/unused param item_type: &KeystoreItemType from
keystore::Keystore::insert. Method now uses param
key: &dyn EncodableItem to obtain a KeystoreItemType
|
| |
|
|
| |
Makes param item_type redundant. Renames item_type -> _item_type.
|
| | |
|
| | |
|
| |
|
|
|
| |
This is part of the work needed to support storing certificates in the
keystore (they won't have a `KeyType`, but rather `CertType`).
|
| |
|
|
|
|
|
|
| |
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)
|
| | |
|
| |
|
|
| |
We are about to use this for the ctor keystore implementation too.
|
| |
|
|
| |
Feature is named "ephemeral-keystore".
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| | |
|
| |
|
|
| |
This is a follow-up from !2131
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
This helps prevent external users from creating `SshKeyData` out of
unsupported types of `ssh_key::public::KeyData` and
`ssh_key::private::KeypairData`.
|
| |
|
|
| |
KeyData/KeypairData.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
I don't think we need to do this right now, so I am downgrading this
TODO.
Part of #1115
|
| |
|
|
|
|
| |
I think the current naming is fine.
Part of #1115
|
| | |
|
| | |
|
| |
|
|
|
| |
With this change, we no longer expose the ExpandedSecretKey
unescorted, which makes it harder to misuse the API.
|
| |
|
|
|
|
|
|
|
|
| |
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.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
`HsClientIntroAuthKeypair` is deprecated and no longer used as an
"encodable key".
|
| |
|
|
| |
(fmt).
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
`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`,
|
| |
|
|
|
|
| |
This adds a couple of new `HsSvcKeyRoles` for:
* `KS_hs_id` keypairs
* `KP_hs_blind_id` public keys keys
|
| |\
| |
| |
| |
| | |
tor-keymgr: Support storing `ed25519::ExpandedKeypair`s in the keystore
See merge request tpo/core/arti!1619
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| | |
We will need to add another variant to this when we add support for
certificates.
|