verify

fun verify(publicKey: Jwk, signedPayload: ByteArray, signature: ByteArray)

Verifies a signature against a signed payload using a public key.

This function utilizes the relevant verifier, determined by the algorithm and curve used in the Jwk, to ensure the provided signature is valid for the signed payload using the provided public key. The algorithm used can either be specified in the public key Jwk or passed explicitly as a parameter. If it is not found in either, an exception will be thrown.

Note

Algorithm MUST either be present on the Jwk or be provided explicitly

Parameters

publicKey

The Jwk public key to be used for verifying the signature.

signedPayload

The byte array data that was signed.

signature

The signature that will be verified. if not provided in the Jwk. Default is null.

Throws

if neither the Jwk nor the explicit algorithm parameter provides an algorithm.