Skip to content

IDataSigner Interface

A signing backend that owns a slice of the server's signing keys and produces JWS signature bytes for the keys it owns. Backends compose as peers behind Abblix.Jwt.Signing.CompositeSigner, which asks each in turn whether it owns the key (CanSign(JsonWebKey)) and routes to the first that does: the in-process Abblix.Jwt.Signing.LocalKeySigner owns keys that carry private material, an external custodian backend (Abblix.Jwt.ExternalKeys.ExternalKeySigner) owns the public-only keys whose kid is its handle. This is the byte-level counterpart of the token-level IJsonWebTokenSigner: it works with bytes, not a whole token, so an HSM/KMS/vault integration is one more backend and never touches JWS framing.

C#
public interface IDataSigner

Methods

IDataSigner.CanSign(JsonWebKey) Method

Reports whether this signer owns key and can therefore sign with it. Ownership is a property of the key, not of the algorithm: the in-process backend owns keys that carry private material, an external custodian backend owns the public-only keys whose kid is one of its handles.

C#
bool CanSign(Abblix.Jwt.JsonWebKey key);

Parameters

key JsonWebKey

The signing key the composite is about to route.

Returns

System.Boolean
true if this signer can sign with key; otherwise false.

IDataSigner.SignAsync(JsonWebKey, string, byte[], CancellationToken) Method

Produces the signature bytes for data under algorithm using key, in the JWS wire format for the algorithm.

C#
System.Threading.Tasks.Task<byte[]> SignAsync(Abblix.Jwt.JsonWebKey key, string algorithm, byte[] data, System.Threading.CancellationToken cancellationToken);

Parameters

key JsonWebKey

The signing key. Its kid is the custodian's handle when it is external.

algorithm System.String

The JWS algorithm identifier (e.g. RS256, ES256) the signature must use.

data System.Byte[]

The signing input bytes, BASE64URL(header) + '.' + BASE64URL(payload).

cancellationToken System.Threading.CancellationToken

Cancels the signing operation, including a custodian round-trip.

Returns

System.Threading.Tasks.Task<System.Byte[]>
The raw signature bytes in JWS wire format for the algorithm.