SecretSharingDotNet 1.2.0
dotnet add package SecretSharingDotNet --version 1.2.0
NuGet\Install-Package SecretSharingDotNet -Version 1.2.0
<PackageReference Include="SecretSharingDotNet" Version="1.2.0" />
<PackageVersion Include="SecretSharingDotNet" Version="1.2.0" />
<PackageReference Include="SecretSharingDotNet" />
paket add SecretSharingDotNet --version 1.2.0
#r "nuget: SecretSharingDotNet, 1.2.0"
#:package SecretSharingDotNet@1.2.0
#addin nuget:?package=SecretSharingDotNet&version=1.2.0
#tool nuget:?package=SecretSharingDotNet&version=1.2.0
SecretSharingDotNet
Shamir's Secret Sharing for .NET: split a secret into n shares, reconstruct it from any k of them.
đ Highlights
- Two numeric backends:
BigIntegerandSecureBigInteger, which keeps its limbs in pinned memory and wipes them on dispose. - Text input and output use pinned
PinnedPoolArray<char>buffers instead ofstring, including a console password reader. - Best-effort timing hardening: fixed-time secret equality and a fixed-iteration modular inverse.
- Shares can record their security level (
ShareFormat.Extended), so reconstruction does not have to derive the field. ToString()returns*** Secured Value ***in Release builds, so secrets do not leak into logs.
âšī¸ Overview
The library splits a secret into n shares; any k of them reconstruct it, and fewer than k do not. Splitting evaluates a random polynomial over a Mersenne prime field; reconstruction uses Lagrange interpolation. The secret can be text, a byte array, a number, or a random value that the library generates.
SecureBigInteger reduces timing side channels on a best-effort basis; it is not audited against active co-located attackers.
Plain Shamir carries no integrity check, so a tampered share yields a wrong secret without an error.
The threat model lists what is protected and what is not.
âŦī¸ Installation
The package targets .NET Standard 2.0 and 2.1, .NET Framework 4.7.2, 4.8, and 4.8.1, and .NET 8, 9, 10, and 11.
Install SecretSharingDotNet with:
dotnet add package SecretSharingDotNet
Upgrading from an earlier version? The upgrade notes summarize the breaking changes, and the changelog lists all of them.
đ Usage
The following example splits and reconstructs a text secret in a .NET 8+ console app (dotnet new console):
using SecretSharingDotNet.Cryptography;
using SecretSharingDotNet.Cryptography.SecureInput;
using SecretSharingDotNet.Cryptography.ShamirsSecretSharing;
using SecretSharingDotNet.Math.Numerics;
// Split into 5 shares at security level 127; any 3 of them reconstruct it.
using var text = "Hello World!".ToPinnedSecure();
using var secret = Secret<SecureBigInteger>.FromText(text);
using var splitter = new SecretSplitter<SecureBigInteger>();
using var shares = splitter.MakeShares(3, 5, secret, 127);
// Reconstruct the secret and print it without creating a string.
using var reconstructor = new FixedIterationSecretReconstructor<SecureBigInteger>();
using var recovered = reconstructor.Reconstruction(shares);
using var chars = recovered.ToCharArray();
Console.WriteLine(chars.PoolArray, 0, chars.Length);
Output:
Hello World!
To store shares, write them with ShareFormat.Extended.
The default format omits the security level, so shares read back from storage can silently reconstruct a different secret.
For the BigInteger backend, pass an ExtendedEuclideanAlgorithm<BigInteger> to SecretReconstructor<BigInteger>.
The usage guide covers both backends, dependency injection, storing shares, and console input.
samples/SecretSharingDotNet.Demo.Console is a runnable demo.
đ Documentation
- Usage guide: backends, dependency injection, secrets, shares, storage, console input, upgrade notes.
- Threat model: what
SecureBigIntegerand reconstruction protect against, and what they do not. - Architecture documentation (arc42), also in German.
- Changelog: all changes per release.
đ ī¸ Development
Requires the .NET 8, 9, 10, and 11 SDKs. The .NET Framework test targets need Windows or Mono; CI runs them on Windows, and Mono can behave differently. Build and test the solution with:
dotnet restore SecretSharingDotNet.slnx
dotnet build --configuration Release --no-restore SecretSharingDotNet.slnx
dotnet test --configuration Release --no-restore --no-build SecretSharingDotNet.slnx
The tests run single-threaded, configured in tests/xunit.runner.json; add --max-parallel-test-modules 1 to run the target frameworks one after another.
Mono may leave mono_crash.*.json files in tests/ after a passing run; Git ignores them.
đ Feedback & Contributing
Report bugs and request features through the issue forms. Ask questions and discuss ideas in GitHub Discussions. Report security vulnerabilities privately through a security advisory, not in a public issue. This project follows a code of conduct.
đ License
Licensed under the MIT License â see LICENSE.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- System.Buffers (>= 4.6.1)
-
.NETFramework 4.8
- System.Buffers (>= 4.6.1)
-
.NETFramework 4.8.1
- System.Buffers (>= 4.6.1)
-
.NETStandard 2.0
- System.Buffers (>= 4.6.1)
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SecretSharingDotNet:
| Package | Downloads |
|---|---|
|
Aero.Core
Aero core library with useful utility tools for any project |
|
|
Leosac.KeyManager.Library.KeyGen
Key Generation Library for Leosac Key Manager development |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 151 | 11/19/2026 |
| 1.1.0 | 1,958 | 9/26/2026 |
| 1.0.1 | 2,625 | 8/24/2026 |
| 1.0.1-rc02 | 160 | 7/12/2026 |
| 1.0.1-rc01 | 160 | 5/29/2026 |
| 0.14.0 | 11,482 | 12/25/2025 |
| 0.13.0 | 3,617 | 11/16/2025 |
| 0.12.0 | 7,003 | 11/17/2024 |
| 0.11.0 | 15,179 | 12/30/2023 |
| 0.10.2 | 2,863 | 9/16/2023 |
| 0.10.1 | 2,276 | 5/8/2023 |
| 0.10.0 | 9,602 | 12/24/2022 |
| 0.9.0 | 1,335 | 10/9/2022 |
| 0.8.0 | 4,538 | 7/5/2022 |
| 0.7.0 | 5,462 | 2/8/2022 |
| 0.6.0 | 10,506 | 11/25/2021 |
| 0.5.0 | 722 | 10/7/2021 |
| 0.4.2 | 3,128 | 12/18/2020 |
| 0.3.0 | 917 | 4/19/2020 |
| 0.2.0 | 780 | 4/12/2020 |