Skip to main content

DeviceDek

Enum DeviceDek 

Source
pub enum DeviceDek {
    Software(DekKeypair),
    Hardware(P256HybridDek),
}
Expand description

This device’s Device Encryption Key, in whichever of the two compositions the design allows.

Both expose the same two operations — publish a public encapsulation key, decapsulate a ciphertext sealed to it — so every caller is agnostic to where the classical half lives. The two byte formats are length-disjoint — X-Wing’s DekKeypair and the P-256 hybrid’s P256HybridDek publish and accept different lengths — so a ciphertext for one is rejected outright by the other rather than silently recovering a wrong secret.

Variants§

§

Software(DekKeypair)

Software fallback. X-Wing (X25519 + ML-KEM-768), both halves in software. The composition every host can run, including those with no secure element and the TPM-1.2 / no-TPM tail the design excludes from hardware binding by name.

§

Hardware(P256HybridDek)

Hardware-bound. P-256 ECDH inside the secure element + a software-sealed ML-KEM-768 half (P256HybridDek). The private P-256 scalar never leaves hardware, so this variant cannot be reconstructed from the account file alone.

Implementations§

Source§

impl DeviceDek

Source

pub fn public_bytes(&self) -> Vec<u8> ⓘ

The published public encapsulation-key bytes a sender wraps to. pk_M ‖ pk_X (1216 bytes) for the software X-Wing DEK; ek_M ‖ pk_P (1249 bytes) for the hardware P-256 hybrid.

Source

pub fn decapsulate(&self, ciphertext: &[u8]) -> Result<[u8; 32], CryptoError>

Recover the 32-byte shared secret from a ciphertext sealed to public_bytes. For Hardware the classical half of this call happens inside the element, so it can fail on a cancelled biometric or a missing key.

Source

pub fn is_hardware_bound(&self) -> bool

Whether the classical half of this DEK lives in a secure element.

Source

pub fn binding(&self) -> DekBinding

How this DEK is recorded in the AccountFile.

Trait Implementations§

Source§

impl Debug for DeviceDek

Source§

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

Formats the value using the given formatter. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more