Skip to main content

X25519HkdfSha256

Struct X25519HkdfSha256 

Source
pub struct X25519HkdfSha256;
Expand description

Diffie-Hellman KEM(X25519, HKDF-SHA256) (KEM id 0x0020).

Provided for interoperability with existing RFC 9180 deployments. It is not post-quantum; new deployments SHOULD prefer the hybrid post-quantum MLKEM768X25519 KEM.

Trait Implementations§

Source§

impl Clone for X25519HkdfSha256

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for X25519HkdfSha256

Source§

impl Debug for X25519HkdfSha256

Source§

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

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

impl Eq for X25519HkdfSha256

Source§

impl Kem for X25519HkdfSha256

Source§

const HPKE_KEM_ID: u16 = 0x0020

The HPKE KEM identifier (draft-ietf-hpke-hpke-05 Section 7.1, IANA “HPKE KEM Identifiers”), used to build the ciphersuite suite_id.
Source§

const SHARED_SECRET_SIZE: usize = <HkdfSha256 as Kdf>::OUTPUT_SIZE

The size of the shared secret produced by this KEM. Read more
Source§

const ENCAPPED_KEY_SIZE: usize = <X25519Group as DiffieHellmanGroup>::PUBLIC_KEY_SIZE

The size of an encapsulated key.
Source§

const PUBLIC_KEY_SIZE: usize = <X25519Group as DiffieHellmanGroup>::PUBLIC_KEY_SIZE

The size of a serialized public key.
Source§

const SECRET_KEY_SIZE: usize = <X25519Group as DiffieHellmanGroup>::SECRET_KEY_SIZE

The size of a serialized secret key.
Source§

type PublicKey = PublicKey

The public (encapsulation) key type.
Source§

type SecretKey = SecretKey

The secret (decapsulation) key type.
Source§

type EncappedKey = PublicKey

The encapsulated key type (the KEM ciphertext sent alongside the first encrypted message).
Source§

fn derive_keypair( input_keying_material: &[u8], ) -> Result<(Self::SecretKey, Self::PublicKey), HpkeError>

Deterministically derives a key pair from input keying material. Read more
Source§

fn derive_public_key(secret_key: &Self::SecretKey) -> Self::PublicKey

Derives the public key of a secret key.
Source§

fn public_key_to_bytes( out: &mut [u8], public_key: &Self::PublicKey, ) -> Result<(), HpkeError>

Serializes a public key into out, which must be exactly Kem::PUBLIC_KEY_SIZE bytes long. Read more
Source§

fn public_key_from_bytes(bytes: &[u8]) -> Result<Self::PublicKey, HpkeError>

Deserializes a public key from bytes, which must be exactly Kem::PUBLIC_KEY_SIZE bytes long and a valid, fully validated public key. Read more
Source§

fn secret_key_to_bytes( out: &mut [u8], secret_key: &Self::SecretKey, ) -> Result<(), HpkeError>

Serializes a secret key into out, which must be exactly Kem::SECRET_KEY_SIZE bytes long. Read more
Source§

fn secret_key_from_bytes(bytes: &[u8]) -> Result<Self::SecretKey, HpkeError>

Deserializes a secret key from bytes, which must be exactly Kem::SECRET_KEY_SIZE bytes long. Read more
Source§

fn encapped_key_to_bytes( out: &mut [u8], encapped_key: &Self::EncappedKey, ) -> Result<(), HpkeError>

Serializes an encapsulated key into out, which must be exactly Kem::ENCAPPED_KEY_SIZE bytes long. Read more
Source§

fn encapped_key_from_bytes(bytes: &[u8]) -> Result<Self::EncappedKey, HpkeError>

Deserializes an encapsulated key from bytes, which must be exactly Kem::ENCAPPED_KEY_SIZE bytes long. Read more
Source§

fn encap_with_ephemeral( ephemeral_secret_key: &Self::SecretKey, recipient_public_key: &Self::PublicKey, ) -> Result<(Hash, Self::EncappedKey), HpkeError>

Encapsulates a shared secret against recipient_public_key, using the given ephemeral secret key ephemeral_secret_key. Read more
Source§

fn decap( encapped_key: &Self::EncappedKey, recipient_secret_key: &Self::SecretKey, ) -> Result<Hash, HpkeError>

Recovers the shared secret encapsulated in encapped_key with the secret key recipient_secret_key. Read more
Source§

const RANDOMNESS_SIZE: usize = Self::SECRET_KEY_SIZE

The size of the randomness consumed by Kem::encap_deterministic. Read more
Source§

fn generate_keypair() -> Result<(Self::SecretKey, Self::PublicKey), HpkeError>

Generates a fresh random key pair using the operating system’s random number generator. Read more
Source§

fn encap( recipient_public_key: &Self::PublicKey, ) -> Result<(Hash, Self::EncappedKey), HpkeError>

Encapsulates a fresh shared secret against recipient_public_key using a freshly generated ephemeral key pair. Read more
Source§

fn encap_deterministic( recipient_public_key: &Self::PublicKey, randomness: &[u8], ) -> Result<(Hash, Self::EncappedKey), HpkeError>

Encapsulates a shared secret against recipient_public_key from caller-provided randomness (EncapDerand). Read more
Source§

impl PartialEq for X25519HkdfSha256

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for X25519HkdfSha256

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.