pub struct Ecdh(/* private fields */);
Implementations§
Methods from Deref<Target = Curve>§
Sourcepub fn secret_key_size(&self) -> usize
pub fn secret_key_size(&self) -> usize
Returns the amount of bytes of a secret key using this curve
pub fn public_key_size(&self) -> usize
pub fn hpke_sampling_method(&self) -> SamplingMethod
Trait Implementations§
Source§impl DhType for Ecdh
impl DhType for Ecdh
type Error = EcdhKemError
fn dh( &self, secret_key: &HpkeSecretKey, public_key: &HpkePublicKey, ) -> Result<Vec<u8>, Self::Error>
Source§fn to_public(
&self,
secret_key: &HpkeSecretKey,
) -> Result<HpkePublicKey, Self::Error>
fn to_public( &self, secret_key: &HpkeSecretKey, ) -> Result<HpkePublicKey, Self::Error>
Outputs the public key corresponding to the given secret key bytes. If the secret
key is malformed, the function should return an error.
Source§fn generate(&self) -> Result<(HpkeSecretKey, HpkePublicKey), Self::Error>
fn generate(&self) -> Result<(HpkeSecretKey, HpkePublicKey), Self::Error>
Generate a fresh key pair. This is the only place where randomness is used in this
module. The function could be implemented in the same way as
derive
with random
ikm
, but it could also be implemented directly with a crypto provider like OpenSSL.Source§fn bitmask_for_rejection_sampling(&self) -> SamplingMethod
fn bitmask_for_rejection_sampling(&self) -> SamplingMethod
If the output is
Some(bitmask)
, then the Kem::derive
function will generate
the secret key by rejection sampling over random byte sequences with bitmask
applied to the most significant byte. Read morefn public_key_validate(&self, key: &HpkePublicKey) -> Result<(), Self::Error>
fn secret_key_size(&self) -> usize
fn public_key_size(&self) -> usize
impl Eq for Ecdh
impl StructuralPartialEq for Ecdh
Auto Trait Implementations§
impl Freeze for Ecdh
impl RefUnwindSafe for Ecdh
impl Send for Ecdh
impl Sync for Ecdh
impl Unpin for Ecdh
impl UnwindSafe for Ecdh
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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