Operations to support the security of Blockchain-based structures.
See the HSM technical documentation.
Functions | |
int AAP_API | DBchainCreateXPrv(HSESSIONCTX hSession, BYTE bType, DWORD dwAttributes, const char *szId, const BYTE *pcbData, DWORD dwDataLen, DWORD dwReserved) |
int AAP_API | DBchainCreateBip32Ckd(HSESSIONCTX hSession, BYTE bVersion, DWORD dwIndex, DWORD dwAttributes, const char *cszPar, const char *cszDst, DN_BCHAIN_KEY_INFO *pKeyInfo, DWORD dwReserved) |
int AAP_API | DBchainGetAddress(HSESSIONCTX hSession, BYTE bType, BYTE bVer, const char *cszHrp, const char *cszPk, BYTE *pbAddress, DWORD *pdwAddressLen, DWORD dwReserved) |
int AAP_API | DBchainSignHash(HSESSIONCTX hSession, BYTE bType, BYTE bHashMode, BYTE *pbHash, DWORD dwHashLen, const char *cszPk, BYTE *pbSig, DWORD *pdwSigLen, DWORD dwReserved) |
int AAP_API | DBchainVerify(HSESSIONCTX hSession, BYTE bSigType, BYTE bHashMode, const BYTE *pbHash, DWORD dwHashLen, const BYTE *pbSig, DWORD dwSigLen, BYTE bInPbkType, const BYTE *pbInPbk, BYTE bInPbkLen, DWORD dwReserved) |
int AAP_API | DBchainEdDsaSign(HSESSIONCTX hSession, BYTE bType, const char *cszCtxStr, BYTE *pbData, DWORD dwDataLen, const char *cszPk, BYTE *pbSig, DWORD *pdwSigLen, DWORD dwReserved) |
int AAP_API | DBchainEdDsaVerify(HSESSIONCTX hSession, BYTE bType, const char *cszCtxStr, BYTE *pbData, DWORD dwDataLen, BYTE bPbkType, BYTE *pbPbk, DWORD dwPbkLen, BYTE *pbSig, DWORD dwSigLen, DWORD dwReserved) |
int AAP_API | DBchainPkImport(HSESSIONCTX hSession, BYTE bFormat, DWORD dwAttributes, const char *cszId, const BYTE *pcbData, DWORD dwDataLen, DWORD dwReserved) |
int AAP_API | DBchainPkExport(HSESSIONCTX hSession, BYTE bFormat, BYTE bVersion, BYTE bCompressed, const char *cszId, BYTE **ppbData, DWORD *pdwDataLen, DWORD dwReserved) |
int AAP_API | DBchainGetPubKey(HSESSIONCTX hSession, BYTE bType, const char *cszId, BYTE *pbData, DWORD *pdwDataLen, DWORD dwReserved) |
int AAP_API | DBchainRecoverPbkFromSignature(HSESSIONCTX hSession, BYTE bSigType, BYTE bHashMode, const BYTE *pbHash, DWORD dwHashLen, const BYTE *pbSig, DWORD dwSigLen, DN_BCHAIN_PBK *pPbk, DWORD dwReserved) |
int AAP_API | DBchainGetKeyInfo(HSESSIONCTX hSession, DWORD dwReserved, const char *cszId, void *pvData, DWORD *pdwDataLen) |
int AAP_API | DBchainHashData(HSESSIONCTX hSession, BYTE bMode, BYTE *pbData, DWORD dwDataLen, BYTE *pbHash, DWORD *pdwHashLen, DWORD dwReserved) |
int AAP_API | DBchainEd2X(HSESSIONCTX hSession, const char *cszPk, const char *cszTo, DWORD dwAttr, DWORD dwReserved) |
int AAP_API DBchainCreateXPrv | ( | HSESSIONCTX | hSession, |
BYTE | bType, | ||
DWORD | dwAttributes, | ||
const char * | szId, | ||
const BYTE * | pcbData, | ||
DWORD | dwDataLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Creates an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||
[in] | bType | Type of key generation.
| ||||||||||||
[in] | dwAttributes | Additional key parameters. See the options in the DGenerateKey() function. This API automatically includes the BCHAIN_KEY flag, which is required for blockchain operations. | ||||||||||||
[in] | szId | Name of the key in the HSM. Must have a maximum length of MAX_OBJ_ID_FQN_LEN. | ||||||||||||
[in] | pcbData | Buffer containing the data needed to generate the key. The input data must be passed according to the option bType and the size of the data passed here must be specified in dwDataLen . | ||||||||||||
[in] | dwDataLen | Size of data passed in pcbData . | ||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
Value | Meaning |
---|---|
DN_BCHAIN_VER_BIP32_MAINNET | Mainnet BIP32. |
DN_BCHAIN_VER_BIP32_TESTNET | Testnet BIP32. |
DN_BCHAIN_VER_BIP32_HTR_MAINNET | Mainnet BIP32 Hathor. |
DN_BCHAIN_VER_BIP32_HTR_TESTNET | Testnet BIP32 Hathor. |
int AAP_API DBchainCreateBip32Ckd | ( | HSESSIONCTX | hSession, |
BYTE | bVersion, | ||
DWORD | dwIndex, | ||
DWORD | dwAttributes, | ||
const char * | cszPar, | ||
const char * | cszDst, | ||
DN_BCHAIN_KEY_INFO * | pKeyInfo, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||
[in] | bVersion | Key version.
| ||||||||||
[in] | dwIndex | Index 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-1 as specified in the standard BIP32. It is highly recommended to generate hardened keys. Use DN_BCHAIN_SECURE_BIP32_INDEX_BASE as a basis for generating indexes hardened (Ex. DN_BCHAIN_SECURE_BIP32_INDEX_BASE + 1 ...). | ||||||||||
[in] | dwAttributes | Additional key parameters. See the options in the DGenerateKey() function. This API automatically includes the BCHAIN_KEY flag, which is required for blockchain operations. | ||||||||||
[in] | cszPar | Name of the parent key in the HSM. Must have a maximum size of MAX_OBJ_ID_FQN_LEN. Must be an XPrv key(DN_BCHAIN_BIP32_XPRV etc.). See DBchainCreateXPrv(). | ||||||||||
[in] | cszDst | Name of the key that will be derived in the HSM. It must have a maximum size of MAX_OBJ_ID_FQN_LEN. | ||||||||||
[out] | pKeyInfo | Pointer to the DN_BCHAIN_KEY_INFO structure that will contain the information of the generated key. | ||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainGetAddress | ( | HSESSIONCTX | hSession, |
BYTE | bType, | ||
BYTE | bVer, | ||
const char * | cszHrp, | ||
const char * | cszPk, | ||
BYTE * | pbAddress, | ||
DWORD * | pdwAddressLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Retrieves the address of a key using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||||||||
[in] | bType | Type of address to be generated. It can be one of the values below. | ||||||||||||||||||||||
[in] | bVer | Address version.
| ||||||||||||||||||||||
[in] | cszHrp | HRP (Human Readable Part) of the key. The values in the table are accepted. It must have a maximum size of DN_BCHAIN_MAX_HRP.
| ||||||||||||||||||||||
[in] | cszPk | Private key that will generate the address or the script-hash. If using script-hash pass a buffer of size MAX_OBJ_ID_FQN_LEN with script-hash with zero padding. | ||||||||||||||||||||||
[in,out] | pbAddress | Buffer that will receive the address. It can be NULL to obtain the required size. It is recommended to use the maximum size of DN_BCHAIN_MAX_ADDR_LEN. | ||||||||||||||||||||||
[in,out] | pdwAddressLen | Buffer size pbAddress . If the buffer pbAddress is NULL, this parameter will be assigned the required size. | ||||||||||||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainSignHash | ( | HSESSIONCTX | hSession, |
BYTE | bType, | ||
BYTE | bHashMode, | ||
BYTE * | pbHash, | ||
DWORD | dwHashLen, | ||
const char * | cszPk, | ||
BYTE * | pbSig, | ||
DWORD * | pdwSigLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Sign a hash using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||
[in] | bType | Type of subscription to be generated. It can be one of the values below.
| ||||||||||||
[in] | bHashMode | Hash type.
| ||||||||||||
[in] | pbHash | Hash calculated according to bHashMode . | ||||||||||||
[in] | dwHashLen | Hash size entered in pbHash . | ||||||||||||
[in] | cszPk | Name of the private key. | ||||||||||||
[in,out] | pbSig | Buffer that will receive the signature.Can be NULL to obtain the required size.It is recommended to use the maximum size of DN_BCHAIN_MAX_SIG_LEN. | ||||||||||||
[in,out] | pdwSigLen | Buffer size pbSig.Case the buffer pbSig is NULL, this parameter will be assigned the required size. | ||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainVerify | ( | HSESSIONCTX | hSession, |
BYTE | bSigType, | ||
BYTE | bHashMode, | ||
const BYTE * | pbHash, | ||
DWORD | dwHashLen, | ||
const BYTE * | pbSig, | ||
DWORD | dwSigLen, | ||
BYTE | bInPbkType, | ||
const BYTE * | pbInPbk, | ||
BYTE | bInPbkLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Verifies a signature using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||
[in] | bSigType | Type of subscription to be generated. It can be one of the values below.
| ||||||||||||
[in] | bHashMode | Hash type.
| ||||||||||||
[in] | pbHash | Hash calculated according to bHashMode . | ||||||||||||
[in] | dwHashLen | Hash size entered in pbHash . | ||||||||||||
[in] | pbSig | Signature according to bSigType . | ||||||||||||
[in] | dwSigLen | Signature size entered in pbSig . | ||||||||||||
[in] | bInPbkType | Public key format. Can be one of the values below.
| ||||||||||||
[in] | pbInPbk | Signature according to bInPbkType . | ||||||||||||
[in] | bInPbkLen | Signature size entered in pbInPbk . | ||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainEdDsaSign | ( | HSESSIONCTX | hSession, |
BYTE | bType, | ||
const char * | cszCtxStr, | ||
BYTE * | pbData, | ||
DWORD | dwDataLen, | ||
const char * | cszPk, | ||
BYTE * | pbSig, | ||
DWORD * | pdwSigLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Generates an EdDsa signature using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||
[in] | bType | Type of subscription to be generated. It can be one of the values below.
| ||||||||||
[in] | cszCtxStr | Context string as defined in RFC-8032 . Can be passed DN_BCHAIN_EDDSA_CSTR_UNUSED. | ||||||||||
[in] | pbData | Data to be signed. | ||||||||||
[in] | dwDataLen | Size of the data to be signed. | ||||||||||
[in] | cszPk | Name of the private key. | ||||||||||
[in,out] | pbSig | Buffer that will receive the signature. It can be NULL to obtain the required size. It is recommended to use the maximum size of DN_BCHAIN_MAX_SIG_LEN. | ||||||||||
[in,out] | pdwSigLen | Buffer size pbSig . If the buffer pbSig is NULL, this parameter will be assigned the required size. | ||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainEdDsaVerify | ( | HSESSIONCTX | hSession, |
BYTE | bType, | ||
const char * | cszCtxStr, | ||
BYTE * | pbData, | ||
DWORD | dwDataLen, | ||
BYTE | bPbkType, | ||
BYTE * | pbPbk, | ||
DWORD | dwPbkLen, | ||
BYTE * | pbSig, | ||
DWORD | dwSigLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Verifies an EdDsa signature using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||
[in] | bType | Type of signature to be verified. It can be one of the values below.
| ||||||||||
[in] | cszCtxStr | Context string as defined in RFC-8032 of maximum length DN_BCHAIN_EDDSA_MAX_CSTRL. Can be passed DN_BCHAIN_EDDSA_CSTR_UNUSED. | ||||||||||
[in] | pbData | Data to be verified. | ||||||||||
[in] | dwDataLen | Size of the data to be checked. | ||||||||||
[in] | bPbkType | Public key format. Can be one of the values below.
| ||||||||||
[in] | pbPbk | Public key used for verification. | ||||||||||
[in] | dwPbkLen | Size of the public key. | ||||||||||
[in] | pbSig | Signature to be verified. | ||||||||||
[in] | dwSigLen | Signature size. | ||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainPkImport | ( | HSESSIONCTX | hSession, |
BYTE | bFormat, | ||
DWORD | dwAttributes, | ||
const char * | cszId, | ||
const BYTE * | pcbData, | ||
DWORD | dwDataLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Import a private key using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||
[in] | bFormat | Format of the key to be imported. Can be one of the values below.
| ||||||||||||||||
[in] | dwAttributes | Additional key parameters. See the options in the DGenerateKey() function. This API automatically includes the BCHAIN_KEY flag, which is required for blockchain operations. | ||||||||||||||||
[in] | cszId | Name of the private key. | ||||||||||||||||
[in] | pcbData | Private key in the format specified in bFormat . The size of this buffer must be entered in dwDataLen . | ||||||||||||||||
[in] | dwDataLen | Buffer size pcbData . | ||||||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainPkExport | ( | HSESSIONCTX | hSession, |
BYTE | bFormat, | ||
BYTE | bVersion, | ||
BYTE | bCompressed, | ||
const char * | cszId, | ||
BYTE ** | ppbData, | ||
DWORD * | pdwDataLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Export a private key using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||
[in] | bFormat | Format of the key to be exported. Can be one of the values below.
| ||||||||||||||||
[in] | bVersion | Key version.
| ||||||||||||||||
[in] | bCompressed | 0 to export the key in uncompressed format and 1 for compressed format. | ||||||||||||||||
[in] | cszId | Name of the private key. | ||||||||||||||||
[out] | ppbData | Private key. The size of this buffer will be entered in pdwDataLen . This buffer must be released with the API DFree(). | ||||||||||||||||
[out] | pdwDataLen | Buffer size ppcbData . | ||||||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainGetPubKey | ( | HSESSIONCTX | hSession, |
BYTE | bType, | ||
const char * | cszId, | ||
BYTE * | pbData, | ||
DWORD * | pdwDataLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Recover a public key from a private key using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||
[in] | bType | Format of the public key to be exported. Can be one of the values below.
| ||||||||||||||||
[in] | cszId | Name of the private key. | ||||||||||||||||
[out] | pbData | Public key. Can be passed NULL to receive the expected size in pdwDataLen . The maximum size of this buffer is DN_BCHAIN_MAX_PBK_LEN. | ||||||||||||||||
[in,out] | pdwDataLen | Buffer size pcbData . It will contain, at the end of the call, the amount of data written to pcbData . | ||||||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainRecoverPbkFromSignature | ( | HSESSIONCTX | hSession, |
BYTE | bSigType, | ||
BYTE | bHashMode, | ||
const BYTE * | pbHash, | ||
DWORD | dwHashLen, | ||
const BYTE * | pbSig, | ||
DWORD | dwSigLen, | ||
DN_BCHAIN_PBK * | pPbk, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Retrieves a public key (PBK) from an ECDSA-type signature.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||
[in] | bSigType | Type of subscription to be generated. It can be one of the values below.
| ||||||||||||
[in] | bHashMode | Hash type.
| ||||||||||||
[in] | pbHash | Hash calculated according to bHashMode . | ||||||||||||
[in] | dwHashLen | Hash size entered in pbHash . | ||||||||||||
[in] | pbSig | Signature according to bSigType . | ||||||||||||
[in] | dwSigLen | Signature size entered in pbSig . | ||||||||||||
[out] | pPbk | Public key to be retrieved. Enter a structure of type DN_BCHAIN_PBK. | ||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainGetKeyInfo | ( | HSESSIONCTX | hSession, |
DWORD | dwReserved, | ||
const char * | cszId, | ||
void * | pvData, | ||
DWORD * | pdwDataLen ) |
#include <dinamo.h>
Retrieves the properties of a key using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. |
[in] | dwReserved | Reserved for future use (must be 0). |
[in] | cszId | Name of the private key. |
[out] | pvData | Key properties. Receives a structure DN_BCHAIN_KEY_INFO. NULL can be passed to receive the expected size in pdwDataLen . |
[in,out] | pdwDataLen | Buffer size pcbData . It will contain, at the end of the call, the amount of data written to pcbData . |
int AAP_API DBchainHashData | ( | HSESSIONCTX | hSession, |
BYTE | bMode, | ||
BYTE * | pbData, | ||
DWORD | dwDataLen, | ||
BYTE * | pbHash, | ||
DWORD * | pdwHashLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Calculates a hash using the blockchain module.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||
[in] | bMode | Hash type.
| ||||||||||||
[in] | pbData | Data to be processed. The size of this buffer must be entered in dwDataLen . Maximum size of DN_BCHAIN_MAX_HDATA_LEN. | ||||||||||||
[in] | dwDataLen | Buffer size pbData . | ||||||||||||
[out] | pbHash | Receives the calculated hash. Can be passed NULL to receive the expected size in pdwHashLen . | ||||||||||||
[in,out] | pdwHashLen | Buffer size pbHash . It will contain, at the end of the call, the amount of data written to pbHash . | ||||||||||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DBchainEd2X | ( | HSESSIONCTX | hSession, |
const char * | cszPk, | ||
const char * | cszTo, | ||
DWORD | dwAttr, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Converts an Edwards (Ed) key to Montgomery (x) format. Currently converts Ed25519 keys to X25519.
[in] | hSession | Context acquired through the DOpenSession() function. |
[in] | cszPk | Name of the private key in Edwards format that exists in the HSM. |
[in] | cszTo | Name of the private key in Montgomery format that will be created in the HSM. |
[in] | dwAttr | Key attributes. See dwAttr in DGenerateKey() for details on the key attributes. The attributes are added to the current attributes of the source key cszPk . |
[in] | dwReserved | Reserved for future use (must be 0). |