Table of Contents

Class KeyRotationResult

Namespace
Excalibur.Compliance
Assembly
Excalibur.Compliance.Abstractions.dll

Represents the result of a key rotation operation.

public sealed record KeyRotationResult : IEquatable<KeyRotationResult>
Inheritance
KeyRotationResult
Implements
Inherited Members

Remarks

Key rotation creates a new key version while keeping the previous version available for decryption of existing data.

Properties

ErrorMessage

Gets an error message if the rotation failed. Null if successful.

public string? ErrorMessage { get; init; }

Property Value

string

NewKey

Gets the metadata for the newly created key. Null if rotation failed.

public KeyMetadata? NewKey { get; init; }

Property Value

KeyMetadata

PreviousKey

Gets the metadata for the previous (now decrypt-only) key. Null if there was no previous key.

public KeyMetadata? PreviousKey { get; init; }

Property Value

KeyMetadata

RotatedAt

Gets the timestamp when the rotation was performed.

public DateTimeOffset RotatedAt { get; init; }

Property Value

DateTimeOffset

Success

Gets a value indicating whether the rotation was successful.

public required bool Success { get; init; }

Property Value

bool

Methods

Failed(string)

Creates a failed rotation result.

public static KeyRotationResult Failed(string errorMessage)

Parameters

errorMessage string

The error message describing the failure.

Returns

KeyRotationResult

A failed rotation result.

Succeeded(KeyMetadata, KeyMetadata?)

Creates a successful rotation result.

public static KeyRotationResult Succeeded(KeyMetadata newKey, KeyMetadata? previousKey = null)

Parameters

newKey KeyMetadata

The newly created key metadata.

previousKey KeyMetadata

The previous key metadata (now decrypt-only).

Returns

KeyRotationResult

A successful rotation result.