NET API
HSM Dinamo
Loading...
Looking for...
No entries found
Blockchain

Detailed description

Operations to support the security of Blockchain-based structures.

See the HSM technical documentation.

Functions

void BchainCreateXPrvBtcMinikey (string szId, bool isExportable, bool isTemporary)
 Creates an XPriv private key for Bitcoin in minikey format.
 
void BchainCreateXPrvBip32 (string szId, byte bVersion, bool isExportable, bool isTemporary)
 Creates an XPriv private key in BIP32 format.
 
void BchainCreateXPrvBip32Seed (string szId, DinamoApi.DN_BCHAIN_BIP32_SEED_XPRV_DATA pData, bool isExportable, bool isTemporary)
 Creates an XPriv private key in BIP32 format using seed.
 
void BchainCreateXPrvBip39Seed (string szId, DinamoApi.DN_BCHAIN_BIP39_SEED_XPRV_DATA pData, bool isExportable, bool isTemporary)
 Creates an XPriv private key in BIP39 format using seed.
 
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 blockchain in the BIP32 standard.
 
byte[] BchainSignHash (byte bType, byte bHashMode, byte[] pbHash, string szPk)
 Sign a hash using the Blockchain module.
 
byte[] BchainGetPubKey (byte bType, string szId)
 Retrieves a public key using the blockchain module.
 
byte[] BchainGetAddress (byte bType, byte bVersion, string szHrp, string szId)
 Retrieves the address of a key using the blockchain module.
 
byte[] BchainEdDsaSign (byte bType, string szCtxStr, byte[] pbData, string szId)
 Generates an EdDsa signature using the blockchain module.
 
void BchainGenerateKey (Dinamo.Hsm.DinamoClient.KEY_ALG dwAlg, string szId, bool isExportable, bool isTemporary)
 Generates a marked key for use in the blockchain module.
 

Functions

BchainCreateXPrvBtcMinikey()

void BchainCreateXPrvBtcMinikey ( string szId,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key for Bitcoin in minikey format.

Parameters
szIdKey identifier.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.

BchainCreateXPrvBip32()

void BchainCreateXPrvBip32 ( string szId,
byte bVersion,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key in BIP32 format.

Parameters
szIdKey identifier.
bVersionKey version. See table below.
Value Meaning
DinamoApi.DN_BCHAIN_VER_BIP32_MAINNET Mainnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_TESTNET Testnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_MAINNET Mainnet BIP32 Hathor.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_TESTNET Testnet BIP32 Hathor.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_ckd.cs, bchain_get_address.cs, bchain_get_pub.c s and bchain_sign_hash.cs.

BchainCreateXPrvBip32Seed()

void BchainCreateXPrvBip32Seed ( string szId,
DinamoApi.DN_BCHAIN_BIP32_SEED_XPRV_DATA pData,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key in BIP32 format using seed.

Parameters
szIdKey identifier.
pDataData for generating the key.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.

BchainCreateXPrvBip39Seed()

void BchainCreateXPrvBip39Seed ( string szId,
DinamoApi.DN_BCHAIN_BIP39_SEED_XPRV_DATA pData,
bool isExportable,
bool isTemporary )
inline

Creates an XPriv private key in BIP39 format using seed.

Parameters
szIdKey identifier.
pDataData for generating the key.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.

BchainCreateBip32Ckd()

DinamoApi.DN_BCHAIN_KEY_INFO BchainCreateBip32Ckd ( byte bVersion,
UInt32 dwIndex,
string szPar,
string szDst,
bool isExportable,
bool isTemporary )
inline

Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.

Parameters
bVersionKey version. See table below.
Value Meaning
DinamoApi.DN_BCHAIN_VER_BIP32_MAINNET Mainnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_TESTNET Testnet BIP32.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_MAINNET Mainnet BIP32 Hathor.
DinamoApi.DN_BCHAIN_VER_BIP32_HTR_TESTNET Testnet BIP32 Hathor.
dwIndexIndex of the key to be derived. Keys non hardened use the 0 a 231-1 and keys hardened (unrestrictedly secure) use indices of 231 a 232-1as specified in the standard BIP32. It is highly recommended to generate hardened keys. Use DinamoApi.DN_BCHAIN_SECURE_BIP32_INDEX_BASE as a basis for generating indexes hardened (Ex. DinamoApi.DN_BCHAIN_SECURE_BIP32_INDEX_BASE + 1 ...).
szParIdentifier of the parent key.
szDstIdentifier of the derived key. Must be an XPrv key(DinamoApi.DN_BCHAIN_BIP32_XPRV etc.)
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Return
Information on the derived key.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_ckd.cs.

BchainSignHash()

byte[] BchainSignHash ( byte bType,
byte bHashMode,
byte[] pbHash,
string szPk )
inline

Sign a hash using the Blockchain module.

Parameters
bTypeKey type.
Value Meaning
DinamoApi.DN_BCHAIN_SIG_DER_ECDSA DER signature, in the format v || DER. SECG!SEC1 strict DER with low S as described in BIP62/66, BIP146, EIP2. With 'v' having a size of 1 byte. 'v' is the parity bit of 'r' and can have the values 0 or 1.
DinamoApi.DN_BCHAIN_SIG_RAW_ECDSA RAW signature, in the format v || r || s. With 'v' having a size of 1 byte and 'r' and 's' each having a size of 32 bytes. 'v' is the parity bit of 'r' and can have the values 0 or 1.
DinamoApi.DN_BCHAIN_SIG_BIP340 Signature BIP340 - Schnorr 64 bytes.
bHashModeHash type.
Value Meaning
DinamoApi.DN_BCHAIN_HASH_BTC_H160 Bitcoin H160.
DinamoApi.DN_BCHAIN_HASH_RIPEMD160 RIPEMD160.
DinamoApi.DN_BCHAIN_HASH_SHA256 SHA256
DinamoApi.DN_BCHAIN_HASH_BTC_SHA256_2X Bitcoin SHA256 2x.
DinamoApi.DN_BCHAIN_HASH_KECCAK256 KECCAK256.
pbHashHash calculated according to bHashMode.
szPkPrivate key identifier.
Return
Signature.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_sign_hash.cs.

BchainGetPubKey()

byte[] BchainGetPubKey ( byte bType,
string szId )
inline

Retrieves a public key using the blockchain module.

Parameters
bTypeKey type.
Value Meaning
DinamoApi.DN_BCHAIN_PBK_SEC1_UNCOMP ECDSA SEC1 uncompressed.
DinamoApi.DN_BCHAIN_PBK_SEC1_COMP ECDSA SEC1 compressed.
DinamoApi.DN_BCHAIN_PBK_BIP340 Schnorr, BIP-340.
DinamoApi.DN_BCHAIN_PBK_ED25519 Ed25519.
DinamoApi.DN_BCHAIN_PBK_AT_ALGORAND Algorand.
DinamoApi.DN_BCHAIN_PBK_BIP32_XPUB BIP32 XPub.
DinamoApi.DN_BCHAIN_PBK_AT_SOL Solana.
szIdPrivate key identifier.
Return
Public key.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_get_pub.cs.

BchainGetAddress()

byte[] BchainGetAddress ( byte bType,
byte bVersion,
string szHrp,
string szId )
inline

Retrieves the address of a key using the blockchain module.

Parameters
bTypeType of address to be generated. It can be one of the values below.
Value Meaning
DinamoApi.DN_BCHAIN_AT_BTC_P2PKH P2PKH address.
DinamoApi.DN_BCHAIN_AT_BTC_P2SH Address P2SH BIP13..
DinamoApi.DN_BCHAIN_AT_BTC_B32_PKH Address BIP32 P2PKH BIP173.
DinamoApi.DN_BCHAIN_AT_BTC_B32_SH BIP32 P2SH address.
DinamoApi.DN_BCHAIN_AT_ETH_EOA Address ETH EOA.
DinamoApi.DN_BCHAIN_AT_ETH_EOA_MC_CKS Address ETH EOA MC CKS. EIP55.
DinamoApi.DN_BCHAIN_AT_ETH_EOA_ICAP Address ETH EOA ICAP.
DinamoApi.DN_BCHAIN_AT_ALGORAND Address Algorand.
DinamoApi.DN_BCHAIN_AT_TRON_HEX Hexadecimal TRON address.
DinamoApi.DN_BCHAIN_AT_TRON_B58 Address TRON Base 58.
DinamoApi.DN_BCHAIN_AT_XRP XRP Ledger/Ripple address.
DinamoApi.DN_BCHAIN_AT_SOL Address Solana.
Parameters
bVersionAddress version. See table below.
Value Meaning
DinamoApi.DN_BCHAIN_VER_UNUSED Parameter not used.
DinamoApi.DN_BCHAIN_VER_BTC_A1_MAIN_NET Bitcoin A1 mainnet.
DinamoApi.DN_BCHAIN_VER_XRP_CLASSIC XRP Ledger/Ripple Classic.
DinamoApi.DN_BCHAIN_VER_BTC_AMN_TEST_NET Bitcoin P2PKH testnet.
DinamoApi.DN_BCHAIN_VER_BTC_A3_MAIN_NET Bitcoin A3 mainnet.
DinamoApi.DN_BCHAIN_VER_BTC_B32_WITVER Bitcoin B32 witver.
DinamoApi.DN_BCHAIN_VER_HTR_MAINNET Hathor mainnet.
DinamoApi.DN_BCHAIN_VER_HTR_TESTNET Hathor testnet.
DinamoApi.DN_BCHAIN_VER_HTR_P2SH_MAINNET Hathor P2SH mainnet.
DinamoApi.DN_BCHAIN_VER_HTR_P2SH_TESTNET Hathor P2SH testnet.
szHrpHRP (Human Readable Part) of the key. The values in the table are accepted. It must have a maximum size of DinamoApi.DN_BCHAIN_MAX_HRP
Value Meaning
DinamoApi.DN_BCHAIN_HRP_UNUSED Parameter not used.
DinamoApi.DN_BCHAIN_HRP_BTC_MAIN_NET Bitcoin mainnet.
DinamoApi.DN_BCHAIN_HRP_BTC_TEST_NET Bitcoin testnet.
szIdPrivate key identifier.
Return
Address.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_get_address.cs.

BchainEdDsaSign()

byte[] BchainEdDsaSign ( byte bType,
string szCtxStr,
byte[] pbData,
string szId )
inline

Generates an EdDsa signature using the blockchain module.

Parameters
bTypeType of subscription to be generated. It can be one of the values below.
Value Meaning
DinamoApi.DN_BCHAIN_EDDSA_SIG_PURE EdDsa Pure Signature.
DinamoApi.DN_BCHAIN_EDDSA_SIG_ALGORAND EdDsa Algorand Signature.
DinamoApi.DN_BCHAIN_EDDSA_SIG_XRP EdDsa XRP subscription.
DinamoApi.DN_BCHAIN_EDDSA_SIG_SOL Signature EdDsa Solana.
szCtxStrContext string as defined in RFC-8032 of maximum size DinamoApi.DN_BCHAIN_EDDSA_MAX_CSTRL. Can be passed DinamoApi.DN_BCHAIN_EDDSA_CSTR_UNUSED.
pbDataData to be signed.
szIdPrivate key identifier.
Return
Signature.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_eddsa_sign.cs.

BchainGenerateKey()

void BchainGenerateKey ( Dinamo.Hsm.DinamoClient.KEY_ALG dwAlg,
string szId,
bool isExportable,
bool isTemporary )
inline

Generates a marked key for use in the blockchain module.

Parameters
dwAlgAlgorithm to be used. Dinamo.Hsm.DinamoClient.KEY_ALG
szIdKey identifier.
isExportableThe key can be exported from the HSM.
isTemporaryThe key will only exist while the session is active. It will be destroyed after the session is closed.
Exceptions
DinamoExceptionThrows exception in case of error.
Examples
bchain_eddsa_sign.cs.