Signer

interface Signer

An interface defining the contract for signing and verifying signatures on payloads.

Signer provides a generic approach to:

  • Creating digital signatures on payloads (sign)

  • Verifying digital signatures (verify)

Implementers of this interface should ensure mechanisms provided for signing and verifying respect the cryptographic standards necessary for secure and valid operations.

Usage Example:

class MySigner : Signer {
override fun sign(privateKey: Jwk , payload: Payload, options: SignOptions?): String {
// Implementation-specific signing logic.
}

override fun verify(publicKey: Jwk , jws: String, options: VerifyOptions?) {
// Implementation-specific verification logic.
}
}

Implementers may utilize SignOptions and VerifyOptions to allow consumers to pass in additional, implementation-specific options to influence the signing and verification processes respectively.

See also

for options during signing.

for options during signature verification.

Inheritors

Functions

Link copied to clipboard
abstract fun sign(privateKey: Jwk, payload: ByteArray, options: SignOptions? = null): ByteArray

Sign a given payload using a private key.

Link copied to clipboard
abstract fun verify(publicKey: Jwk, signedPayload: ByteArray, signature: ByteArray, options: VerifyOptions? = null)

Verify the signature of a given payload using a public key.