summaryrefslogtreecommitdiff
path: root/crates/tor-key-forge/src
Commit message (Collapse)AuthorAgeFilesLines
* relay: Implement a helper to build RelayIdentitiesDavid Goulet2026-02-231-0/+5
| | | | | | | This required to add a slight helper to our tor-key-forge RSA key d-d macro to access the inner keypair. This avoids a clone. Signed-off-by: David Goulet <[email protected]>
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-062-2/+2
| | | | Run maint/add_warning
* Lay foundations for RSA keys in keystore.Wesley Aptekar-Cassels2025-09-302-3/+29
| | | | | | 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.
* Merge branch 'tor-keyforge-rsa-types' into 'main'wesleyac2025-09-303-5/+244
|\ | | | | | | | | tor-key-forge: Add RSA key types. See merge request tpo/core/arti!3236
| * tor-llcrypto: Rename rsa::PrivateKey to rsa::KeyPair.Wesley Aptekar-Cassels2025-09-082-11/+11
| | | | | | | | As discussed with gabi on IRC today.
| * tor-key-forge: Add RSA key types.Wesley Aptekar-Cassels2025-09-083-5/+244
| | | | | | | | | | | | | | Some things I'm still considering here: * We may want to define a tor_llcrypto::pk::rsa::Signature newtype. * We likely want to rename tor_llcrypto::pk::rsa::PrivateKey to RsaKeypair.
* | Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
|/ | | | This feature has been removed from nightly, in favor of doc_cfg.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-074-8/+8
| | | | | | | | | | | | | | 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.
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* fix `clippy::doc_overindented_list_items`Steven Engler2025-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | Example: ```text warning: doc list item overindented --> crates/arti-rpc-client-core/src/conn/connimpl.rs:322:9 | 322 | /// indicates that no more messages will be received for this request. | ^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items note: the lint level is defined here --> crates/arti-rpc-client-core/src/lib.rs:8:9 | 8 | #![warn(clippy::all)] | ^^^^^^^^^^^ = note: `#[warn(clippy::doc_overindented_list_items)]` implied by `#[warn(clippy::all)]` ```
* Use an EntropicRng trait to enforce key generation rules.Nick Mathewson2025-03-242-8/+13
| | | | | | | | | | | We want to require that whenever we generate a key that's persistent (stored in KeyMgr), it's going to be made from a stronger-than-usual Rng. This trait helps us enforce that. We also add a FakeEntropicRng struct to use for testing. Note that this turned up a case that we'd missed, which required an internal change in tor-hsservice.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-2/+2
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* key-forge: Use CryptoRng from rand.Nick Mathewson2025-03-181-2/+1
| | | | | Previously we used the version signature::rand_core for some reason, but that's now incompatible.
* Wrap ed25519-dalek types.Nick Mathewson2025-03-181-10/+10
| | | | | | | | | | | With this change, we'll no longer need to expose the types from dalek-cryptography as part of our API, and we'll have more freedom to switch ed25519 implementations, or to upgrade to a newer `rand` ahead of their schedule. Unlike with x25519-dalek, I had to tweak the API a bit: There's no way to get a &PublicKey out of a Keypair now, and implementing the old ed25519-dalek traits seemed unnecessary.
* tor-key-forge: Remove no longer needed ItemType impl for KeyUnknownCert.Gabriela Moldovan2025-01-131-9/+0
| | | | | No longer used, because we're now using `ParsedEd25519Cert` instead of `KeyUnknownCert` to represent parsed but not yet validated certs.
* tor-key-forge: Implement ItemType for ParsedEd25519Cert.Gabriela Moldovan2025-01-131-0/+9
| | | | | This will enable us to retrieve it from the keystore as an `ErasedKey` (side note, we should rename `ErasedKey` to `ErasedItem`).
* tor-key-forge: Add wrappers for various cert types.Gabriela Moldovan2025-01-132-3/+115
|
* tor-key-forge: Fill out the InvalidCertError type.Gabriela Moldovan2025-01-131-1/+19
| | | | We'll soon use this.
* tor-key-forge: Fix typo in doc comment.Gabriela Moldovan2025-01-131-1/+1
|
* tor-keymgr: Add cert parse error variant.Gabriela Moldovan2025-01-131-0/+4
| | | | | | | 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: Add ItemType impl for KeyUnknownCert.Gabriela Moldovan2025-01-131-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `KeyUnknownCert` will soon be used as the `ToEncodableCert::ParsedCert` type for Tor ed25519 certs. For example, the `ToEncodableCert` impl for `RelaySigningKeyCert` will look like this: ```rust pub struct RelaySigningKeyCert(EncodedEd25519Cert); impl ToEncodableCert<RelaySigningKeypair> for RelaySigningKeyCert { type ParsedCert = KeyUnknownCert; type EncodableCert = EncodedEd25519Cert; type SigningKey = RelayIdentityKeypair; fn validate( cert: Self::ParsedCert, subject: &RelaySigningKeypair, signed_with: &Self::SigningKey, ) -> Result<Self, InvalidCertError> { // TODO: validate `KeyUnknownCert` // and convert it to an EncodedEd25519Cert // (we don't yet an easy way to perform this conversion) } fn to_encodable_cert(self) -> Self::EncodableCert { self.0 } } ```
* tor-key-forge: Split out ItemType as a separate trait.Gabriela Moldovan2025-01-133-18/+39
| | | | | | | | 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.
* tor-key-forge: Distinguish between parsed certs and encodable certs.Gabriela Moldovan2025-01-131-4/+7
| | | | | | | | | | | | | | | We need two different types to represent * certs that have been parsed, but not yet validated (`KeyUnknownCert`) * newly generated encodable certs (`EncodedEd25519Cert`) Currently, we don't use `KeyUnknownCert` anywhere, and instead use `EncodedEd25519Cert` to represent "parsed" but not-yet-validated certs. This approach is wrong and relies on a broken (no-op) `EncodedEd25519Cert::from_bytes` implementation. A future commit will address this problem by replacing `EncodedEd25519Cert::from_bytes` with `Ed25519Cert::decode` to actually parse the cert upon retrieving it from the keystore.
* tor-keymgr: Replace from_encodable_cert with validation function.Gabriela Moldovan2025-01-131-7/+2
| | | | | | | | In practice, we won't be able to obtain an `ToEncodableCert` type from an `EncodableItem` cert without validating it first, so we need to collapse `validate` into `from_encodable_cert`. Part of #1768
* tor-key-forge: Export some additional tor-cert types.Gabriela Moldovan2025-01-131-3/+3
| | | | This will soon be used.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* tor-hscrypto: Move encodable key trait impls from tor-key-forge.Gabriela Moldovan2024-12-111-112/+0
| | | | | | | | | This enables us to get rid of the tor-key-forge -> tor-hscrypto dependency, partially addressing the TODO from `tor_key_forge::traits`. This commit is mostly code motion. Best reviewed with `--color-moved`. See also #1778
* tor-key-forge: Abolish the HasKind impl of Error.Gabriela Moldovan2024-12-101-14/+0
| | | | | | | We can't possibly know the `ErrorKind` of such an error, unless we know where the unsupported key came from. Since we can't know this, we should let a higher level crate (like `tor-keymgr`) decide the `ErrorKind` instead.
* tor-key-forge: Export certificate-related types.Gabriela Moldovan2024-12-041-0/+5
|
* tor-key-forge: Implement KeystoreItem::item_type.Gabriela Moldovan2024-12-042-2/+9
|
* tor-key-forge: s/EncodableKey/EncodableItem in documentation.Gabriela Moldovan2024-12-041-11/+11
|
* tor-keymgr: Add KeyMgr::get_key_and_cert() (fmt).Gabriela Moldovan2024-12-041-1/+4
|
* tor-keymgr: Add KeyMgr::get_key_and_cert().Gabriela Moldovan2024-12-041-1/+1
|
* tor-key-forge: Implement EncodableItem for Tor ed25519 certs.Gabriela Moldovan2024-12-042-2/+17
| | | | | This will enable us to store `tor_cert::EncodedEd25519Cert`s in the keystore.
* tor-keymgr: Replace as_ssh_key_data with as_keystore_item (fmt).Gabriela Moldovan2024-12-041-1/+2
|
* tor-keymgr: Replace as_ssh_key_data with as_keystore_item.Gabriela Moldovan2024-12-042-17/+16
|
* tor-key-forge: Add into_erased impl for KeystoreItem.Gabriela Moldovan2024-12-041-1/+12
| | | | This will be used by the `Keystore` implementations.
* tor-key-forge: Replace EncodableItem::key_type() with item_type().Gabriela Moldovan2024-12-043-19/+15
| | | | | This function now returns a `KeystoreItemType`, enabling us to represent certs as `EncodableItem`s.
* tor-key-forge: Let declare_item_type macro generate the tests.Gabriela Moldovan2024-12-041-32/+52
| | | | | This enables us to auto-generate tests for all the supported key/cert file extensions.
* tor-key-forge: Remove no longer needed KeyType::Unknown variant.Gabriela Moldovan2024-12-041-28/+3
| | | | | Items that have an unrecognized file extension now get mapped to `KeystoreItemType::Unknown`.
* tor-key-forge: Export KeystoreItem.Gabriela Moldovan2024-12-041-1/+1
|
* tor-key-forge: Rename EncodableKey to EncodableItem.Gabriela Moldovan2024-12-043-19/+19
| | | | | | | | 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)
* tor-key-forge: Add a KeystoreItem type to replace SshKeyData.Gabriela Moldovan2024-12-041-1/+22
| | | | | | | The `EncodableKey` trait will soon be extended to support encoding certificates too (in addition to keys), so we need a type to represent an object that is either a key or a certificate (in other words, an encodable *item*).
* tor-key-forge: Add an encodable cert type.Gabriela Moldovan2024-12-042-0/+25
|
* tor-key-forge: Add a ToEncodableCert trait.Gabriela Moldovan2024-12-042-1/+50
|
* tor-keymgr: Introduce a KeystoreItemType to replace KeyType.Gabriela Moldovan2024-12-042-6/+136
| | | | | Soon the keystore will be able to store certs too, so we need something other than `KeyType` to represent the "type" of a keystore entry.
* Resolve clippy::empty_line_after_doc_comments warnings.Nick Mathewson2024-12-031-1/+1
| | | | These are new in Rust 1.83.
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.