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: boolWhether 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: FabricIndexWhich fabric, or 0 for a PASE session that has none yet.
Implementations§
Source§impl SubjectDescriptor
impl SubjectDescriptor
Sourcepub fn unauthenticated() -> Self
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”.
Sourcepub fn pase(fabric_index: FabricIndex) -> Self
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.
Sourcepub fn commissioning() -> Self
pub fn commissioning() -> Self
The descriptor for a commissioner on the PASE channel before it has a fabric.
Sourcepub fn case(fabric_index: FabricIndex, node_id: NodeId) -> Self
pub fn case(fabric_index: FabricIndex, node_id: NodeId) -> Self
The descriptor for a CASE session with a node id and no CATs.
Sourcepub fn group(fabric_index: FabricIndex, group_id: GroupId) -> Self
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.
Sourcepub fn with_cat(self, cat: CaseAuthenticatedTag) -> Result<Self>
pub fn with_cat(self, cat: CaseAuthenticatedTag) -> Result<Self>
Adds a CAT the peer’s operational certificate carried (§6.6.2.1.2).
Sourcepub fn from_session(
session: &SecureSession,
pending_fabric: Option<FabricIndex>,
) -> Self
Available on crate feature rustcrypto only.
pub fn from_session( session: &SecureSession, pending_fabric: Option<FabricIndex>, ) -> Self
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.