#[repr(u16)]pub enum Kem {
P256HkdfSha256 = 16,
X25519HkdfSha256 = 32,
XWing = 25_722,
MlKem768 = 65,
MlKem1024 = 66,
}Expand description
Supported KEM algorithms with values detailed in RFC 9180.
Variants§
P256HkdfSha256 = 16
KEM using DHKEM P-256 and HKDF-SHA256.
X25519HkdfSha256 = 32
KEM using DHKEM X25519 and HKDF-SHA256.
XWing = 25_722
X-Wing hybrid KEM.
MlKem768 = 65
ML-KEM-768.
MlKem1024 = 66
ML-KEM-1024.
Implementations§
Source§impl Kem
impl Kem
Sourcepub fn generate_keypair(&self) -> (Vec<u8>, Vec<u8>)
pub fn generate_keypair(&self) -> (Vec<u8>, Vec<u8>)
Generate a public and private key for this KEM.
Sourcepub fn public_from_private(&self, priv_key: &[u8]) -> Option<Vec<u8>>
pub fn public_from_private(&self, priv_key: &[u8]) -> Option<Vec<u8>>
Get a private key’s corresponding public key, or None if the private
key is invalid.
Sourcepub fn parse_from_private_key(&self, priv_key: &[u8]) -> Option<HpkeKey>
pub fn parse_from_private_key(&self, priv_key: &[u8]) -> Option<HpkeKey>
Parse a private key in accordance to the given KEM scheme.
The call returns None if priv_key is invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Kem
impl RefUnwindSafe for Kem
impl Send for Kem
impl Sync for Kem
impl Unpin for Kem
impl UnsafeUnpin for Kem
impl UnwindSafe for Kem
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