summaryrefslogtreecommitdiff
path: root/crates/tor-hscrypto/src/pk.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-hscrypto: Impl From<&HsBlindIdKeypair> for HsBlindIdKey.Gabriela Moldovan2023-08-251-0/+7
| | | | This will be used by the descriptor publisher when building descriptors.
* tor-hscrypto: Add a function for deriving the subcredential.Gabriela Moldovan2023-08-251-3/+15
| | | | | | This function will be used by the descriptor publisher (it needs to generate descriptors, and for that it needs the subcredential, which can be derived from the `HsBlindIdKey` and `TimePeriod`).
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* hscrypto: downgrade a comment to HSSNick Mathewson2023-06-221-1/+1
|
* New ErrorKind for invalid onion addressesNick Mathewson2023-06-221-0/+15
| | | | Use this to emit HS_BAD_ADDRESS as appropriate.
* hscrypto: comment out an unused key type.Nick Mathewson2023-06-131-5/+6
| | | | | | | | (I'm not removing it entirely since maybe we _should_ use it, and maybe we _will_ as we do services. I've added a TODO HS for removing it or using it, and removed the TODO HS at the head of pk.rs about making sure that all the key types in the module really belong there.)
* hscrypto: Remove a TODO about extending an internal macro.Nick Mathewson2023-06-131-2/+0
|
* hscrypto: Remove a TODO about implementing ErrorKind.Nick Mathewson2023-06-131-1/+0
| | | | | | I think it isn't actually a great idea for HsIdParseError to implement ErrorKind, since the actual ErrorKind would depend entirely on where the problematic ID came from.
* hscrypto: clarify and downgrade TODOs about blinding secretsNick Mathewson2023-06-131-2/+10
|
* hscrypto: Remove an incorrect comment.Nick Mathewson2023-05-181-5/+0
| | | | | (It said that we want to deprecate all unescorted secret keys; in fact, only unescorted EdDSA secrets are bad.)
* hscrypto: Replace ed25519 secret keys with keypairsNick Mathewson2023-05-181-42/+32
| | | | Part of #798: We no longer use unescorted ed25519 secret keys.
* hscrypto: Add comment about impl that will be removed after we address #798.Gabriela Moldovan2023-05-031-0/+2
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* hscrypto: Add From impl for deriving KP_hsc_desc_enc out of KS_hsc_desc_enc.Gabriela Moldovan2023-05-031-0/+6
| | | | | | | | | | The `HsClientSecretKeys` stored in the HS client connection context only have the secret keys. Certain APIs (such as `HsDesc::parse`) expect a keypair (both `HsClientDescEncKey` and `HsClientDescEncSecretKey`). This `From` impl makes it possible to get a `HsClientDescEncKey` out of `HsClientDescEncSecretKey`. Signed-off-by: Gabriela Moldovan <[email protected]>
* Debug as hex strings for HsBlindId and HsDirIndexIan Jackson2023-03-311-2/+3
|
* Stop requiring the caller to supply `AuthClient`s.Gabriela Moldovan2023-03-311-0/+15
| | | | | | | | | | | | | | | | | | `AuthClient`s were originally meant to represent parsed `auth-client` lines. In !1070, this struct was repurposed for representing individual authorized clients in the HS descriptor encoder. However, hidden services will likely use a list of public keys to represent the authorized clients rather than a list of `AuthClient`s, as the information from an `AuthClient` (`client_id`, `iv`, `encrypted_cookie`) likely won't be immediately available to the hidden service. This change updates the HS descriptor encoder to represent authorized clients as a list of `curve25519::PublicKey`s. As such, it is now the responsibility of the encoder to create the `client_id`, `iv`, and `encrypted_cookie` using the available keys, the unencrypted descriptor cookie, and HS subcredential. Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-hscrypto: key blinding: Use consistent terminologyIan Jackson2023-03-281-10/+12
| | | | | | | | * Don't ever use the words "parameter" or "param". These doesn't appear in the spec anywhere. * Use `h` as the variable name for the unclamped blinding factor, and `blinding_factor` in function names.
* Use the type system to enforce use of blinded keys.Gabriela Moldovan2023-03-271-0/+24
| | | | | | | | | | | | | | | 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]>
* Improve error from HsId parse of "www.B32.onion"Ian Jackson2023-03-091-2/+11
| | | | And add some clarity and todos about address errors.
* Test HsId parse of subdomainIan Jackson2023-03-091-0/+1
| | | | This error is not great.
* Use strip_suffix_ignore_ascii_case to quickly reject non-.onion HsId (fmt)Ian Jackson2023-03-081-1/+3
|
* Use strip_suffix_ignore_ascii_case to quickly reject non-.onion HsIdIan Jackson2023-03-081-3/+3
|
* Impl Redactable for HsIdIan Jackson2023-03-071-1/+25
|
* Debug HsId as the .onion; retain the hex printing as {:x}Ian Jackson2023-03-071-3/+10
|
* impl Display for HsIdIan Jackson2023-03-071-1/+144
|
* tor-llcrypto: Add a TODO re impl Redactable for HsIdIan Jackson2023-03-011-0/+1
|
* tor-hscrypto: Provide manual Debug impl for HsIdIan Jackson2023-03-011-1/+16
| | | | | This is still not great, but it at least makes the output plausible to read by eye.
* HS secret keys: Move aggregate/config to tor-hsclientIan Jackson2023-03-011-11/+0
| | | | | | | | Provide a more cookied "secret keys for use to connecting to a particular HS" type, with a builder. This wants to use config stuff, so oughtn't to be in tor-*crypto. The individual types remain there.
* hscrypto: Use minutes, not seconds, in blinding parameter.Nick Mathewson2023-02-101-8/+4
| | | | | | | | | | | | Fixes an instance of #768. The problem with the test vectors is that I used a random time period number (1234) and the default-in-tor period length (1440) without checking whether 1440 _meant_ minutes or seconds. I'll add another test to Tor to make sure that the time period matches now. With this change, I can test Tor-generated hsdescs with encryption, so I'm fairly confident that the new behavior is correct.
* hs time handling: Make TimePeriod contain length as IntegerMinutesIan Jackson2023-02-091-1/+4
| | | | | | Locally, the only functional effect is that now we refuse to handle non-whole-number-of-minutes lengths - but since the consensus parameter can't represent those, there's no overall functional change.
* hscrypto,netdoc: Add and use a type for KP_hss_desc_enc.Nick Mathewson2023-02-081-0/+8
|
* tor-hscrypto: Rename key types to correspond to new spec names.Nick Mathewson2023-02-081-62/+56
|
* Rename key identifiers that have changed in the specNick Mathewson2023-02-081-1/+1
| | | | | | | | | Generated with perl: s/K([PS])_hs_intro_tid/K$1_hs_ipt_sid/g; s/K([PS])_onion_ntor/K$1_ntor/g; s/K([PS])_hs_intro_ntor/K$1_hss_ntor/g; s/K([PS])_hs_desc_ephem/K$1_hss_desc_enc/g;
* hscrypto: Impl From<Ed25519Identity> for BlindedOnionId.Nick Mathewson2023-02-071-0/+6
|
* 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.
* hscrypto: Explain why vanity onions require expanded secret keys.Nick Mathewson2023-01-251-1/+11
|
* hscrypto: document why we have keys in un-expanded formNick Mathewson2023-01-251-3/+12
|
* Apply several clarifications (and fixes for missing refs)Ian Jackson2023-01-251-0/+2
|
* hscrypto: Revise TimePeriod to account for variable offset.Nick Mathewson2023-01-241-1/+4
| | | | | | | | Previously, the offset was set to 12 hours unconditionally (like the spec says). But based on a conversation on tor-dev, it seems that the offset should actually be 12 times the voting interval. I'm also opening an MR to change the spec.
* hscrypto: Add documentation for ClientSecretKeysNick Mathewson2023-01-241-0/+3
|
* Add a note about why we use ExpandedSecretKey for OnionIdSecretKeyNick Mathewson2023-01-241-1/+5
|
* hscrypto: Add our standard clippy warningsNick Mathewson2023-01-241-0/+10
| | | | | | (I have squashed the fixes for these warnings into the earlier commits in this branch, so it will look like I did everything right the first time.)
* hscrypto: Implement key blinding.Nick Mathewson2023-01-241-8/+223
| | | | | This implementation was made based on the specification, and then validated against itself, and against C Tor.
* hscrypto: use a macro to define our byte wrappers too.Nick Mathewson2023-01-241-3/+7
|
* hscrypto: Add and use a macro to define all PK types.Nick Mathewson2023-01-241-36/+26
|
* hscrypto: A couple of spelling fixes.Nick Mathewson2023-01-241-2/+2
|
* hscrypto: Associate each type with new name from rend-spec-v3.txtNick Mathewson2023-01-241-8/+10
|
* CircMgr: Draft APIs used to implement onion service clients.Nick Mathewson2023-01-241-0/+9
|
* hscrypto: Add several derivesNick Mathewson2023-01-111-0/+9
| | | | | The important addition here is the Copy derives, which affect API design. I'm applying them to the types that are 32 byte or smaller.
* Create a new tor-hscrypto crate.Nick Mathewson2023-01-061-0/+124
This module has types and operations needed in multiple places for an onion service implementation. There are a bunch of TODO hs-crypto comments that we'll need to fill in.