pub struct DekPublic(pub Vec<u8>);Expand description
A device’s published DEK public encapsulation key: the bytes a peer wraps a key to so that only that device can open it (SSoT: Cryptography — Keys § Device Keys).
§One field, both compositions, discriminated by length
Capsule ships two DEK compositions and this single field carries either:
- the software X-Wing DEK,
pk_M ‖ pk_X—DEK_PUBLIC_LEN(1216) bytes; - the hardware-bound P-256 hybrid DEK,
ek_M ‖ pk_P—DEK_P256_PUBLIC_LEN(1249).
They are length-disjoint by construction (see P256HybridDek), so the
composition is recovered from the bytes themselves and needs no tag — the same way a
HybridVerifyingKey recovers its Ed25519-vs-P-256 classical half from the wire length, and
the same way DeviceDek::public_bytes already
hands both compositions to callers as one opaque Vec<u8>. An explicit tag would be a second
signature-covered source of truth that can disagree with the key bytes it labels; the length
cannot, and a mismatched length is refused outright by DekPublic::encapsulate.
Serializes as a CBOR byte string (major type 2) — never an array of integers — so canonical encodings are byte-identical across implementations.
Tuple Fields§
§0: Vec<u8>Implementations§
Source§impl DekPublic
impl DekPublic
Sourcepub fn encapsulate(&self) -> Result<(Vec<u8>, [u8; 32]), CryptoError>
pub fn encapsulate(&self) -> Result<(Vec<u8>, [u8; 32]), CryptoError>
Encapsulate a fresh shared secret to this published key, returning the KEM ciphertext and the 32-byte sender-side secret. The composition is selected by length; a key of any other length is refused rather than guessed at.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DekPublic
impl<'de> Deserialize<'de> for DekPublic
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for DekPublic
impl StructuralPartialEq for DekPublic
Auto Trait Implementations§
impl Freeze for DekPublic
impl RefUnwindSafe for DekPublic
impl Send for DekPublic
impl Sync for DekPublic
impl Unpin for DekPublic
impl UnsafeUnpin for DekPublic
impl UnwindSafe for DekPublic
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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