Table of Contents

Class MasterKeyBackup

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

Represents an encrypted backup of a master encryption key.

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

Remarks

The backup contains the encrypted key material along with metadata required for restoration. The actual key material is never stored in plaintext.

The backup format includes: - Encrypted key material (wrapped with a backup key or HSM) - Key metadata (algorithm, version, purpose) - Integrity verification (hash/MAC) - Backup timestamp and expiration

Properties

AuthTag

Gets the authentication tag for integrity verification.

public byte[]? AuthTag { get; init; }

Property Value

byte[]

BackupId

Gets the unique identifier for this backup.

public required string BackupId { get; init; }

Property Value

string

CreatedAt

Gets the timestamp when this backup was created.

public required DateTimeOffset CreatedAt { get; init; }

Property Value

DateTimeOffset

EncryptedKeyMaterial

Gets the encrypted key material.

public required byte[] EncryptedKeyMaterial { get; init; }

Property Value

byte[]

Remarks

This is the wrapped/encrypted form of the master key. Never contains plaintext key material.

ExpiresAt

Gets the timestamp when this backup expires and should no longer be used.

public DateTimeOffset? ExpiresAt { get; init; }

Property Value

DateTimeOffset?

FormatVersion

Gets the format version of this backup structure.

public int FormatVersion { get; init; }

Property Value

int

Remarks

Allows for future changes to the backup format while maintaining backward compatibility.

IsExpired

Gets a value indicating whether this backup has expired.

public bool IsExpired { get; }

Property Value

bool

Iv

Gets the initialization vector used for wrapping.

public byte[]? Iv { get; init; }

Property Value

byte[]

KeyAlgorithm

Gets the algorithm of the backed-up master key.

public required EncryptionAlgorithm KeyAlgorithm { get; init; }

Property Value

EncryptionAlgorithm

KeyHash

Gets the SHA-256 hash of the original plaintext key for verification.

public required string KeyHash { get; init; }

Property Value

string

Remarks

Used to verify successful restoration without exposing key material.

KeyId

Gets the identifier of the master key that was backed up.

public required string KeyId { get; init; }

Property Value

string

KeyVersion

Gets the version of the key that was backed up.

public required int KeyVersion { get; init; }

Property Value

int

Metadata

Gets optional metadata associated with the backup.

public IReadOnlyDictionary<string, string>? Metadata { get; init; }

Property Value

IReadOnlyDictionary<string, string>

Purpose

Gets the purpose or scope of the backed-up key.

public string? Purpose { get; init; }

Property Value

string

WrappingAlgorithm

Gets the algorithm used to encrypt the backup.

public required EncryptionAlgorithm WrappingAlgorithm { get; init; }

Property Value

EncryptionAlgorithm

WrappingKeyId

Gets the identifier of the key used to wrap (encrypt) this backup.

public string? WrappingKeyId { get; init; }

Property Value

string

Remarks

This could be an HSM key, a backup encryption key, or another master key.