| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
This commit adds .to_bytes() to RsaIdentity which is similar to
.as_bytes() except that it returns the RsaIdentity as a byte array.
We are going to need this at a few places in tor-dirserver. The naming
was inspired from x25519-dalek which has similar .as_bytes() and
.to_bytes() methods. Besides, copying 20 bytes shall be okay and it
avoids having to write ugly try_into() constructs.
|
| |
|
|
|
|
|
|
| |
This is intended to be analogous to `RsaIdentity::from_hex()`.
I've found myself wanting this a few times, and it makes it easy to grab
a `master-key-ed25519` from the consensus and paste it into the code
without needing to do extra conversions.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This commit adds the method `as_hex_upper(&self) -> String` to
`RsaIdentity`, which returns the `RsaIdentity` as a hexadecimal string
in uppercase.
Although this type already implements `ToString`, this result is
unsuitable for working with consensuses because they neither contain a
`$` prefix, nor are encoded in lowercase.
|
| |
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
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-key-forge: Add RSA key types.
See merge request tpo/core/arti!3236
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
As discussed with gabi on IRC today.
|
| | |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| |
| | |
I didn't even realize I was still conditionally using it on a feature.
That's what I get for always testing with all-features.
Signed-off-by: hashcatHitman <[email protected]>
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is my initial attempt at deriving ConstantTimeEq and PartialEq.
This includes the previously missed HsSvcNtorKeypair and
HsClientDescEncKeypair types.
In tor-llcrypto, a few implementations still had to be done by hand, and
some types which previously derived normal PartialEq now derive it with
ConstantTimeEq.
I could not figure out how to properly set up the macros such that they
could be used both in the current crate and in others, so for the moment
they are duplicated. Just so I can get feedback. Ideally, this will be
replaced with a better solution before merge.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
|
| |
`tor_llcrypto::pk::ed25519::PublicKey` is based on `ed25519_dalek::VerifyingKey`
and not `ed25519_dalek::SigningKey`.
|
| |
|
|
|
|
|
|
|
| |
dalek-cryptography is still on rand 0.8, so we need a compatibility
shim for the Rng.
Fortunately, since we merged interface-abstraction-of-the-daleks
(!2868), we no longer need to propagate this compatibility layer
throughout our codebase.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
(fmt)
|
| |
|
|
| |
It's not documented anywhere ATM. I will do that in a followup MR.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
FooKeypairSpecifier` instances
This adds the following trivial `From` instances:
- tor_hsservice: impl From<&HsIdPublicKeySpecifier> for HsIdKeypairSpecifier
- tor_hsservice: impl From<&BlindIdPublicKeySpecifier> for BlindIdKeypairSpecifier
- tor_hscrypto::pk: impl From<HsBlindIdKeypair> for HsBlindIdKey
- tor_llcrypto::pk::ed25519: impl From<ExpandedKeypair> for PublicKey
- tor_keymgr::mgr: impl From<TestKey> for TestPublicKey
- tor::hscrypto::pk: impl From<HsIdKeypair> for HsIdKey
|
| |
|
|
|
|
|
|
|
| |
Now it exists unconditionally so that we can have our assertion for
public key consistency happen unconditionally. (Blinding secret
keys is not remotely in the critical path, so I'm not concerned
about the critical path.)
From a suggestion from Gabi on !2341.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
The `blind_keypair` function should only call `blind_pubkey` when it
is present.
Also, fix the documentation: blind_keypair is a hsv3-service function,
not a hsv3-client function.
Closes #1504.
|
| | |
|
| | |
|
| |
|
|
| |
Resolves clippy complaints about needless fallible conversions.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
With this change, we no longer expose the ExpandedSecretKey
unescorted, which makes it harder to misuse the API.
|
| | |
|
| |
|
|
| |
(These types were all already re-exported from pk::ed25519.)
|
| |
|
|
|
|
|
| |
This type was part of `hazmat`, and was no longer necessary anywhere
in our codebase. (It had one remaining user, which was easy enough
to remove.) By removing it, we remove the opportunity for using an
unescorted ed25519 private key.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
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.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
Nightly rustdoc now warns if you have a link that isn't necessary,
and if you have a link that might refer to two different things.
|
| |
|
|
| |
This fixes a needless_vec lint on nightly.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This removes the `# Availability` section from the
`convert_ed25519_to_curve25519_private` and
`convert_curve25519_to_ed25519_private` docs.
We don't generally have this sort of section anywhere else in the
codebase (we use unstable cargo-docs features to make sure items are
annotated correctly).
|
| |
|
|
|
|
| |
The `convert_curve25519_to_ed25519_private` and
`convert_ed25519_to_curve25519_private` functions are now exported by
`tor-llcrypto` if the `cvt-25519` feature is enabled.
|
| |
|
|
| |
convert_ed25519_to_curve25519_private.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This adds a TODO explaining how convert_ed25519_to_curve25519_private
will need to be audited when we upgrade to the latest x25519-dalek.
This also adds a `debug_assertions` and a test that ensures
`StaticSecret::from` is clamping the input (when we bump x25519-dalek,
the assertions will fail, as the latest version doesn't do clamping in
StaticSecret::from).
|