aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-key-forge/src/macros.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-key-forge: add a `secret()` accessor to the derived keypair typeSteven Engler2026-06-241-0/+9
|
* tor-key-forge: for `Curve25519Keypair` public key, add `inner()`Steven Engler2026-04-141-0/+10
|
* 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]>
* Lay foundations for RSA keys in keystore.Wesley Aptekar-Cassels2025-09-301-1/+1
| | | | | | 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.
* tor-llcrypto: Rename rsa::PrivateKey to rsa::KeyPair.Wesley Aptekar-Cassels2025-09-081-7/+7
| | | | As discussed with gabi on IRC today.
* tor-key-forge: Add RSA key types.Wesley Aptekar-Cassels2025-09-081-4/+189
| | | | | | | 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.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | 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.
* Use an EntropicRng trait to enforce key generation rules.Nick Mathewson2025-03-241-5/+7
| | | | | | | | | | | 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()`
* 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: Split out ItemType as a separate trait.Gabriela Moldovan2025-01-131-2/+8
| | | | | | | | 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-keymgr: Replace as_ssh_key_data with as_keystore_item.Gabriela Moldovan2024-12-041-4/+4
|
* tor-key-forge: Replace EncodableItem::key_type() with item_type().Gabriela Moldovan2024-12-041-4/+4
| | | | | This function now returns a `KeystoreItemType`, enabling us to represent certs as `EncodableItem`s.
* tor-key-forge: Rename EncodableKey to EncodableItem.Gabriela Moldovan2024-12-041-4/+4
| | | | | | | | 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: Reformat derives for readability.Gabriela Moldovan2024-10-171-2/+4
|
* tor-key-forge: Reformat a long line for readability.Gabriela Moldovan2024-10-171-1/+4
|
* key-forge: Add curve25519 key wrapper macroDavid Goulet2024-09-191-8/+161
| | | | | | Closes #1619 Signed-off-by: David Goulet <[email protected]>
* tor-key-forge: encapsulate `define_ed25519_keypair` macro depsSteven Engler2024-09-181-28/+40
| | | | | | | | | This re-exports the types/traits needed by the `define_ed25519_keypair` macro so that the macro caller doesn't need to import a bunch of extra packages in its Cargo.toml that it doesn't use, and so that the caller doesn't need a `use prelude::*` before invoking the macro. This makes the macro nicer to use for the caller, and should prevent the macro from causing "cannot find ... in this scope" errors.
* key-forge: Fix a comment with the wrong nameDavid Goulet2024-09-181-2/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* key-forge: Support extra docs and attributes to ed25519 keypairDavid Goulet2024-09-181-3/+7
| | | | Signed-off-by: David Goulet <[email protected]>
* key-forge: Add helper function and implement traitsDavid Goulet2024-09-181-12/+36
| | | | | | | | | | | | | | | Implement the signature::Signer and Ed25519PublicKey trait so the ed25519 keypair wrapper can be easily used for certificate creation. This also adds a to_ed25519_id() so we can get a Ed25519Identity which is an object used around. Finally, add a prelude module as the list of imports started to grow a bit out of control. Part of #1604 Signed-off-by: David Goulet <[email protected]>
* tor_key_forge::traits::ToEncodableKey: add KeyPair associated typeAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-0/+1
| | | | | | | | | | 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.
* Rename tor-keys crate to tor-key-forgeDavid Goulet2024-09-041-0/+174
Signed-off-by: David Goulet <[email protected]>