Skip to main content

CaseOutcome

Struct CaseOutcome 

Source
pub struct CaseOutcome {
    pub keys: EstablishedKeys,
    pub peer: VerifiedIdentity,
    pub peer_session_id: SessionId,
    pub peer_session_params: Option<SessionParams>,
    pub resumption: ResumptionState,
}
Available on crate feature rustcrypto only.
Expand description

Everything a completed CASE hands back.

Fields§

§keys: EstablishedKeys

The three session keys.

§peer: VerifiedIdentity

The peer’s authenticated operational identity.

§peer_session_id: SessionId

The session id the peer will listen on — what this node puts in outgoing messages.

§peer_session_params: Option<SessionParams>

The MRP parameters the peer announced, if it announced any.

§resumption: ResumptionState

State for a later resumption, which the caller may keep or drop.

Implementations§

Source§

impl CaseOutcome

Source

pub fn into_session( &self, local_session_id: SessionId, fabric: &Fabric, randomness: u32, now: Instant, ) -> SecureSession

Builds the operational session this handshake produced.

Every identity a CASE session needs comes from exactly two places — this outcome and the fabric the handshake ran on — so taking both is the only way to be sure none is left at its default. Assembling a SecureSession field by field is still possible and is still wrong more often than it is right.

The field that makes this more than convenience is local_node_id. §4.9.2 builds the AEAD nonce from “the Security Flags, the Message Counter, and the Source Node ID of that message”, and for a CASE session the source node id is the sender’s operational node id — which never appears in the header, because both ends are supposed to know it from the session. A session left at NodeId::UNSPECIFIED therefore encrypts every message with a nonce the peer will not reconstruct, and the peer discards them as unauthenticated. Nothing fails locally: this node sends, MRP retransmits into silence, and the exchange is abandoned with no error at either end that names the cause.

randomness seeds the outgoing message counter (§4.6.2, which randomises it “on session establishment”) and now timestamps the session, exactly as SecureSession::new takes them.

Source

pub fn into_initiator_session( &self, local_session_id: SessionId, fabric: &Fabric, randomness: u32, now: Instant, ) -> SecureSession

The same, for the node that initiated the handshake.

The only difference is the role, and the role decides which of the two directional keys this node encrypts with (§4.14.1) — so getting it wrong is the same silent failure as getting local_node_id wrong.

Trait Implementations§

Source§

impl Debug for CaseOutcome

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