Class CapabilityTokenSigningKey
- Namespace
- ReferenceApplication.Web.Governance
- Assembly
- ReferenceApplication.Web.dll
Holds the configured private key that signs capability tokens at issuance.
public sealed class CapabilityTokenSigningKey : IDisposable
- Inheritance
-
CapabilityTokenSigningKey
- Implements
- Inherited Members
Remarks
Issuance signing is a host decision; verification is not. Relying endpoints verify proofs with AsiBackbone's
PublicKeySignatureVerificationService over the public keys in
VerificationKeys, and never with this type. This type only signs.
Signing uses AsiBackbone's configured-key AsiBackbone.Signing.LocalDevelopment.LocalDevelopmentSigningService, which signs RSA-PSS with SHA-256. It records the provider-neutral descriptor AsiBackbone.Signing.ManagedKey.ManagedKeySignatureAlgorithms.RsaPssSha256, the descriptor the public-key verifier trusts for RSA, so every instance trusting the matching public key verifies the tokens this one issues, across restarts. Signing failures throw rather than produce an unsigned token.
This is a sample. The private key lives in process memory, with no custody or hardware protection. A production
deployment signs through a managed key service with AddAsiBackboneManagedKeySigning, or issues tokens from a
separate service, and keeps only the public keys here. The type is registered only after the Production guard in
AddApplicationCapabilityTokens(IServiceCollection, IConfiguration, IHostEnvironment).
Constructors
CapabilityTokenSigningKey(IOptions<CapabilityTokenOptions>, TimeProvider)
Initializes a new instance of the CapabilityTokenSigningKey class.
public CapabilityTokenSigningKey(IOptions<CapabilityTokenOptions> optionsAccessor, TimeProvider timeProvider)
Parameters
optionsAccessorIOptions<CapabilityTokenOptions>The capability token options.
timeProviderTimeProviderThe clock recorded as the signing time.
Exceptions
- InvalidOperationException
No signing key is configured, or it cannot be imported.
Fields
ProviderName
Gets the provider descriptor recorded in token proofs.
public const string ProviderName = "referenceapplication-configured-key"
Field Value
SignatureAlgorithm
Gets the signature algorithm descriptor recorded in token proofs and trusted by the verifier.
public const string SignatureAlgorithm = "RSASSA-PSS-SHA256-MANAGED-KEY"
Field Value
Properties
KeyId
Gets the signing key identifier.
public string KeyId { get; }
Property Value
KeyVersion
Gets the version of the key new tokens are signed with.
public string KeyVersion { get; }
Property Value
Signer
Gets the signing service for new tokens.
public IGovernanceSigningService Signer { get; }
Property Value
- IGovernanceSigningService
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()