Skip to main content

EstablishedKeys

Struct EstablishedKeys 

Source
pub struct EstablishedKeys {
    pub i2r: SessionKeys,
    pub r2i: SessionKeys,
    pub attestation_challenge: SymmetricKey,
}
Available on crate feature rustcrypto only.
Expand description

The three keys session establishment derives (§4.14.1, §4.14.2.7).

I2RKey || R2IKey || AttestationChallenge, in one KDF call.

Fields§

§i2r: SessionKeys

Initiator to responder.

§r2i: SessionKeys

Responder to initiator.

§attestation_challenge: SymmetricKey

“SHALL only be used as a challenge during device attestation” (§6.2.3) — never as an encryption key, which is why it is a distinct field and not a third SessionKeys.

Implementations§

Source§

impl EstablishedKeys

Source

pub const fn sending(&self, role: Role) -> &SessionKeys

The keys this node encrypts with, given which end of establishment it was.

§4.14.2.7 names the two directions I2RKey and R2IKey, and which one a node uses depends entirely on its role. Swapping them does not fail loudly — it produces a message the peer cannot authenticate, which looks like a corrupt link rather than a key mix-up. Naming the two directions is what keeps the question from being asked at every call site.

Source

pub const fn receiving(&self, role: Role) -> &SessionKeys

The keys this node decrypts with — the other direction from Self::sending.

Source

pub fn derive(shared_secret: &[u8], salt: &[u8]) -> Result<Self>

Derives all three from a shared secret and a salt, under "SessionKeys".

PASE passes an empty salt and Ke; CASE passes IPK || TranscriptHash and the ECDH shared secret. Both call the same KDF with the same info string, which is why this is one function rather than two that could drift apart.

Source

pub fn derive_with_info( shared_secret: &[u8], salt: &[u8], info: &[u8], ) -> Result<Self>

The same derivation under a different Info.

CASE resumption uses "SessionResumptionKeys" (§4.14.2.6.7) — the same three keys, the same split, a different label, so that a resumed session’s keys can never collide with a fresh one’s even if a secret and salt were somehow repeated.

Trait Implementations§

Source§

impl Clone for EstablishedKeys

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EstablishedKeys

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for EstablishedKeys

Source§

impl PartialEq for EstablishedKeys

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EstablishedKeys

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.