pub struct ExpandedKeypair {
pub(crate) secret: ExpandedSecretKey,
pub(crate) public: PublicKey,
}Expand description
A variant of Keypair containing an ExpandedSecretKey.
In the Tor protocol, we use this type for blinded onion service identity keys
(KS_hs_blind_id). Since their scalar values are computed, rather than taken
directly from a
SHA-512 transformation of a SecretKey, we cannot use the regular Keypair
type.
Fields§
§secret: ExpandedSecretKeyThe secret part of the key.
public: PublicKeyThe public part of this key.
NOTE: As with ed25519_dalek::SigningKey, this public key must be
the public key matching secret. Putting a different public key in
here would enable a class of attacks against ed25519 and enable secret
key recovery.
Implementations§
Source§impl ExpandedKeypair
impl ExpandedKeypair
Sourcepub fn sign(&self, message: &[u8]) -> Signature
pub fn sign(&self, message: &[u8]) -> Signature
Compute a signature over a message using this keypair.
Sourcepub fn to_secret_key_bytes(&self) -> [u8; 64]
pub fn to_secret_key_bytes(&self) -> [u8; 64]
Return a representation of the secret key in this keypair.
(Since it is an expanded secret key, we represent it as its scalar part followed by its hash_prefix.)
Sourcepub fn from_secret_key_bytes(bytes: [u8; 64]) -> Option<Self>
pub fn from_secret_key_bytes(bytes: [u8; 64]) -> Option<Self>
Reconstruct a key from its byte representation as returned by
to_secret_key_bytes().
Return None if the input cannot be the output of to_secret_key_bytes().
Trait Implementations§
Source§impl ConstantTimeEq for ExpandedKeypair
impl ConstantTimeEq for ExpandedKeypair
Source§impl Ed25519SigningKey for ExpandedKeypair
impl Ed25519SigningKey for ExpandedKeypair
Source§impl<'a> From<&'a Keypair> for ExpandedKeypair
impl<'a> From<&'a Keypair> for ExpandedKeypair
Source§fn from(kp: &'a Keypair) -> ExpandedKeypair
fn from(kp: &'a Keypair) -> ExpandedKeypair
Source§impl From<ExpandedKeypair> for PublicKey
impl From<ExpandedKeypair> for PublicKey
Source§fn from(ekp: ExpandedKeypair) -> PublicKey
fn from(ekp: ExpandedKeypair) -> PublicKey
Auto Trait Implementations§
impl Freeze for ExpandedKeypair
impl RefUnwindSafe for ExpandedKeypair
impl Send for ExpandedKeypair
impl Sync for ExpandedKeypair
impl Unpin for ExpandedKeypair
impl UnsafeUnpin for ExpandedKeypair
impl UnwindSafe for ExpandedKeypair
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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