Interface IKeyManagementAdmin
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Provides administrative key management operations including listing, deletion, and suspension.
public interface IKeyManagementAdmin
Remarks
This interface separates administrative operations from core key management (IKeyManagementProvider) following the Interface Segregation Principle. Consumers that only need to retrieve or rotate keys should depend on IKeyManagementProvider instead.
Administrative operations include: - Key inventory and listing - Key deletion (crypto-shredding for GDPR compliance) - Key suspension for security incidents
Methods
DeleteKeyAsync(string, int, CancellationToken)
Destroys a key, or schedules it for irreversible destruction, and reports which of the two occurred.
Task<KeyDestructionOutcome> DeleteKeyAsync(string keyId, int retentionDays, CancellationToken cancellationToken)
Parameters
keyIdstringThe unique identifier of the key to delete.
retentionDaysintThe requested number of days to retain the key before irreversible destruction. A value of
0requests immediate destruction. Implementations MUST NOT silently substitute a longer window: where a backend imposes a mandatory minimum retention, the effective irreversibility instant MUST be surfaced through the returned IrreversibleAt rather than clamped in silence.cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<KeyDestructionOutcome>
A KeyDestructionOutcome whose State distinguishes a key that is irrecoverable on return (Completed) from one merely scheduled and still recoverable until IrreversibleAt (ScheduledIrreversible), or a key that did not exist (NotFound, an idempotent no-op).
Remarks
For GDPR Right to Erasure, crypto-shredding is achieved by destroying the encryption key, rendering all data encrypted with that key unrecoverable. Callers issuing a completion attestation MUST treat only Completed as irrecoverable-now: a ScheduledIrreversible key remains recoverable until its window elapses and MUST NOT be attested as erased. On failure of the underlying destruction primitive, implementations MUST fail closed (surface the failure), never report a false success.
ListKeysAsync(KeyStatus?, string?, CancellationToken)
Lists all keys matching the specified filter criteria.
Task<IReadOnlyList<KeyMetadata>> ListKeysAsync(KeyStatus? status, string? purpose, CancellationToken cancellationToken)
Parameters
statusKeyStatus?Optional filter by key status. Null returns all statuses.
purposestringOptional filter by key purpose. Null returns all purposes.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<IReadOnlyList<KeyMetadata>>
A list of key metadata matching the criteria.
ReactivateKeyAsync(string, CancellationToken)
Reactivates a previously suspended key, restoring its use for cryptographic operations.
Task<bool> ReactivateKeyAsync(string keyId, CancellationToken cancellationToken)
Parameters
keyIdstringThe unique identifier of the key to reactivate.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
Remarks
This is the inverse of SuspendKeyAsync(string, string, CancellationToken). A key that is not suspended is returned to (or left in) the active state.
SuspendKeyAsync(string, string, CancellationToken)
Suspends a key, preventing its use for any cryptographic operations.
Task<bool> SuspendKeyAsync(string keyId, string reason, CancellationToken cancellationToken)
Parameters
keyIdstringThe unique identifier of the key to suspend.
reasonstringThe reason for suspension (for audit purposes).
cancellationTokenCancellationTokenA token to cancel the operation.