| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |\
| |
| |
| |
| | |
feat: Make KeystoreEntry::new() public
See merge request tpo/core/arti!3288
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 6958b6c8 changed the way the `Keystore` trait works.
The `list` method must now return a `KeystoreEntry`. Before this change,
it was essentially impossible to implement keystores outside of
`tor-keymgr`. For 3rd party users of the Arti API that want to implement
a custom keystore, it became essentially impossible to do so.
To make this work again, this commit makes KeystoreEntry::new() public,
if the experimental-api feature is enabled.
|
| | |
| |
| |
| |
| | |
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`.
|
| | |
| |
| |
| | |
`RawKeystoreEntry` no longer exists, so these tests need to be updated.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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`.
|
| | |
| |
| |
| |
| |
| | |
Change all call sites.
This completes the rename.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This moves the logic for retrieving a public key from its corresponding
keypair into `get_from_store()`.
Fixes a bug which made it impossible to retrieve a public key using the
key specifier of its keypair type with any function other than
`KeyMgr::get()`.
|
| | |
| |
| |
| | |
This will be fixed in the next commit.
|
| | | |
|
| | |
| |
| |
| | |
I am about to repurpose this test helper for other item types too.
|
| | | |
|
| | |
| |
| |
| | |
This will enable us to test the provenance of public keys.
|
| | |
| |
| |
| |
| |
| |
| | |
When generating a new keypair, we want to use the keypair specifier of
the subject key. Fixes a bug where this code was incorrectly generating
a keypair using the specifier of the public key type (the resulting
generated key had a `kp_` prefix instead of `ks_`).
|
| | |
| |
| |
| |
| | |
This tests that the `KeyMgr` returns an error if you try to retrieve an
invalid cert.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a bit of a hack, but we need it to make the tests pass.
The issue is that our test keystore stores `TestItem`s, and all our
other test used `TestItem` as their key types. Now that we have certs,
we have this concept of a `ToEncodableCert::ParsedCert`, which is what
the keymgr downcasts the retrieved certs to before validating them and
returning the final cert result (which is usually going to be of a
different type than `ParsedCert`).
This wrapper ensures that the keystore returns the expected `ParsedCert`
type, so that validation doesn't fail.
Before this change, we were hackily returning `TestItem` in the tests,
even for certificates, but that doesn't work anymore, because the
`ItemType` impl of `TestItem` returns `KeyType::Ed25519Keypair`, which
is obviously not a `CertType`. Using it resulted in an error because
there is a mismatch between the cert `ItemType` (`Ed25519Keypair`) and
the `ItemType` of the `KeystoreItem::Cert` entry (`Ed25519TorCert`).
Normally this wouldn't happen, but the whole test keystore
implementation is funky and inconsistent.
|
| | | |
|
| | |
| |
| |
| |
| |
| | |
This will enable us to test against other keymgr APIs (e.g.
`list_matching()`), which require some extra trait impls that get
generated for free by our new `CertSpecifier` macro.
|
| | |
| |
| |
| | |
This will soon be used by other tests too.
|
| | |
| |
| |
| |
| |
| | |
This will enable us to retrieve a cert given its `KeystoreEntry`. This
is useful for retrieving certificates listed with
`KeyMgr::list_matching()`.
|
| | |
| |
| |
| |
| |
| |
| | |
We need to be able to parse KeyPaths into KeyCertificateSpecifier,
and we can't do that if the signing key is part of the cert specifier
(because the signing key doesn't get encoded in the key path, unlike the
subject key, which does)
|
| |\ \
| | |
| | |
| | |
| | |
| | |
| | | |
keymgr: Update cert ArtiPath building to use denotator sets
Closes #2377
See merge request tpo/core/arti!3754
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`KeyCertificateSpecifiers` have an `ArtiPath`, so it's only natural to
retrieve it via this new `KeySpecifier` implementation.
This replaces the old, ad-hoc `ArtiPath` building from the `KeyMgr`
implementation: IMO, the `KeyMgr` impl is the wrong place to build these
`ArtiPath`s (ideally they should remain opaque to the `KeyMgr`).
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | | |
Resolves a clippy warning.
|
| | | | |
|
| | | |
| | |
| | |
| | | |
Resolves a clippy warning.
|
| | | | |
|
| | | |
| | |
| | |
| | | |
As suggested by clippy
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This doesn't really need to be macro-generated, because these impls only
differ in the `KeystoreId`.
The code is intentionally misindented to make reviewing the diff a bit
easier. A future commit will reformat it all.
|
| | | | |
|
| |/ /
| |
| |
| |
| | |
I am about to remove this macro altogether and simplify the keystore
impls, so I am preemptively moving this into a separate function.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Out of all the variants in `KeyPathError`, `Unrecognized` is the odd one
out, because unlike the others, which are mainly just lower level
parsing errors, `Unrecognized` is a higher level error constructed in
`KeyMgr::describe()`.
`KeyMgr::describe()` now returns an `Option`, because
* the failure to describe a user provided `KeyPath` may or may not be
an error
* previously, `describe()` would only ever return `Ok` or
`Err(KeyPathError::Unrecognized)`, which essentially a binary
result. Also, `describe()` would never return any of the other
`KeyPathError` kinds, which further suggests `Unrecognized`
doesn't belong there
The `Unrecognized` variant still exists, but is now part of
`KeystoreCorruptionError`, (returned from
`KeyMgr::validate_entry_integrity()`).
|
| | |
| |
| |
| |
| | |
`KeyMgr::describe()` now works for `CTorPath`s too, so the key path
validation can be the same as for `ArtiPath`s.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
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]>
|
| | | |
|
| |/
|
|
| |
Run maint/add_warning
|
| | |
|