Table of Contents

Interface IMasterKeyBackupExporter

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

Produces master key backups for disaster recovery scenarios.

public interface IMasterKeyBackupExporter

Remarks

Handles the secure export of master encryption keys (Key Encryption Keys - KEKs) and the generation of split-knowledge recovery shares via Shamir's Secret Sharing.

WARNING: Master key operations are highly sensitive. All operations MUST be audited and require appropriate authorization (typically multi-party approval).

Methods

ExportMasterKeyAsync(string, MasterKeyExportOptions?, CancellationToken)

Exports a master key for backup purposes.

Task<MasterKeyBackup> ExportMasterKeyAsync(string keyId, MasterKeyExportOptions? options, CancellationToken cancellationToken)

Parameters

keyId string

The unique identifier of the master key to export.

options MasterKeyExportOptions

Options controlling the export operation.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<MasterKeyBackup>

The backup containing the encrypted key material.

Exceptions

ArgumentException

Thrown when keyId is null or empty.

KeyNotFoundException

Thrown when the specified key does not exist.

InvalidOperationException

Thrown when the key cannot be exported (e.g., non-exportable HSM key).

GenerateRecoverySplitAsync(string, int, int, BackupShareOptions?, CancellationToken)

Generates recovery shares for a master key using Shamir's Secret Sharing.

Task<BackupShare[]> GenerateRecoverySplitAsync(string keyId, int totalShares, int threshold, BackupShareOptions? options, CancellationToken cancellationToken)

Parameters

keyId string

The unique identifier of the master key to split.

totalShares int

Total number of shares to generate (custodians).

threshold int

Minimum number of shares required for reconstruction.

options BackupShareOptions

Options controlling the share generation.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<BackupShare[]>

An array of backup shares, one for each custodian.

Remarks

The default configuration is 3-of-5, meaning any 3 custodians can reconstruct the key. Each share should be securely distributed to a different custodian.

Split-knowledge key recovery ensures no single person can access the master key.

Exceptions

ArgumentException

Thrown when keyId is null or empty.

ArgumentOutOfRangeException

Thrown when threshold < 2, totalShares < 2, or threshold > totalShares.

KeyNotFoundException

Thrown when the specified key does not exist.