SecurityContext
A derived OSCORE security context (RFC 8613 §3): the Common Context (keys' common inputs and Common IV), the Sender Context (Sender Key and Sequence Number) and the Recipient Context (Recipient Key and Replay Window).
Thread safe: sequence numbers are handed out and the replay window updated under a lock (§7.2, §7.4). The derived Sender and Recipient Keys and the Common IV never leave the object. The input parameters, Master Secret included, stay inside the module for re-deriving the context and are not reachable from here; toString() shows only identifiers.
Use one instance per set of keys and share it. Two live instances derived from the same parameters hand out the same sequence numbers, so their nonces repeat (see derive).
Properties
The AEAD algorithm that protects messages (RFC 8613 §3.1).
Who the peer of this context is, for authorization: the identity of every request this context verifies (UnprotectedRequest.identity, which access policies and handlers see; ADR 0008). By default the OscoreIdentity of the Recipient ID and ID Context. A context that EDHOC established carries kcoap-edhoc-oscore's EdhocIdentity, with the peer's authenticated credential, and a provisioned one may carry a name of the application's (derive's identity). It belongs to this object, not to the Recipient ID: a context that later takes the same Recipient ID, such as one of an EDHOC session that reuses a released C_R, has its own.
The peer's Sender ID, which selects this context for its requests (§3.1), a copy.