Example of splitting and retrieving a secret using M from N.
using System;
using System.Text;
using System.IO;
namespace MofN
{
class Program
{
private static String addr = "127.0.0.1";
static void Main(string[] args)
{
try {
Console.Out.WriteLine("Successfully connected anonymously!");
var splitInfo = api.
MofNSplit(2, 6,
null);
Console.Out.WriteLine("Secret split successfully!");
Console.Out.WriteLine("Secret: " + BitConverter.ToString(splitInfo.pbSecret).Replace("-", ""));
Console.Out.WriteLine("Total parts: " + splitInfo.dwPartCount);
for (UInt32 i = 0; i < splitInfo.dwPartCount; i++) {
Console.Out.WriteLine("Part " + (i + 1) + ": " + BitConverter.ToString(splitInfo.pstParts[i].pbPart).Replace("-", ""));
}
parts[0] = splitInfo.pstParts[0];
parts[1] = splitInfo.pstParts[1];
var recoveredSecret = api.
MofNRecover(parts);
Console.Out.WriteLine("Secret successfully retrieved!");
Console.Out.WriteLine("Recovered secret: " + BitConverter.ToString(recoveredSecret).Replace("-", ""));
} finally{
Console.Out.WriteLine("Successfully disconnected!");
}
}
}
}
Low-level class for accessing the HSM. To use this class you need to understand more ...
Definition DinamoApi.cs:15
API class for accessing HSM functionalities Dinamo. In this class you can program using...
Definition DinamoClient.cs:93
Exception class for errors from Dinamo.
Definition DinamoException.cs:10
override string Message
Definition DinamoException.cs:42
DinamoApi.DN_M_OF_N_SPLIT_INFO MofNSplit(byte bM, byte bN, byte[] pbSecret)
Divides M from N in a secret. According to Shamir's secret sharing pattern.
Definition DinamoClient.cs:4216
byte[] MofNRecover(DinamoApi.DN_M_OF_N_PART[] parts)
It reconstructs the secret M of N from the parts of the custodians. According to the sharing pattern...
Definition DinamoClient.cs:4239
void Disconnect(bool flagClose)
Terminates the connection to the HSM.
Definition DinamoClient.cs:814
void ConnectAnonymously(string Address)
Establishes an anonymous connection to the HSM.
Definition DinamoClient.cs:722
Namespace denoting a set of functions for accessing the HSM Dinamo and their respective exceptions.
Definition DinamoClient.cs:12
Definition DinamoApi.cs:2650