-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMakeSharesUseCase & IReconstructionUseCase: Initial import
Resolves: No entry
- Loading branch information
1 parent
8e376d1
commit 39a34bb
Showing
12 changed files
with
179 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace SecretSharingDotNet.Cryptography; | ||
|
||
/// <summary> | ||
/// Interface for the Shamir's Secret Sharing algorithm implementation for creating shared secrets. | ||
/// </summary> | ||
/// <typeparam name="TNumber">Numeric data type (An integer type)</typeparam> | ||
public interface IMakeSharesUseCase<TNumber> | ||
{ | ||
/// <summary> | ||
/// Generates a random shamir pool, returns the random secret and the share points. | ||
/// </summary> | ||
/// <param name="numberOfMinimumShares">Minimum number of shared secrets for reconstruction</param> | ||
/// <param name="numberOfShares">Maximum number of shared secrets</param> | ||
/// <param name="securityLevel">Security level (in number of bits). The minimum is 13.</param> | ||
/// <returns>A <see cref="Shares{TNumber}"/> object</returns> | ||
/// <exception cref="T:System.ArgumentOutOfRangeException"> | ||
/// The <paramref name="securityLevel"/> parameter is lower than 13 or greater than 43.112.609. OR The <paramref name="numberOfMinimumShares"/> parameter is lower than 2 or greater than <paramref name="numberOfShares"/>. | ||
/// </exception> | ||
Shares<TNumber> MakeShares(TNumber numberOfMinimumShares, TNumber numberOfShares, int securityLevel); | ||
|
||
/// <summary> | ||
/// Generates a random shamir pool, returns the specified <paramref name="secret"/> and the share points. | ||
/// </summary> | ||
/// <param name="numberOfMinimumShares">Minimum number of shared secrets for reconstruction</param> | ||
/// <param name="numberOfShares">Maximum number of shared secrets</param> | ||
/// <param name="secret">secret text as <see cref="Secret{TNumber}"/> or see cref="string"/></param> | ||
/// <param name="securityLevel">Security level (in number of bits). The minimum is 13.</param> | ||
/// <returns>A <see cref="Shares{TNumber}"/> object</returns> | ||
/// <exception cref="T:System.ArgumentOutOfRangeException"> | ||
/// The <paramref name="securityLevel"/> is lower than 13 or greater than 43.112.609. OR <paramref name="numberOfMinimumShares"/> is lower than 2 or greater than <paramref name="numberOfShares"/>. | ||
/// </exception> | ||
Shares<TNumber> MakeShares(TNumber numberOfMinimumShares, TNumber numberOfShares, Secret<TNumber> secret, int securityLevel); | ||
|
||
/// <summary> | ||
/// Generates a random shamir pool, returns the specified <paramref name="secret"/> and the share points. | ||
/// </summary> | ||
/// <param name="numberOfMinimumShares">Minimum number of shared secrets for reconstruction</param> | ||
/// <param name="numberOfShares">Maximum number of shared secrets</param> | ||
/// <param name="secret">secret text as <see cref="Secret{TNumber}"/> or see cref="string"/></param> | ||
/// <returns>A <see cref="Shares{TNumber}"/> object</returns> | ||
/// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="numberOfMinimumShares"/> is lower than 2 or greater than <paramref name="numberOfShares"/>.</exception> | ||
Shares<TNumber> MakeShares(TNumber numberOfMinimumShares, TNumber numberOfShares, Secret<TNumber> secret); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace SecretSharingDotNet.Cryptography; | ||
|
||
/// <summary> | ||
/// Interface for the Shamir's Secret Sharing algorithm implementation for reconstructing the secret. | ||
/// </summary> | ||
/// <typeparam name="TNumber"></typeparam> | ||
public interface IReconstructionUseCase<TNumber> | ||
{ | ||
/// <summary> | ||
/// Recovers the secret from the given <paramref name="shares"/> (points with x and y on the polynomial) | ||
/// </summary> | ||
/// <param name="shares">Shares represented by <see cref="string"/> and separated by newline.</param> | ||
/// <returns>Re-constructed secret</returns> | ||
Secret<TNumber> Reconstruction(string shares); | ||
|
||
/// <summary> | ||
/// | ||
/// Recovers the secret from the given <paramref name="shares"/> (points with x and y on the polynomial) | ||
/// </summary> | ||
/// <param name="shares">Shares represented by <see cref="string"/> array.</param> | ||
/// <returns>Re-constructed secret</returns> | ||
Secret<TNumber> Reconstruction(string[] shares); | ||
|
||
/// <summary> | ||
/// Recovers the secret from the given <paramref name="shares"/> (points with x and y on the polynomial) | ||
/// </summary> | ||
/// <param name="shares">For details <see cref="Shares{TNumber}"/></param> | ||
/// <returns>Re-constructed secret</returns> | ||
Secret<TNumber> Reconstruction(Shares<TNumber> shares); | ||
|
||
/// <summary> | ||
/// Recovers the secret from the given <paramref name="shares"/> (points with x and y on the polynomial) | ||
/// </summary> | ||
/// <param name="shares">Two or more shares represented by a set of <see cref="FinitePoint{TNumber}"/></param> | ||
/// <returns>Re-constructed secret</returns> | ||
/// <exception cref="T:System.ArgumentNullException"><paramref name="shares"/> is <see langword="null"/>.</exception> | ||
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of <paramref name="shares"/> is lower than 2.</exception> | ||
Secret<TNumber> Reconstruction(FinitePoint<TNumber>[] shares); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.