CoseKey

class CoseKey(val keyType: CoseKeyType, val curve: CoseCurve?, x: ByteArray, y: ByteArray? = null, kid: ByteArray? = null, val algorithm: Int? = null)(source)

A public COSE_Key (RFC 9052 §7). Private parts are never modelled: private keys live in a dev.kcoap.crypto.CryptoBackend.

Map labels: kty 1, kid 2, alg 3, crv -1, x -2, y -3. AKP keys (draft-ietf-cose-dilithium) have no curve and carry their public key as pub under label -1 instead. The order of encode follows the examples in RFC 9529 (kty, kid, crv, x, y), so credentials built from this class match the traces byte for byte.

Constructors

Link copied to clipboard
constructor(keyType: CoseKeyType, curve: CoseCurve?, x: ByteArray, y: ByteArray? = null, kid: ByteArray? = null, algorithm: Int? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

COSE algorithm id, when the key is restricted to one.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

x for EC2 and OKP; the public key pub for AKP.

Link copied to clipboard
val y: ByteArray?

Functions

Link copied to clipboard
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

The public key in the raw encoding dev.kcoap.crypto.CryptoBackend expects.

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