Skip to main content

EphemeralSecret

Struct EphemeralSecret 

Source
pub struct EphemeralSecret(pub(crate) Array<u8, U56>);
Expand description

An EphemeralSecret is a Scalar on Curve448.

Tuple Fields§

§0: Array<u8, U56>

Implementations§

Source§

impl EphemeralSecret

Source

pub fn new<R>(csprng: &mut R) -> Self
where R: CryptoRng + ?Sized,

👎Deprecated since 0.14.0: use the Generate trait instead

DEPRECATED: Generate a new ephemeral secret from the given RNG.

Source

pub(crate) fn as_scalar(&self) -> Scalar<Ed448>

Views an Secret as a Scalar

Source

pub fn diffie_hellman(&self, public_key: &PublicKey) -> SharedSecret

Performs a Diffie-hellman key exchange between the secret key and an external public key

Source

pub fn as_bytes(&self) -> &[u8; 56]

Converts a secret into a byte array

Source

pub(crate) fn clamp(bytes: Array<u8, U56>) -> Self

Construct an EphemeralSecret by the secret key according to RFC7748.

Trait Implementations§

Source§

impl Clone for EphemeralSecret

Source§

fn clone(&self) -> EphemeralSecret

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<&EphemeralSecret> for PublicKey

Given an EphemeralSecret Key, compute the corresponding public key using the generator specified in RFC7748

Source§

fn from(secret: &EphemeralSecret) -> PublicKey

Converts to this type from the input type.
Source§

impl Generate for EphemeralSecret

Source§

fn try_generate_from_rng<R>(csprng: &mut R) -> Result<Self, R::Error>
where R: TryCryptoRng + ?Sized,

Generate random key using the provided TryCryptoRng. Read more
Source§

fn generate_from_rng<R>(rng: &mut R) -> Self
where R: CryptoRng + ?Sized,

Generate random key using the provided CryptoRng.
Source§

fn try_generate() -> Result<Self, Error>

Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

fn generate() -> Self

Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

impl Zeroize for EphemeralSecret

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.