pub struct P256HkdfSha256;Expand description
Diffie-Hellman KEM(P-256, HKDF-SHA256) (KEM id 0x0010).
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 P256HkdfSha256
impl Clone for P256HkdfSha256
impl Copy for P256HkdfSha256
Source§impl Debug for P256HkdfSha256
impl Debug for P256HkdfSha256
impl Eq for P256HkdfSha256
Source§impl Kem for P256HkdfSha256
impl Kem for P256HkdfSha256
Source§const HPKE_KEM_ID: u16 = 0x0010
const HPKE_KEM_ID: u16 = 0x0010
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
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 = <P256Group as DiffieHellmanGroup>::PUBLIC_KEY_SIZE
const ENCAPPED_KEY_SIZE: usize = <P256Group as DiffieHellmanGroup>::PUBLIC_KEY_SIZE
The size of an encapsulated key.
Source§const PUBLIC_KEY_SIZE: usize = <P256Group as DiffieHellmanGroup>::PUBLIC_KEY_SIZE
const PUBLIC_KEY_SIZE: usize = <P256Group as DiffieHellmanGroup>::PUBLIC_KEY_SIZE
The size of a serialized public key.
Source§const SECRET_KEY_SIZE: usize = <P256Group as DiffieHellmanGroup>::SECRET_KEY_SIZE
const SECRET_KEY_SIZE: usize = <P256Group as DiffieHellmanGroup>::SECRET_KEY_SIZE
The size of a serialized secret key.
Source§type EncappedKey = PublicKey
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>
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
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>
fn public_key_to_bytes( out: &mut [u8], public_key: &Self::PublicKey, ) -> Result<(), HpkeError>
Source§fn public_key_from_bytes(bytes: &[u8]) -> Result<Self::PublicKey, HpkeError>
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 moreSource§fn secret_key_to_bytes(
out: &mut [u8],
secret_key: &Self::SecretKey,
) -> Result<(), HpkeError>
fn secret_key_to_bytes( out: &mut [u8], secret_key: &Self::SecretKey, ) -> Result<(), HpkeError>
Source§fn secret_key_from_bytes(bytes: &[u8]) -> Result<Self::SecretKey, HpkeError>
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 moreSource§fn encapped_key_to_bytes(
out: &mut [u8],
encapped_key: &Self::EncappedKey,
) -> Result<(), HpkeError>
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 moreSource§fn encapped_key_from_bytes(bytes: &[u8]) -> Result<Self::EncappedKey, HpkeError>
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 moreSource§fn encap_with_ephemeral(
ephemeral_secret_key: &Self::SecretKey,
recipient_public_key: &Self::PublicKey,
) -> Result<(Hash, Self::EncappedKey), HpkeError>
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 moreSource§fn decap(
encapped_key: &Self::EncappedKey,
recipient_secret_key: &Self::SecretKey,
) -> Result<Hash, HpkeError>
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 moreSource§const RANDOMNESS_SIZE: usize = Self::SECRET_KEY_SIZE
const RANDOMNESS_SIZE: usize = Self::SECRET_KEY_SIZE
The size of the randomness consumed by
Kem::encap_deterministic. Read moreSource§fn generate_keypair() -> Result<(Self::SecretKey, Self::PublicKey), HpkeError>
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>
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 moreSource§fn encap_deterministic(
recipient_public_key: &Self::PublicKey,
randomness: &[u8],
) -> Result<(Hash, Self::EncappedKey), HpkeError>
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 moreSource§impl PartialEq for P256HkdfSha256
impl PartialEq for P256HkdfSha256
impl StructuralPartialEq for P256HkdfSha256
Auto Trait Implementations§
impl Freeze for P256HkdfSha256
impl RefUnwindSafe for P256HkdfSha256
impl Send for P256HkdfSha256
impl Sync for P256HkdfSha256
impl Unpin for P256HkdfSha256
impl UnsafeUnpin for P256HkdfSha256
impl UnwindSafe for P256HkdfSha256
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