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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The AEAD algorithm that protects messages (RFC 8613 §3.1).

Link copied to clipboard

The ID Context, or null when none is used (§3.1), a copy.

Link copied to clipboard

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.

Link copied to clipboard

The name the context is persisted and logged under: its identifiers, never a secret.

Link copied to clipboard

The peer's Sender ID, which selects this context for its requests (§3.1), a copy.

Link copied to clipboard

This endpoint's Sender ID (RFC 8613 §3.1), a copy.

Functions

Link copied to clipboard
suspend fun peekSequenceNumber(): Long

The next Sender Sequence Number this context will use.

Link copied to clipboard
open override fun toString(): String