Example of a Child Key Derivation (CKD) operation.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HOST_ADDR "127.0.0.1"
#define USER_ID "master"
#define USER_PWD "12345678"
int main()
{
int nRet = 0;
char szId[] = "Chave_Teste";
DWORD pdwAddressLen =
sizeof(pbAddress);
if (nRet){
printf("Falha na funcao: DInitialize \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Bibliotecas inicializadas.\n");
if (nRet){
printf("Falha na funcao: DOpenSession \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Sessao com o Dinamo estabelecida.\n");
szId,
&ver,
sizeof(ver),
0);
if(nRet){
printf("Falha na funcao: DBchainCreateXPrv \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Chave Bip 32 criada com sucesso.\n");
ver,
szId,
szDest,
&pbKeyInfo,
0);
if(nRet){
printf("Falha na funcao: DBchainCreateBip32Ckd \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Child Key Derivation feita com sucesso.\n");
szId,
pbAddress,
&pdwAddressLen,
0);
if(nRet){
printf("Falha na funcao: DBchainGetAddress \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Endereco da chave Bchain recuperado com sucesso.\n");
if(nRet){
printf("Falha na funcao: DRemoveObj \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Chave Bchain removida do HSM.\n");
if(nRet){
printf("Falha na funcao: DRemoveObj \nCodigo de erro: %d\n", nRet);
goto clean;
}
printf("Child Key removida do HSM.\n");
clean:
if (hSession) {
printf("Sessao encerrada.\n");
}
printf("Bibliotecas finalizadas.\n");
return nRet;
}
Application Programming Interface (API) do HSM Dinamo.
void * HSESSIONCTX
Definição dinamo.h:68
#define DEFAULT_PORT
Definição dinamo.h:1949
#define DN_BCHAIN_VER_BTC_B32_WITVER
Definição dinamo.h:2148
#define DN_BCHAIN_SECURE_BIP32_INDEX_BASE
Definição dinamo.h:2122
unsigned char BYTE
Definição dinamo.h:45
unsigned int DWORD
Definição dinamo.h:46
#define ENCRYPTED_CONN
Definição dinamo.h:585
#define DN_BCHAIN_HRP_BTC_TEST_NET
Definição dinamo.h:2156
#define SS_USER_PWD
Definição dinamo.h:576
#define BCHAIN_KEY
Definição dinamo.h:1430
#define MAX_OBJ_ID_FQN_LEN
Definição dinamo.h:1714
#define DN_BCHAIN_VER_BIP32_TESTNET
Definição dinamo.h:3475
#define DN_BCHAIN_MAX_ADDR_LEN
Definição dinamo.h:2126
#define DN_BCHAIN_BIP32_XPRV
Definição dinamo.h:3470
#define DN_BCHAIN_AT_BTC_B32_PKH
Definição dinamo.h:2132
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 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 DRemoveObj(HSESSIONCTX hSession, char *szObjId)
int AAP_API DOpenSession(HSESSIONCTX *phSession, DWORD dwParam, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags)
int AAP_API DCloseSession(HSESSIONCTX *phSession, DWORD dwFlags)
int AAP_API DInitialize(DWORD dwReserved)
int nPort
Definição dinamo.h:3092
char szUserId[MAX_USR_LEN]
Definição dinamo.h:3093
char szAddr[MAX_ADDR_LEN]
Definição dinamo.h:3091
char szPassword[MAX_USR_PWD]
Definição dinamo.h:3094