pub struct P256HybridDek { /* private fields */ }Expand description
A device encryption keypair whose classical half is a hardware-held P-256 key and whose
ML-KEM-768 half is software-sealed. The KEM analogue of
P256HybridSigningKey, and the hardware-bound counterpart
of the software X-Wing DekKeypair.
Implementations§
Source§impl P256HybridDek
impl P256HybridDek
Sourcepub fn enroll(
hardware: Arc<dyn HardwareKeyAgreement>,
key_alias: String,
ml_seed: &[u8; 32],
) -> Result<Self, HardwareSignerError>
pub fn enroll( hardware: Arc<dyn HardwareKeyAgreement>, key_alias: String, ml_seed: &[u8; 32], ) -> Result<Self, HardwareSignerError>
Enroll a P-256 key-agreement key under key_alias in hardware and compose it with the
software ML-KEM-768 half derived from ml_seed (the software-sealed 32-byte seed). Reads
the element’s static P-256 public key and builds the published hybrid public key from it
plus the ML-KEM-768 encapsulation key.
Sourcepub fn key_alias(&self) -> &str
pub fn key_alias(&self) -> &str
The element alias this DEK’s classical half is enrolled under. Persisted (in the clear —
it is a lookup handle, not a secret) in the AccountFile
so a reopened workspace can re-bind to the same hardware key.
Sourcepub fn to_ml_seed_bytes(&self) -> [u8; 32]
pub fn to_ml_seed_bytes(&self) -> [u8; 32]
The 32-byte software seed of the ML-KEM-768 half — the value the keystore seals under the
master key, mirroring DekKeypair::to_seed_bytes.
The classical half is not covered: it is hardware-held and non-exportable by contract,
which is exactly why a hardware-bound device cannot be restored from a backup.
Sourcepub fn public_bytes(&self) -> Vec<u8> ⓘ
pub fn public_bytes(&self) -> Vec<u8> ⓘ
The published hybrid public-encapsulation-key bytes ek_M ‖ pk_P (for the device directory).
Sourcepub fn decapsulate(&self, ciphertext: &[u8]) -> Result<[u8; 32], CryptoError>
pub fn decapsulate(&self, ciphertext: &[u8]) -> Result<[u8; 32], CryptoError>
Decapsulate a P-256-hybrid ciphertext ct_M ‖ ct_P, recovering the 32-byte shared secret
(receiver side). The ML-KEM half is decapsulated in software; the P-256 half is ECDH’d
inside the hardware element against the sender’s ephemeral public key ct_P. A
wrong-length ciphertext is rejected; a foreign ML-KEM ciphertext recovers a different
pseudo-random secret (ML-KEM implicit rejection), never an error.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for P256HybridDek
impl !UnwindSafe for P256HybridDek
impl Freeze for P256HybridDek
impl Send for P256HybridDek
impl Sync for P256HybridDek
impl Unpin for P256HybridDek
impl UnsafeUnpin for P256HybridDek
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
§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