Cose

object Cose

COSE support routines.

This package includes support for COSE as specified in RFC 9052.

Properties

Link copied to clipboard
const val COSE_KEY_KID: Long = 2

The COSE Key common parameter for the key id (bstr).

Link copied to clipboard
const val COSE_KEY_KTY: Long = 1

The COSE Key common parameter for the key type (tstr / int).

Link copied to clipboard

The COSE Key type parameter for the EC curve (int / tstr).

Link copied to clipboard

The COSE Key type parameter for the private key (bstr).

Link copied to clipboard

The COSE Key type parameter for the X coordinate (bstr).

Link copied to clipboard

The COSE Key type parameter for the Y coordinate (bstr / bool).

Link copied to clipboard
const val COSE_KEY_TYPE_EC2: Long = 2

The COSE Key Type for EC2.

Link copied to clipboard
const val COSE_KEY_TYPE_OKP: Long = 1

The COSE Key Type for OKP.

Link copied to clipboard
const val COSE_LABEL_ALG: Long = 1

The COSE label for conveying an algorithm.

Link copied to clipboard
const val COSE_LABEL_X5CHAIN: Long = 33

The COSE label for conveying an X.509 certificate chain.

Functions

Link copied to clipboard
fun coseMac0(algorithm: Algorithm, key: ByteArray, message: ByteArray, includeMessageInPayload: Boolean, protectedHeaders: Map<CoseLabel, DataItem>, unprotectedHeaders: Map<CoseLabel, DataItem>): CoseMac0

Creates a COSE_Mac0 message authentication code.

Link copied to clipboard
fun coseSign1Check(publicKey: EcPublicKey, detachedData: ByteArray?, signature: CoseSign1, signatureAlgorithm: Algorithm)

Checks a COSE_Sign1 signature.

Link copied to clipboard
fun coseSign1Sign(key: EcPrivateKey, dataToSign: ByteArray, includeDataInPayload: Boolean, signatureAlgorithm: Algorithm, protectedHeaders: Map<CoseLabel, DataItem>, unprotectedHeaders: Map<CoseLabel, DataItem>): CoseSign1
suspend fun coseSign1Sign(secureArea: SecureArea, alias: String, message: ByteArray, includeMessageInPayload: Boolean, protectedHeaders: Map<CoseLabel, DataItem>, unprotectedHeaders: Map<CoseLabel, DataItem>, keyUnlockData: KeyUnlockData?): CoseSign1

Creates a COSE_Sign1 signature.