oscoreParameters

suspend fun EdhocSession.oscoreParameters(keyLength: Int = cipherSuite.appAead.keyLength, saltLength: Int = DEFAULT_SALT_LENGTH): SecurityContextParameters(source)

The OSCORE security context parameters an EDHOC session establishes (RFC 9528 Appendix A.1):

  • Master Secret = EDHOC_Exporter(0, h'', key length of the application AEAD)

  • Master Salt = EDHOC_Exporter(1, h'', 8)

  • AEAD and HKDF from the application algorithms of the selected cipher suite

  • Sender ID = the peer's connection identifier, Recipient ID = this side's own (Table 14)

The parameters hold copies of the exported Master Secret and Salt; the exporter outputs themselves are wiped, also when the second export fails.

Persisting the parameters to resume the context after a restart is safe only when the context had a durable SequenceNumberStore from its first derivation, that is when it came from oscoreContext(crypto, durableStore), or from an EdhocServer or EdhocClientHandshake given that store as its sequenceStore. After the restart, derive it from the persisted parameters with SecurityContext.derive and that same store, which resumes above every sequence number used before and requires the Echo proof for requests (RFC 8613 Appendix B.1). A context that used the ephemeral store, the default of all three, left no record of its sequence numbers: derived again, it would start at 0 and reuse AEAD nonces (RFC 8613 Appendix B.1.1). Run EDHOC again instead.

Parameters

keyLength

the OSCORE key length, by default that of the application AEAD.

saltLength

the OSCORE Master Salt length, 8 by default.