summaryrefslogtreecommitdiff
path: root/crates/tor-cert/src/encode.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-cert: Ed25519CertBuilder: do builder fn renameIan Jackson2026-04-291-5/+3
| | | | | | Change all call sites. This completes the rename.
* tor-cert: Ed25519CertBuilder: do type rename everywhereIan Jackson2026-04-291-8/+8
| | | | Abolish the type alias and change call references.
* tor-cert: Ed25519CertBuilder: rename from Ed25519CertConstructorIan Jackson2026-04-291-0/+2
| | | | | | | | | | This is a perfectly ordinary builder type. There isn't any reason why it ought to be called "constructor". And, nowadays, we have things in tor-netdoc called Constructor that take a different approach. Briefly, leave a temporary compat alias, to make diffs more comprehensible. Currently this experimental, so no semver implications.
* tor-cert: Port to web-time-compatNick Mathewson2026-03-261-2/+2
|
* cell, proto, cert: Simplify CERTS cell building.Nick Mathewson2026-03-191-1/+22
| | | | | | | | Formerly we required the caller for push_cert_body to specify the type of the cert that they were pushing. But in nearly every case, the certificate object that the caller is holding knows what its own type is! This makes the tor_proto build_certs_cell function a bit less error-prone, since we don't have to worry about mismatch.
* cert: Deduplicate expiry-in-hours logicNick Mathewson2026-03-171-11/+8
| | | | | | | These certificates use a weird expiration format: counting hours since the unix epoch. Previously we had it implemented in two different places. This patch centralizes it, since we are about to become slightly more complicated.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-1/+0
| | | | | | | | | 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]>
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* clippy: fix `clippy::duplicated_attributes` warningsSteven Engler2025-08-111-1/+0
| | | | | | | | | | ```text warning: duplicated attribute --> crates/tor-hsservice/src/timeout_track.rs:630:14 | 630 | #![allow(clippy::needless_pass_by_value)] // TODO hoist into standard lint block | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* Wrap ed25519-dalek types.Nick Mathewson2025-03-181-2/+2
| | | | | | | | | | | 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-cert: Add experimental API for building EncodedEd25519Certs.Gabriela Moldovan2025-01-131-0/+17
| | | | | | | | | | | | | | | | This will enable us to deserialize byte slices as `EncodedEd25519Certs`. Needed because this type will be used to representing a parsed + validated cert retrieved from the keystore. Technically, we *could* do without this function by defining a separate newtype wrapper over `Vec<u8>` to represent the validated cert data, but IMO adding a second encoded ed25519 cert type in another crate might be confusing later down the line (because the two types will be nearly identical, and are bound to eventually diverge in terms of API and implementation). Part of #1137
* tor-cert: Remove no-longer-needed experimental API.Gabriela Moldovan2025-01-131-12/+0
| | | | Part of #1768
* tor-keymgr: Use Ed25519Cert::decode to parse the certs.Gabriela Moldovan2025-01-131-0/+1
|
* tor-cert: Add constructor for creating an encoded cert from a byte slice.Gabriela Moldovan2024-12-041-0/+11
| | | | | | This adds an experimental API for creating an `EncodedEd25519Cert` from a byte slice. We will need this in `ArtiNativeKeystore` for deserializing the on-disk certs to `KeystoreItem`s.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Remove RngCompatExt.Nick Mathewson2023-11-291-2/+1
| | | | | | | | | | 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.)
* Convert to the latest versions of dalek-cryptographyNick Mathewson2023-11-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tor-cert, tor-netdoc: Use EncodedEd25519Cert instead of Vec<u8>.Gabriela Moldovan2023-10-251-2/+2
|
* tor-cert: Add EncodedEd25519Cert type.Gabriela Moldovan2023-10-251-0/+13
|
* tor-netdoc: Update outdated doc string.Gabriela Moldovan2023-10-251-1/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* doc: note unreachable codeEmil Engler2023-08-101-0/+1
|
* test: encode unrecognized `tor_cert::CertExt`Emil Engler2023-08-101-0/+14
| | | | | This commit introduces a test for unrecognized `tor_cert::CertExt` fields.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Replace usage of KeyUnknownCert::check_key.Nick Mathewson2023-05-161-1/+1
|
* Use the type system to enforce use of blinded keys.Gabriela Moldovan2023-03-271-4/+6
| | | | | | | | | | | | | | | Hidden services use blinded singing keys derived from the identity key to sign descriptor signing keys. Before this patch, the hidden descriptor builder represented its blinded signing keys (`blinded_id`) as plain `ed25519::Keypair`s. This was not ideal, as there was nothing preventing the caller from accidentally initializing `blinded_id` with an unblinded keypair. This introduces a new `HsBlindKeypair` type to represent blinded keypairs. Signed-off-by: Gabriela Moldovan <[email protected]>
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+9
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Work around a new nightly clippy warningNick Mathewson2022-09-301-1/+1
| | | | | | | | | | | | | | The warning `clippy::bool_to_int_with_if` is meant to shout at you when you say `if x { 1 } else { 0 }` and instead suggest that you say `inttype::from(x)`. I agreed with this for the case in tor-cert, where we are literally converting a boolean into a flag. I don't agree with this in tor-netdoc, where we are using a boolean to decide how many fields to skip in a given document format. So for this case, I decided to clean up the code a little by renaming "skip" to "n_skip", and changing the boolean to use an enum instead.
* change usage of PublicKey to Ed25519 in tor-certtrinity-1686a2022-07-231-6/+6
| | | | and propagate to other affected crates
* change check_key to take a Option<&_> instead of &Option<_>trinity-1686a2022-07-231-1/+1
|
* tor-cert: Remove all usage of infallible writers.Nick Mathewson2022-07-111-1/+1
|
* tor-cert: Encoding now uses Writeable trait.Nick Mathewson2022-07-111-23/+18
| | | | This lets us remove a few TODOs.
* Rename "write" methods on tor-bytes to "write_infallible".Nick Mathewson2022-07-111-1/+1
| | | | | | | | | | | | | | | This comprises four renames: ``` write_onto -> write_onto_infallible write_into -> write_into_infallible write -> write_infallible writer_and_consume -> write_and_consume_infallible. ``` The rest of this branch will be concerned with replacing these `_infallible` methods with ones that return a `Result`. This is part of #513.
* Implement functionality to construct signed Ed25519 certs.Nick Mathewson2022-07-061-0/+200
This is behind a feature flag, since it isn't needed for pure clients: only onion services and relays need this. I've named the object that constructs these certs `Ed25519CertConstructor` because it doesn't follow the builder pattern exactly: mainly because you can't get an Ed25519Cert out of it. _That_ part is necessary because we require that an Ed25519Cert should only exist if the certificate was found to be well-signed with the right public key. Closes #511.