16#ifndef HITLS_APP_UTILS_H
17#define HITLS_APP_UTILS_H
22#include "crypt_eal_pkey.h"
24#include "app_provider.h"
26#include "hitls_csr_local.h"
27#include "bsl_pem_internal.h"
32#define APP_MAX_PASS_LENGTH 1024
33#define APP_MIN_PASS_LENGTH 1
34#define APP_FILE_MAX_SIZE_KB 256
35#define APP_FILE_MAX_SIZE (APP_FILE_MAX_SIZE_KB * 1024)
36#define APP_HEX_TO_BYTE 2
38#define APP_MAX_PATH_LEN PATH_MAX
40#define DEFAULT_SALTLEN 16
41#define DEFAULT_ITCNT 2048
43#define MAX_DIGEST_SIZE (1024 * 8)
58int32_t HITLS_APP_CheckPasswd(
const uint8_t *password,
const uint32_t passwordLen);
60int32_t HITLS_APP_Passwd(
char *buf, int32_t bufMaxLen, int32_t flag);
62void HITLS_APP_PrintPassErrlog(
void);
76int32_t HITLS_APP_ParsePasswd(
const char *passArg,
char **pass);
102CRYPT_EAL_PkeyCtx *HITLS_APP_LoadPubKey(
const char *inFilePath, BSL_ParseFormat informat);
120CRYPT_EAL_PkeyCtx *HITLS_APP_ProviderLoadPrvKey(CRYPT_EAL_LibCtx *libCtx,
const char *attrName,
121 const char *inFilePath, BSL_ParseFormat informat,
char **passin);
136CRYPT_EAL_PkeyCtx *HITLS_APP_LoadPrvKey(
const char *inFilePath, BSL_ParseFormat informat,
char **passin);
154int32_t HITLS_APP_PrintPubKey(
CRYPT_EAL_PkeyCtx *pkey,
const char *outFilePath, BSL_ParseFormat outformat);
175int32_t HITLS_APP_PrintPrvKey(
CRYPT_EAL_PkeyCtx *pkey,
const char *outFilePath, BSL_ParseFormat outformat,
176 int32_t cipherAlgCid,
char **passout);
180 BSL_ParseFormat outformat;
181 int32_t cipherAlgCid;
200int32_t HITLS_APP_GetAndCheckCipherOpt(
const char *name, int32_t *symId);
212HITLS_X509_Cert *HITLS_APP_LoadCert(
const char *inPath, BSL_ParseFormat inform);
224HITLS_X509_Csr *HITLS_APP_LoadCsr(
const char *inPath, BSL_ParseFormat inform);
236HITLS_X509_Crl *HITLS_APP_LoadCrl(
const char *inPath, BSL_ParseFormat inform);
238int32_t HITLS_APP_GetAndCheckHashOpt(
const char *name, int32_t *hashId);
240int32_t HITLS_APP_PrintText(
const BSL_Buffer *csrBuf,
const char *outFileName);
259int32_t HITLS_APP_ParseHex(
const char *hexStr,
bool expectPrefix, uint8_t **bytes, uint32_t *bytesLen);
278int32_t HITLS_APP_HexToBytes(
const char *hexStr, uint8_t *bytes, uint32_t *bytesLen);
280int32_t HITLS_APP_ReadData(
const char *path, BSL_PEM_Symbol *symbol,
char *fileName,
BSL_Buffer *data);
301int32_t HITLS_APP_ReadFileOrStdin(uint8_t **buf, uint64_t *bufLen,
const char *inFile,
302 uint32_t maxSize,
const char *module);
307#ifdef HITLS_APP_SM_MODE
308 HITLS_APP_SM_Param *smParam;
316int32_t HITLS_APP_GetTime(int64_t *time);
struct UIO_ControlBlock BSL_UIO
UIO module control structure
定义 bsl_uio.h:37
struct EAL_PkeyCtx CRYPT_EAL_PkeyCtx
定义 crypt_eal_pkey.h:108
BSL_UI read pwd parameters
定义 bsl_ui.h:71