Class BackupShare
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Represents a single share of a master key split using Shamir's Secret Sharing.
public sealed record BackupShare : IEquatable<BackupShare>
- Inheritance
-
BackupShare
- Implements
- Inherited Members
Remarks
Each share is distributed to a different custodian. A threshold number of shares must be combined to reconstruct the original master key.
Individual shares reveal no information about the original key. Only when the threshold number of shares are combined can the key be recovered.
Properties
CreatedAt
Gets the timestamp when this share was created.
public required DateTimeOffset CreatedAt { get; init; }
Property Value
CustodianId
Gets the optional custodian identifier who holds this share.
public string? CustodianId { get; init; }
Property Value
Remarks
This is typically a human-readable identifier for tracking purposes. It does not affect the cryptographic operations.
ExpiresAt
Gets the timestamp when this share expires.
public DateTimeOffset? ExpiresAt { get; init; }
Property Value
FormatVersion
Gets the format version of this share structure.
public int FormatVersion { get; init; }
Property Value
IsExpired
Gets a value indicating whether this share has expired.
public bool IsExpired { get; }
Property Value
KeyHash
Gets a hash of the original key for verification after reconstruction.
public required string KeyHash { get; init; }
Property Value
Remarks
This allows verification that reconstruction succeeded without comparing to the original key material.
KeyId
Gets the identifier of the master key this share belongs to.
public required string KeyId { get; init; }
Property Value
KeyVersion
Gets the version of the key this share belongs to.
public required int KeyVersion { get; init; }
Property Value
ShareData
Gets the share data (the actual secret sharing polynomial evaluation).
public required byte[] ShareData { get; init; }
Property Value
- byte[]
Remarks
This contains the encrypted share data. The first byte is the share index, followed by the share polynomial evaluation for each byte of the secret.
ShareId
Gets the unique identifier for this share.
public required string ShareId { get; init; }
Property Value
ShareIndex
Gets the 1-based index of this share in the set.
public required int ShareIndex { get; init; }
Property Value
Remarks
This index is used by Shamir's Secret Sharing algorithm for reconstruction. Each share in a set must have a unique index.
Threshold
Gets the minimum number of shares required for reconstruction.
public required int Threshold { get; init; }
Property Value
TotalShares
Gets the total number of shares that were generated.
public required int TotalShares { get; init; }
Property Value
Methods
Combine(IEnumerable<BackupShare>)
Combines multiple shares into a single combined share for reconstruction.
public static BackupShare Combine(IEnumerable<BackupShare> shares)
Parameters
sharesIEnumerable<BackupShare>The shares to combine.
Returns
- BackupShare
A combined share that can be used for reconstruction.
Exceptions
- ArgumentException
Thrown when shares are from different keys or have different thresholds.