Skip to main content

SubjectDescriptor

Struct SubjectDescriptor 

Source
pub struct SubjectDescriptor {
    pub is_commissioning: bool,
    pub auth_mode: Option<AuthMode>,
    pub subjects: Vec<NodeId, 4>,
    pub fabric_index: FabricIndex,
}
Expand description

What an incoming message authenticated as — §6.6.6.1.3’s Incoming Subject Descriptor.

Derived once per message from the session it arrived on (§6.6.6.3), never from the message’s own claims: a source node id in a header is whatever the sender wrote, while the id in a session context is what CASE proved.

Fields§

§is_commissioning: bool

Whether commissioning is under way on this session.

The one thing that turns a PASE session into an administrator, and only for as long as it is true.

§auth_mode: Option<AuthMode>

How the action authenticated, or None for §6.6.6.3’s AuthModeEnum::None.

None is the “do nothing on error” outcome: a message whose session could not be identified gets a descriptor that matches no entry, so it is granted nothing rather than being treated as some default. Modelling it as Option rather than as a fourth AuthMode keeps it out of Entry entirely — an entry that authenticated nobody is not a thing the table can hold.

§subjects: Vec<NodeId, 4>

The subjects it presents: a CASE node’s operational id plus any CATs its certificate carried, a group id for a group message, or the passcode id for PASE.

Four, because §6.5.6 allows a NOC to carry at most three CATs alongside its node id.

§fabric_index: FabricIndex

Which fabric, or 0 for a PASE session that has none yet.

Implementations§

Source§

impl SubjectDescriptor

Source

pub fn unauthenticated() -> Self

§6.6.6.3’s starting value: authenticated as nobody, granted nothing.

The result for a message whose session cannot be identified — “Do nothing on error, ISD remains unchanged”.

Source

pub fn pase(fabric_index: FabricIndex) -> Self

The descriptor for a PASE session (§6.6.6.3).

IsCommissioning is true for any PASE session: the specification sets it in the PASE branch unconditionally, because a passcode-authenticated session exists only to commission. The fabric “may be zero” — it is, until AddNOC.

Source

pub fn commissioning() -> Self

The descriptor for a commissioner on the PASE channel before it has a fabric.

Source

pub fn case(fabric_index: FabricIndex, node_id: NodeId) -> Self

The descriptor for a CASE session with a node id and no CATs.

Source

pub fn group(fabric_index: FabricIndex, group_id: GroupId) -> Self

The descriptor for a group message (§6.6.6.3).

The caller must already have checked that the group and key are mapped — the spec sets the auth mode only “if group_key_management_cluster.group_key_map_has_mapping(group_id, group_key_id)”, and a message that failed that check is SubjectDescriptor::unauthenticated.

Source

pub fn with_cat(self, cat: CaseAuthenticatedTag) -> Result<Self>

Adds a CAT the peer’s operational certificate carried (§6.6.2.1.2).

Source

pub fn from_session( session: &SecureSession, pending_fabric: Option<FabricIndex>, ) -> Self

Available on crate feature rustcrypto only.

§6.6.6.3’s derivation, for a unicast session.

Each incoming message has a unique <AuthMode, SubjectDescriptor> applicable to it, whose derivation is deterministic based on both incoming message fields and session metadata fields.

Session metadata, never the message’s own claims — a source node id in a header is whatever the sender wrote, while the id in a session context is what CASE proved. That is the whole reason this takes a SecureSession rather than a header.

pending_fabric is the fabric index AddNOC has created but the fail-safe has not yet committed, if any: §6.6.6.3 marks a CASE session on it as commissioning, which is how a commissioner that has switched from PASE to CASE mid-flow keeps its standing.

Group messages do not arrive on a unicast session and are built with SubjectDescriptor::group instead, after the Group Key Management check the specification requires.

Trait Implementations§

Source§

impl Clone for SubjectDescriptor

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 SubjectDescriptor

Source§

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

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

impl Eq for SubjectDescriptor

Source§

impl PartialEq for SubjectDescriptor

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 SubjectDescriptor

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.