Example of exporting and importing a key in TR-31 format.
using System;
using System.Text;
using System.IO;
namespace TR31ExportImport
{
class Program
{
private static String strAddr = "127.0.0.1";
private static String strUsrId = "master";
private static String strPwd = "12345678";
static void Main(string[] args)
{
String szKbpk = "kbpk";
String szKey = "key";
try {
api.
Connect(strAddr, strUsrId, strPwd);
Console.Out.WriteLine(BitConverter.ToString(keyBlock));
Console.Out.WriteLine("Key exported successfully!");
String szImportedKey = "imp_key";
api.
ImportTR31(szKbpk, szImportedKey,
true,
false, keyBlock);
Console.Out.WriteLine("Key imported successfully!");
} finally{
}
}
}
}
API class for accessing HSM functionalities Dinamo. In this class you can program using...
Definition DinamoClient.cs:93
EftExportExpType
TR-31 export type identifier.
Definition DinamoClient.cs:526
EftExportMode
TR-31 export mode identifier.
Definition DinamoClient.cs:507
EftExportUsage
TR-31 export use identifier.
Definition DinamoClient.cs:462
Exception class for errors from Dinamo.
Definition DinamoException.cs:10
override string Message
Definition DinamoException.cs:42
byte[] ExportTR31(string kbpk, string key, EftExportUsage usage, EftExportMode mode, EftExportExpType exp)
Exports a key in TR-31 format according to the ASC X9 TR 31-2018 standard.
Definition DinamoClient.cs:4488
void ImportTR31(string kbpk, string key, bool isExportable, bool isTemporary, byte[] keyBlock)
Import a key in TR-31 format according to the ASC X9 TR 31-2018 standard.
Definition DinamoClient.cs:4523
void Connect(string User, string Password)
Establishes an encrypted connection to the HSM using the load balance settings.
Definition DinamoClient.cs:562
void Disconnect(bool flagClose)
Terminates the connection to the HSM.
Definition DinamoClient.cs:814
Namespace denoting a set of functions for accessing the HSM Dinamo and their respective exceptions.
Definition DinamoClient.cs:12