Interface IAuditSigningKeyProvider
- Namespace
- Excalibur.AuditLogging
- Assembly
- Excalibur.AuditLogging.Abstractions.dll
Supplies the secret keys used to compute and verify the keyed-MAC integrity tag on audit records.
public interface IAuditSigningKeyProvider
Remarks
The signing key MUST be held separately from the audit store (e.g. in a secret manager / KMS or supplied via configuration) — it is never derivable from, or stored alongside, the audit records it protects. Each record embeds the identifier of the key that produced its tag so that keys can be rotated while older records remain verifiable.
Key identifiers MUST be drawn from a colon-free character set (for example alphanumeric, -,
or a GUID) because the integrity tag is stored as a colon-delimited, self-describing token.
Methods
GetCurrentSigningKeyAsync(CancellationToken)
Gets the current signing key (and its identifier) used to produce integrity tags for newly written audit records.
ValueTask<(string KeyId, byte[] Key)> GetCurrentSigningKeyAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
Remarks
Implementations SHALL fail (throw) when no signing key is available rather than returning an empty or fabricated key — a record cannot be integrity-protected without a real key.
GetSigningKeyAsync(string, CancellationToken)
Gets the secret key for the supplied keyId so a stored integrity tag can be
verified, returning null when the key is unknown or unavailable.
ValueTask<byte[]?> GetSigningKeyAsync(string keyId, CancellationToken cancellationToken)
Parameters
keyIdstringThe identifier embedded in the record's integrity tag.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
Remarks
A null result causes verification to fail closed (the record is treated as unverifiable, never as valid).