Skip to content

ISignatureAlgorithm<TJsonWebKey> Interface

Defines the contract for signing and verifying JWT tokens using a specific cryptographic algorithm.

C#
public interface ISignatureAlgorithm<in TJsonWebKey>
    where TJsonWebKey : Abblix.Jwt.JsonWebKey

Type parameters

TJsonWebKey

Properties

ISignatureAlgorithm<TJsonWebKey>.Algorithm Property

The JWS signing algorithm identifier this signer implements (e.g. "RS256", "ES384"). Must equal the DI key the signer is registered under: discovery enumerates the keyed registrations and projects this value into the *_signing_alg_values_supported lists, so a mismatch would advertise an algorithm name the dispatch cannot resolve.

C#
string Algorithm { get; }

Property Value

System.String

Methods

ISignatureAlgorithm<TJsonWebKey>.Sign(TJsonWebKey, byte[]) Method

Signs the provided data using the configured algorithm and specified key.

C#
byte[] Sign(TJsonWebKey key, byte[] data);

Parameters

key TJsonWebKey

The key to use for signing.

data System.Byte[]

The data to sign (typically the JWT header.payload part).

Returns

System.Byte[]
The signature bytes.

ISignatureAlgorithm<TJsonWebKey>.Verify(TJsonWebKey, byte[], byte[]) Method

Verifies the signature of the provided data using the configured algorithm and specified key.

C#
bool Verify(TJsonWebKey key, byte[] data, byte[] signature);

Parameters

key TJsonWebKey

The key to use for verification.

data System.Byte[]

The data that was signed (typically the JWT header.payload part).

signature System.Byte[]

The signature to verify.

Returns

System.Boolean
True if the signature is valid; otherwise, false.