TorEd25519SigningKey

Struct TorEd25519SigningKey 

Source
pub struct TorEd25519SigningKey { /* private fields */ }
Expand description

Tor Ed25519 Signing (private) key

Implementations§

Source§

impl TorEd25519SigningKey

Source

pub fn verifying_key(&self) -> VerifyingKey

Retrieve the public verifying key from the secret key

Source

pub fn scalar(&self) -> Scalar

Return the ED25519 scalar

Source

pub fn from_blob(blob: &str) -> Result<Self, TorError>

Create the signing key from the key blob returned by the ADD_ONION call (see https://github.com/torproject/torspec/blob/main/control-spec.txt#L1862-L1864)

Source

pub fn from_bytes(bytes: [u8; 64]) -> Self

Convert from raw bytes to the SigningKey

Source

pub fn verify( &self, message: &[u8], signature: &Signature, ) -> Result<(), SignatureError>

Verify a message against a signature

Source

pub fn to_blob(&self) -> String

Convert the key to a Tor blob value

Trait Implementations§

Source§

impl Display for TorEd25519SigningKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for TorEd25519SigningKey

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<[u8; 64]> for TorEd25519SigningKey

Source§

fn from(blob: TorBlob) -> Self

Converts to this type from the input type.
Source§

impl From<OnionService> for TorEd25519SigningKey

Convert an onion service to a signing key

Source§

fn from(onion_service: OnionService) -> Self

Converts to this type from the input type.
Source§

impl From<SigningKey> for TorEd25519SigningKey

Convert from an ED25519 signing key to our signing key. This takes the 32-byte secret key and hashes, clamps, and reduces it to the 64-byte expanded key.

Source§

fn from(signing_key: SigningKey) -> Self

Converts to this type from the input type.
Source§

impl FromStr for TorEd25519SigningKey

Convert from a Base64-encoded Tor blob to our signing key

Source§

type Err = TorError

The associated error which can be returned from parsing.
Source§

fn from_str(key: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Signer<Signature> for TorEd25519SigningKey

Implement signing for the Tor key

Source§

fn try_sign(&self, message: &[u8]) -> Result<Signature, SignatureError>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<S, T> SignerMut<S> for T
where T: Signer<S>,

Source§

fn try_sign(&mut self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, updating the state, and returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign(&mut self, msg: &[u8]) -> S

Sign the given message, update the state, and return a digital signature.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V