Exemplo de geração CSR no formato PKCS#10.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define HSM_IP "127.0.0.1"
#define HSM_USR "master"
#define HSM_PWD "12345678"
int main(void)
{
int nRet = 0;
char szPrivKeyName[] = "rsa";
char szSubject[] = "/CN=www.teste.com/O=teste/OU=engenharia";
if(nRet)
{
printf("DOpenSession : Failed! %d.\n", nRet);
goto clean;
}
szPrivKeyName,
0,
&hPrivKey);
if (nRet)
{
printf("DGenerateKey : Failed! %d.\n", nRet);
goto clean;
}
szPrivKeyName,
szSubject,
&dwCSRLen,
&pbCSR,
0);
if( nRet )
{
printf("DGeneratePKCS10CSR : Failed! %d.\n", nRet);
goto clean;
}
clean:
if( hSession )
{
}
if( pbCSR )
{
}
return nRet;
}
Application Programming Interface (API) do HSM Dinamo.
void * HSESSIONCTX
Definição dinamo.h:68
#define CORE_P10_CSR_VERSION1
Definição dinamo.h:1819
#define DEFAULT_PORT
Definição dinamo.h:1949
#define CACHE_BYPASS
Definição dinamo.h:589
#define SA_AUTH_NONE
Definição dinamo.h:594
unsigned char BYTE
Definição dinamo.h:45
#define LB_BYPASS
Definição dinamo.h:588
unsigned int DWORD
Definição dinamo.h:46
#define ENCRYPTED_CONN
Definição dinamo.h:585
#define ALG_RSA_2048
Definição dinamo.h:1086
#define P10_CSR_PEM
Definição dinamo.h:1823
#define SS_USR_PWD_EX
Definição dinamo.h:579
void * HKEYCTX
Definição dinamo.h:70
int AAP_API DGenerateKey(HSESSIONCTX hSession, char *szKeyId, int nAlgId, DWORD dwFlags, HKEYCTX *phKey)
int AAP_API DGeneratePKCS10CSR(HSESSIONCTX hSession, char *szPrivateKeyName, BYTE bVersion, char *szDN, DWORD dwOutType, DWORD *pdwCSRLen, BYTE **ppbCSR, DWORD dwParam)
int AAP_API DDestroyKey(HKEYCTX *phKey, DWORD dwFlags)
void AAP_API DFree(void *p)
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:3104
char szUserId[MAX_USR_LEN]
Definição dinamo.h:3105
DWORD dwAuthType
Definição dinamo.h:3107
char szAddr[MAX_ADDR_LEN]
Definição dinamo.h:3103
char szPassword[MAX_USR_PWD]
Definição dinamo.h:3106
int nStrongAuthLen
Definição dinamo.h:3113
BYTE * pbStrongAuth
Definição dinamo.h:3112