pub struct DekKeypair { /* private fields */ }Expand description
A device encryption keypair (X-Wing = X25519 + ML-KEM-768). Holds both private halves; the public encapsulation key is derived on demand.
Implementations§
Source§impl DekKeypair
impl DekKeypair
Sourcepub fn from_seed(seed: &[u8; 32]) -> Self
pub fn from_seed(seed: &[u8; 32]) -> Self
Reconstruct deterministically from the 32-byte X-Wing seed (expandDecapsulationKey).
Sourcepub fn to_seed_bytes(&self) -> [u8; 32]
pub fn to_seed_bytes(&self) -> [u8; 32]
Export the 32-byte X-Wing seed for sealed storage in the keystore.
Sourcepub fn public_bytes(&self) -> Vec<u8> ⓘ
pub fn public_bytes(&self) -> Vec<u8> ⓘ
The X-Wing public encapsulation-key bytes pk_M ‖ pk_X (for the device directory).
Sourcepub fn encapsulate_to_self(&self) -> (Vec<u8>, [u8; 32])
pub fn encapsulate_to_self(&self) -> (Vec<u8>, [u8; 32])
Encapsulate a fresh shared secret to this keypair’s own public key, returning the
X-Wing ciphertext ct_M ‖ ct_X and the 32-byte combined shared secret (sender side).
Sourcepub fn decapsulate(&self, ciphertext: &[u8]) -> Result<[u8; 32], CryptoError>
pub fn decapsulate(&self, ciphertext: &[u8]) -> Result<[u8; 32], CryptoError>
Decapsulate an X-Wing ciphertext ct_M ‖ ct_X, recovering the 32-byte shared secret
(receiver side). A wrong-length ciphertext is rejected; a foreign ciphertext recovers a
different pseudo-random secret (ML-KEM implicit rejection), never an error.
Trait Implementations§
Source§impl Clone for DekKeypair
impl Clone for DekKeypair
Auto Trait Implementations§
impl Freeze for DekKeypair
impl RefUnwindSafe for DekKeypair
impl Send for DekKeypair
impl Sync for DekKeypair
impl Unpin for DekKeypair
impl UnsafeUnpin for DekKeypair
impl UnwindSafe for DekKeypair
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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