SigningAlgorithmsProvider Class
Provides access to the collection of signing algorithms supported by the JWT infrastructure. Projects the set from the live keyed ISignatureAlgorithm<TJsonWebKey> registrations, so discovery always reflects exactly the signers the host currently has registered - including algorithms the host added or replaced - with no registration-time bookkeeping to keep in sync.
public sealed class SigningAlgorithmsProviderInheritance System.Object → SigningAlgorithmsProvider
Remarks
The enumerated key types mirror the dispatch by key type that signing and verification make: a signer registered for any other JsonWebKey subtype is unreachable at run time, so it is deliberately not advertised. The enumeration order (none, RSA, EC, octet) is the order these algorithms appear in the discovery document, which consumers read verbatim.
Constructors
SigningAlgorithmsProvider(IServiceProvider) Constructor
Provides access to the collection of signing algorithms supported by the JWT infrastructure. Projects the set from the live keyed ISignatureAlgorithm<TJsonWebKey> registrations, so discovery always reflects exactly the signers the host currently has registered - including algorithms the host added or replaced - with no registration-time bookkeeping to keep in sync.
public SigningAlgorithmsProvider(System.IServiceProvider serviceProvider);Parameters
serviceProvider System.IServiceProvider
Remarks
The enumerated key types mirror the dispatch by key type that signing and verification make: a signer registered for any other JsonWebKey subtype is unreachable at run time, so it is deliberately not advertised. The enumeration order (none, RSA, EC, octet) is the order these algorithms appear in the discovery document, which consumers read verbatim.
Properties
SigningAlgorithmsProvider.Algorithms Property
Gets the collection of signing algorithms supported for JWT creation and validation. Returns algorithm identifiers self-declared by the registered signers (e.g. "RS256", "ES384").
public System.Collections.Generic.IEnumerable<string> Algorithms { get; }Property Value
System.Collections.Generic.IEnumerable<System.String>
Methods
SigningAlgorithmsProvider.CanSign(JsonWebKey, string) Method
Whether key may sign a JWS with algorithm: it declares that algorithm or none, an algorithm of that name is registered for the key's type, and that algorithm accepts the key's material. The registry answering this is the one Algorithms lists and signing and verification dispatch to, so an algorithm is advertised, matched to its keys and carried out by one and the same registration.
public bool CanSign(Abblix.Jwt.JsonWebKey key, string algorithm);Parameters
key JsonWebKey
The key asked about.
algorithm System.String
The JWS alg it would be used with.
Returns
Remarks
RFC 8725 section 3.1: "each key MUST be used with exactly one algorithm, and this MUST be checked when the
cryptographic operation is performed", so a key declaring another algorithm is refused; RFC 7517 section 4.4
makes alg optional, and a key imported from a certificate never carries one, so a key declaring none is
judged by its material. A JWE key management algorithm is asked of
CanEncrypt(JsonWebKey, string), and None is carried out
with no key, so no key signs with it.
SigningAlgorithmsProvider.FirstSignedWith(JsonWebKey, IEnumerable<string>) Method
The first of algorithmskey signs with, by CanSign(JsonWebKey, string), or null where it signs with none: the one it declares, or, for a key declaring none, as one taken from a certificate, the first its material performs.
public string? FirstSignedWith(Abblix.Jwt.JsonWebKey key, System.Collections.Generic.IEnumerable<string> algorithms);Parameters
key JsonWebKey
The key asked about.
algorithms System.Collections.Generic.IEnumerable<System.String>
The JWS algorithms acceptable to the caller, in its order of preference.