sign

open override fun sign(privateKey: Jwk, payload: ByteArray, options: SignOptions?): ByteArray

Deterministically signs the provided payload using the ECDSA (Elliptic Curve Digital Signature Algorithm) with the curve secp256k1.

This function is designed to generate deterministic signatures, meaning that signing the same payload with the same private key will always produce the same signature.

Return

A byte array representing the signature, generated by concatenating the r and s components of the ECDSA signature.

Parameters

privateKey

The private key used for signing, provided as a Jwk (JSON Web Key).

payload

The byte array containing the data to be signed. Ensure that the payload is prepared appropriately, considering any necessary hashing or formatting relevant to the application's security requirements.

options

Optional parameter to provide additional configuration for the signing process. Currently unused and may be provided as null.

Throws

If the provided key, payload, or options are invalid or inappropriate for the signing process.