sign

open suspend fun sign(algorithm: SignatureAlgorithm, privateKey: PrivateKey, data: ByteArray): ByteArray(source)

A signature over data with privateKey, whose type must be SignatureAlgorithm.keyType. ECDSA signatures are raw r || s of SignatureAlgorithm.signatureLength bytes, as COSE uses them (RFC 9053 §2.1); EcdsaSignatureCodec converts them to DER for X.509 and DTLS.