NET API
HSM Dinamo
Loading...
Looking for...
No entries found
bchain_ckd.cs

Example of key generation and CKD derivation using the blockchain module.

See Note on examples.
using Dinamo.Hsm;
using System;
using System.Text;
using System.IO;
namespace BchainCkd
{
class Program
{
private static String addr = "127.0.0.1";
private static String userId = "test";
private static String userPwd = "12345678";
static void Main(string[] args)
{
String keyId = "key";
try {
/*
Connect to HSM
*/
api.Connect(addr, userId, userPwd);
Console.Out.WriteLine("Connected successfully!");
/*
Generates the XPriv BIP-32 key.
*/
api. BchainCreateXPrvBip32(keyId, DinamoApi.DN_BCHAIN_VER_WIF_MAIN_NET, false, false);
Console.Out.WriteLine("Key generated successfully!");
string derivedKeyId = "derivedKey";
api.RemoveObjectIfExists(derivedKeyId);
/*
Derives the secure (hardened) private key for index 1.
*/
var info = api. BchainCreateBip32Ckd(DinamoApi.DN_BCHAIN_VER_WIF_MAIN_NET,
keyId, derivedKeyId, false, false);
Console.Out.WriteLine("Derived key generated successfully!");
} catch (DinamoException e) {
Console.Out.WriteLine(e.Message);
} finally{
/*
Disconnects from HSM
*/
api.Disconnect();
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
const UInt32 DN_BCHAIN_SECURE_BIP32_INDEX_BASE
Definition DinamoApi.cs:2470
const byte DN_BCHAIN_VER_WIF_MAIN_NET
Definition DinamoApi.cs:2392
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
void BchainCreateXPrvBip32(string szId, byte bVersion, bool isExportable, bool isTemporary)
Creates an XPriv private key in BIP32 format.
Definition DinamoClient.cs:7016
DinamoApi.DN_BCHAIN_KEY_INFO BchainCreateBip32Ckd(byte bVersion, UInt32 dwIndex, string szPar, string szDst, bool isExportable, bool isTemporary)
Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the b...
Definition DinamoClient.cs:7074
void RemoveObjectIfExists(string ObjectId)
Removes an object from the HSM, if it exists.
Definition DinamoClient.cs:2410
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