Package-level declarations

Types

Link copied to clipboard
fun interface ClientContextResolver

Chooses the security context for an outgoing request. Null means no context: OscoreClient then fails the request with MessageSecurityException unless it was built with allowUnprotected, when null sends the request in plaintext (ADR 0008).

Link copied to clipboard

Keeps Sender Sequence Numbers in memory for the life of the process: the SequenceNumberStore for keys that are new in this process run and are never used after it ends, such as EDHOC output (RFC 9528 Appendix A.1), and for tests.

Link copied to clipboard

When a context must see a freshness proof before it trusts its replay window (RFC 8613 Appendix B.1.2).

Link copied to clipboard

A MutableSecurityContextRepository in memory, keyed by Recipient ID and ID Context. It keeps every context until it is removed, without a bound: right for provisioned contexts and tests, while a server that runs EDHOC for many clients supplies a bounded repository instead (MutableSecurityContextRepository).

Link copied to clipboard

A SecurityContextRepository that contexts are added to and removed from while the server runs: where kcoap-edhoc-oscore's EdhocServer puts the context of every EDHOC session it completes (RFC 9528 Appendix A.1), and where an application keeps the contexts it provisions or retires. InMemoryContextRepository is the implementation kcoap ships.

Link copied to clipboard
class OscoreClient(contexts: ClientContextResolver, loggerFactory: LoggerFactory = LoggerFactory.Global, allowUnprotected: Boolean = false) : ClientMessageSecurity

The OSCORE client side for the CoAP stack: protects requests with the context contexts picks and verifies the responses, including Observe notifications with their replay protection (RFC 8613 §4.1.3.5.2, §7.4.1).

Link copied to clipboard

Why an OSCORE message was rejected, with the error response RFC 8613 §8.2 and §7.4 suggest for a server. The diagnostic strings are the ones the RFC proposes.

Link copied to clipboard
class OscoreException(val error: OscoreError, detail: String? = null, cause: Throwable? = null) : KcoapException

Raised by OSCORE processing, a KcoapException with the error RFC 8613 §8.2 and §7.4 name; reading an OSCORE option (OscoreOptionValue.decode) throws it too. OscoreClient and OscoreServer convert it to the stack's MessageSecurityException (toMessageSecurityException) at the message-security SPI.

Link copied to clipboard
class OscoreIdentity(recipientId: ByteArray, idContext: ByteArray?) : SecurityIdentity

The peer behind an OSCORE request: its Sender ID (our Recipient ID) and the ID Context. The default SecurityContext.identity; a context EDHOC established carries kcoap-edhoc-oscore's EdhocIdentity, which holds this one and the peer's credential.

Link copied to clipboard
class OscoreOptionValue(partialIv: ByteArray? = null, kid: ByteArray? = null, kidContext: ByteArray? = null)

The value of the OSCORE option: the compressed COSE header (RFC 8613 §6.1).

Link copied to clipboard
class OscoreServer(contexts: SecurityContextRepository, loggerFactory: LoggerFactory = LoggerFactory.Global) : ServerMessageSecurity

The OSCORE server side for the CoAP stack: verifies requests carrying the OSCORE option against the contexts in contexts and protects the responses. Each verified request carries its context's SecurityContext.identity. Requests without the option are left to the stack (null). On a server with message security its default access policy refuses them, so only the resources the application makes AccessPolicy.Public (kcoap-coap's server) serve them (ADR 0008).

Link copied to clipboard

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

Link copied to clipboard
class SecurityContextParameters(masterSecret: ByteArray, senderId: ByteArray, recipientId: ByteArray, masterSalt: ByteArray = ByteArray(0), idContext: ByteArray? = null, val aeadAlgorithm: AeadAlgorithm = AeadAlgorithm.AES_CCM_16_64_128, val hkdfAlgorithm: HashAlgorithm = HashAlgorithm.SHA_256, val includeIdContext: Boolean = false, val replayWindowSize: Int = 32)

The input parameters of an OSCORE security context (RFC 8613 §3.2), as agreed out of band or derived by EDHOC. SecurityContext.derive turns them into keys.

Link copied to clipboard

Finds the Recipient Context for an incoming request by its 'kid' and optional 'kid context' (RFC 8613 §8.2 step 2). Implementations may derive a context on demand, as Appendix B.2 and EDHOC do.

Link copied to clipboard

Persists Sender Sequence Numbers across restarts (RFC 8613 Appendix B.1.1), so a restarted endpoint never reuses an AEAD nonce under the same Sender Key.