API参考
载入中...
搜索中...
未找到
Hitls_cert

TLS Certificate Operation Interface 更多...

Hitls_cert 的协作图:

宏定义

#define HITLS_CFG_SetVerifyDepth(config, depth)
 Set the certificate verification depth.
#define HITLS_CFG_GetVerifyDepth(config, depth)
 Obtain the certificate verification depth.
#define HITLS_SetVerifyDepth(ctx, depth)
 Set the certificate verification depth.
#define HITLS_GetVerifyDepth(ctx, depth)
 Obtain the certificate verification depth.
#define HITLS_CFG_SetVerifyFlags(config, verifyFlags)
 Set the certificate verification flags.
#define HITLS_CFG_GetVerifyFlags(config, verifyFlags)
 Get the certificate verification flags.
#define HITLS_SetVerifyFlags(ctx, verifyFlags)
 Set the certificate verification flags.
#define HITLS_GetVerifyFlags(ctx, verifyFlags)
 Get the certificate verification flags.

类型定义

typedef int32_t(* HITLS_PasswordCb) (char *buf, int32_t bufLen, int32_t flag, void *userdata)
 Password Callback
typedef int32_t(* HITLS_CertCb) (HITLS_Ctx *ctx, void *arg)
 Process the certificate callback.
typedef void(* HITLS_KeyLogCb) (HITLS_Ctx *ctx, const char *line)
 Key logging callback

函数

int32_t HITLS_CFG_SetVerifyStore (HITLS_Config *config, HITLS_CERT_Store *store, bool isClone)
 Set the verify store used by the TLS configuration, which is used for certificate verification.
HITLS_CERT_StoreHITLS_CFG_GetVerifyStore (const HITLS_Config *config)
 Obtain the verify store used by the TLS configuration.
int32_t HITLS_SetVerifyStore (HITLS_Ctx *ctx, HITLS_CERT_Store *store, bool isClone)
 Set the verify store used by the TLS link for certificate verification.
HITLS_CERT_StoreHITLS_GetVerifyStore (const HITLS_Ctx *ctx)
 Obtain the verify store used by the TLS link.
int32_t HITLS_CFG_SetChainStore (HITLS_Config *config, HITLS_CERT_Store *store, bool isClone)
 Set the chain store used by the TLS configuration, which is used to construct the certificate chain.
HITLS_CERT_StoreHITLS_CFG_GetChainStore (const HITLS_Config *config)
 Obtain the chain store used by the TLS configuration.
int32_t HITLS_SetChainStore (HITLS_Ctx *ctx, HITLS_CERT_Store *store, bool isClone)
 Set the chain store used by the TLS link to construct the certificate chain.
HITLS_CERT_StoreHITLS_GetChainStore (const HITLS_Ctx *ctx)
 Obtain the chain store used by the TLS link.
int32_t HITLS_CFG_SetCertStore (HITLS_Config *config, HITLS_CERT_Store *store, bool isClone)
 Set the cert store used by the TLS configuration.
HITLS_CERT_StoreHITLS_CFG_GetCertStore (const HITLS_Config *config)
 Obtain the cert store used by the TLS configuration.
int32_t HITLS_SetCertStore (HITLS_Ctx *ctx, HITLS_CERT_Store *store, bool isClone)
 Set the cert store used by the TLS link.
HITLS_CERT_StoreHITLS_GetCertStore (const HITLS_Ctx *ctx)
 Obtain the cert store used by the TLS link.
int32_t HITLS_CFG_SetDefaultPasswordCb (HITLS_Config *config, HITLS_PasswordCb cb)
 Set the default password callback, cb can be NULL.
HITLS_PasswordCb HITLS_CFG_GetDefaultPasswordCb (HITLS_Config *config)
 Callback for obtaining the default password.
int32_t HITLS_CFG_SetDefaultPasswordCbUserdata (HITLS_Config *config, void *userdata)
 Set the user data used by the password callback.
void * HITLS_CFG_GetDefaultPasswordCbUserdata (HITLS_Config *config)
 Obtain the user data used by the password callback.
int32_t HITLS_SetDefaultPasswordCb (HITLS_Ctx *ctx, HITLS_PasswordCb cb)
 Set the default password callback, cb can be NULL
HITLS_PasswordCb HITLS_GetDefaultPasswordCb (HITLS_Ctx *ctx)
 Callback for obtaining the default password
int32_t HITLS_SetDefaultPasswordCbUserdata (HITLS_Ctx *ctx, void *userdata)
 Set the user data used by the default password callback.
void * HITLS_GetDefaultPasswordCbUserdata (HITLS_Ctx *ctx)
 Obtain the user data used by the default password callback.
int32_t HITLS_CFG_SetTlcpCertificate (HITLS_Config *config, HITLS_CERT_X509 *cert, bool isClone, bool isTlcpEncCert)
 Add the device certificate by the ShangMi(SM) cipher suites. Only one certificate can be added for each type.
int32_t HITLS_CFG_SetTlcpPrivateKey (HITLS_Config *config, HITLS_CERT_Key *privateKey, bool isClone, bool isTlcpEncCertPriKey)
 Add the private key of the device certificate by the ShangMi(SM) cipher suites. Only one private key can be added for each type of certificate.
int32_t HITLS_CFG_SetCertificate (HITLS_Config *config, HITLS_CERT_X509 *cert, bool isClone)
 Add a device certificate. Only one certificate of each type can be added
int32_t HITLS_CFG_LoadCertFile (HITLS_Config *config, const char *file, HITLS_ParseFormat format)
 Load the device certificate from the file.
int32_t HITLS_CFG_LoadCertBuffer (HITLS_Config *config, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Read the device certificate from the buffer.
HITLS_CERT_X509HITLS_CFG_GetCertificate (const HITLS_Config *config)
 Obtain the device certificate in use.
int32_t HITLS_SetCertificate (HITLS_Ctx *ctx, HITLS_CERT_X509 *cert, bool isClone)
 Add a device certificate. Only one certificate can be added for each type.
int32_t HITLS_LoadCertFile (HITLS_Ctx *ctx, const char *file, HITLS_ParseFormat format)
 Use a file to set the device certificate.
int32_t HITLS_LoadCertBuffer (HITLS_Ctx *ctx, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Read the device certificate from the buffer.
HITLS_CERT_X509HITLS_GetCertificate (const HITLS_Ctx *ctx)
 Obtain the local certificate. Returns the most recently added certificate if it is called before the certificate is selected. If no certificate is added, NULL is returned. It returns the certificate selected during the handshake if a certificate selection occurs, or NULL if no certificate is selected (e.g. on a client that does not use a client certificate).
HITLS_CERT_X509HITLS_GetPeerCertificate (const HITLS_Ctx *ctx)
 Obtain the peer certificate.
int32_t HITLS_CFG_SetPrivateKey (HITLS_Config *config, HITLS_CERT_Key *privateKey, bool isClone)
 Add the private key of the device certificate. Only one private key can be added for each type of certificate.
int32_t HITLS_CFG_LoadKeyFile (HITLS_Config *config, const char *file, HITLS_ParseFormat format)
 Load the private key of the device certificate from the file.
int32_t HITLS_CFG_ProviderLoadKeyFile (HITLS_Config *config, const char *file, const char *format, const char *type)
 Load the private key of the device certificate from the file, when the provider is used.
int32_t HITLS_CFG_LoadKeyBuffer (HITLS_Config *config, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Read the private key of the device certificate from the buffer.
int32_t HITLS_CFG_ProviderLoadKeyBuffer (HITLS_Config *config, const uint8_t *buf, uint32_t bufLen, const char *format, const char *type)
 Load the private key of the device certificate from the buffer, when the provider is used.
HITLS_CERT_KeyHITLS_CFG_GetPrivateKey (HITLS_Config *config)
 Obtain the private key of the certificate in use.
int32_t HITLS_CFG_CheckPrivateKey (HITLS_Config *config)
 Check whether the configured certificate matches the private key.
int32_t HITLS_SetPrivateKey (HITLS_Ctx *ctx, HITLS_CERT_Key *key, bool isClone)
 Add the private key of the device certificate. Only one private key can be added for each type of certificate.
int32_t HITLS_LoadKeyFile (HITLS_Ctx *ctx, const char *file, HITLS_ParseFormat format)
 Use the file to set the device private key.
int32_t HITLS_ProviderLoadKeyFile (HITLS_Ctx *ctx, const char *file, const char *format, const char *type)
 Load the private key of the device certificate from the file, when the provider is used.
int32_t HITLS_LoadKeyBuffer (HITLS_Ctx *ctx, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Read the private key of the device certificate from the buffer.
int32_t HITLS_ProviderLoadKeyBuffer (HITLS_Ctx *ctx, const uint8_t *buf, uint32_t bufLen, const char *format, const char *type)
 Load the private key of the device certificate from the buffer, when the provider is used.
HITLS_CERT_KeyHITLS_GetPrivateKey (HITLS_Ctx *ctx)
 Obtain the private key of the certificate in use.
int32_t HITLS_CheckPrivateKey (HITLS_Ctx *ctx)
 Check whether the configured certificate matches the private key.
int32_t HITLS_CFG_AddChainCert (HITLS_Config *config, HITLS_CERT_X509 *cert, bool isClone)
 Add the certificate to the certificate chain that is being used by the current config.
int32_t HITLS_CFG_AddCertToStore (HITLS_Config *config, HITLS_CERT_X509 *cert, HITLS_CERT_StoreType storeType, bool isClone)
 Add the certificate to the certificate store that is being used by the current config.
HITLS_CERT_X509HITLS_CFG_ParseCert (HITLS_Config *config, const uint8_t *buf, uint32_t len, HITLS_ParseType type, HITLS_ParseFormat format)
 Parse Certificate file or buffer to X509.
HITLS_CERT_KeyHITLS_CFG_ParseKey (HITLS_Config *config, const uint8_t *buf, uint32_t len, HITLS_ParseType type, HITLS_ParseFormat format)
 Parse Certificate file or buffer to X509.
HITLS_CERT_KeyHITLS_CFG_ProviderParseKey (HITLS_Config *config, const uint8_t *buf, uint32_t len, HITLS_ParseType type, const char *format, const char *encodeType)
 Parse Certificate file or buffer to X509.
HITLS_CERT_ChainHITLS_CFG_GetChainCerts (HITLS_Config *config)
 Obtain the certificate chain that is being used by the current config.
int32_t HITLS_CFG_ClearChainCerts (HITLS_Config *config)
 Clear the certificate chain associated with the current certificate.
int32_t HITLS_ClearChainCerts (HITLS_Ctx *ctx)
 Clear the certificate in the current certificate.
int32_t HITLS_CFG_RemoveCertAndKey (HITLS_Config *config)
 Release all loaded certificates and private keys.
int32_t HITLS_RemoveCertAndKey (HITLS_Ctx *ctx)
 Release all loaded certificates and private keys.
int32_t HITLS_CFG_SetVerifyCb (HITLS_Config *config, HITLS_VerifyCb callback)
 Set the certificate verification callback function, cb can be NULL.
HITLS_VerifyCb HITLS_CFG_GetVerifyCb (HITLS_Config *config)
 Obtain the certificate verification callback function.
int32_t HITLS_SetVerifyCb (HITLS_Ctx *ctx, HITLS_VerifyCb callback)
 Set the certificate verification callback function, cb can be NULL.
HITLS_VerifyCb HITLS_GetVerifyCb (HITLS_Ctx *ctx)
 Obtain the certificate verification callback function.
int32_t HITLS_SetVerifyResult (HITLS_Ctx *ctx, HITLS_ERROR verifyResult)
 Set the peer certificate verification result of the current context.
int32_t HITLS_GetVerifyResult (const HITLS_Ctx *ctx, HITLS_ERROR *verifyResult)
 Return the peer certificate verification result of the current context.
HITLS_CERT_ChainHITLS_GetPeerCertChain (const HITLS_Ctx *ctx)
 Obtain the peer certificate chain.
HITLS_TrustedCAListHITLS_GetPeerCAList (const HITLS_Ctx *ctx)
 Obtain the trusted CA list of the peer end.
HITLS_TrustedCAListHITLS_GetCAList (const HITLS_Ctx *ctx)
 Obtain the trusted CA list of the current context.
int32_t HITLS_SetCAList (HITLS_Ctx *ctx, HITLS_TrustedCAList *list)
 Set the trusted CA list of the current context.
int32_t HITLS_CFG_AddExtraChainCert (HITLS_Config *config, HITLS_CERT_X509 *cert)
 Add a certificate to the attached certificate chain.
HITLS_CERT_ChainHITLS_CFG_GetExtraChainCerts (HITLS_Config *config)
 Obtain the attached certificate chain.
int32_t HITLS_CFG_ClearExtraChainCerts (HITLS_Config *config)
 Release the attached certificate chain.
int32_t HITLS_CFG_SetCurrentCert (HITLS_Config *config, long option)
 Set the current certificate to the value based on the option parameter.
int32_t HITLS_SetCurrentCert (HITLS_Ctx *ctx, long option)
 Set the current certificate to the value based on the option parameter.
int32_t HITLS_CFG_SetCertCb (HITLS_Config *config, HITLS_CertCb certCb, void *arg)
 Sets the processing certificate callback function, which checks the passed ctx structure and sets or clears any appropriate certificate, cb can be NULL.
int32_t HITLS_SetCertCb (HITLS_Ctx *ctx, HITLS_CertCb certCb, void *arg)
 Set the certificate processing callback function. The callback can check the passed ctx structure and set or clear any appropriate certificate, cb can be NULL.
int32_t HITLS_CFG_SetKeyLogCb (HITLS_Config *config, HITLS_KeyLogCb callback)
 Sets the callback for recording TLS keys.
HITLS_KeyLogCb HITLS_CFG_GetKeyLogCb (HITLS_Config *config)
 Callback for obtaining TLS key logs
int32_t HITLS_LogSecret (HITLS_Ctx *ctx, const char *label, const uint8_t *secret, size_t secretLen)
 If logging is enabled, the master key is logged
int32_t HITLS_CFG_ParseCAList (HITLS_Config *config, const char *input, uint32_t inputLen, HITLS_ParseType inputType, HITLS_ParseFormat format, HITLS_TrustedCAList **caList)
 Load the CA file and parse it into a trusted CA list.
int32_t HITLS_CFG_BuildCertChain (HITLS_Config *config, HITLS_BUILD_CHAIN_FLAG flag)
 Before establishing a TLS connection, try to form a certificate chain as much as possible according to the flag.
int32_t HITLS_BuildCertChain (HITLS_Ctx *ctx, HITLS_BUILD_CHAIN_FLAG flag)
 Before establishing a TLS connection, try to form a certificate chain as much as possible according to the flag.
int32_t HITLS_CFG_CtrlSetVerifyParams (HITLS_Config *config, HITLS_CERT_Store *store, uint32_t cmd, int64_t in, void *inArg)
 Set certificate verification parameters.
int32_t HITLS_CFG_CtrlGetVerifyParams (HITLS_Config *config, HITLS_CERT_Store *store, uint32_t cmd, void *out)
 Get certificate verification parameters
int32_t HITLS_CtrlSetVerifyParams (HITLS_Ctx *ctx, HITLS_CERT_Store *store, uint32_t cmd, int64_t in, void *inArg)
 Set certificate verification parameters.
int32_t HITLS_CtrlGetVerifyParams (HITLS_Ctx *ctx, HITLS_CERT_Store *store, uint32_t cmd, void *out)
 Get certificate verification parameters.
int32_t HITLS_CFG_LoadCrlFile (HITLS_Config *config, const char *file, HITLS_ParseFormat format)
 Load CRL from file and add it into the verify store of the TLS configuration.
int32_t HITLS_CFG_LoadCrlBuffer (HITLS_Config *config, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Load CRL from buffer and add it into the verify store of the TLS configuration.
int32_t HITLS_CFG_ClearVerifyCrls (HITLS_Config *config)
 Clear all CRLs in the verify store of the configuration.
int32_t HITLS_LoadCrlFile (HITLS_Ctx *ctx, const char *file, HITLS_ParseFormat format)
 Load CRL from file and add it into the verify store of the TLS context.
int32_t HITLS_LoadCrlBuffer (HITLS_Ctx *ctx, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Load CRL from buffer and add it into the verify store of the TLS context.
int32_t HITLS_ClearVerifyCrls (HITLS_Ctx *ctx)
 Clear all CRLs in the verify store of the context.
int32_t HITLS_CFG_FreeCert (HITLS_Config *config, HITLS_CERT_X509 *cert)
 Release the certificate.
int32_t HITLS_CFG_FreeKey (HITLS_Config *config, HITLS_CERT_Key *key)
 Release the key.
int32_t HITLS_UseCertificateChainFile (HITLS_Ctx *ctx, const char *file)
 Use the certificate chain file to set the certificate chain.
int32_t HITLS_CFG_UseCertificateChainFile (HITLS_Config *config, const char *file)
 Use the certificate chain file to set the certificate chain.
int32_t HITLS_CFG_UseCertificateChainBuffer (HITLS_Config *config, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Use the certificate chain buffer to set the certificate chain.
int32_t HITLS_UseCertificateChainBuffer (HITLS_Ctx *ctx, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Use the certificate chain buffer to set the certificate chain.
int32_t HITLS_CFG_LoadVerifyFile (HITLS_Config *config, const char *file)
 Load the verification file from the file.
int32_t HITLS_CFG_LoadVerifyBuffer (HITLS_Config *config, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Load the verification certificates from buffer.
int32_t HITLS_LoadVerifyBuffer (HITLS_Ctx *ctx, const uint8_t *buf, uint32_t bufLen, HITLS_ParseFormat format)
 Load the verification certificates from buffer.
int32_t HITLS_CFG_LoadVerifyDir (HITLS_Config *config, const char *path)
 Load the verification file from the directory.

详细描述

TLS Certificate Operation Interface

宏定义说明

◆ HITLS_CFG_GetVerifyDepth

#define HITLS_CFG_GetVerifyDepth ( config,
depth )
值:
@ CERT_STORE_CTRL_GET_VERIFY_DEPTH
定义 hitls_cert_type.h:88
int32_t HITLS_CFG_CtrlGetVerifyParams(HITLS_Config *config, HITLS_CERT_Store *store, uint32_t cmd, void *out)
Get certificate verification parameters
定义 config_cert.c:1070
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41

Obtain the certificate verification depth.

参数
config[IN] TLS link configuration
depth[OUT] Certificate verification depth, type: int32_t *
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_GetVerifyFlags

#define HITLS_CFG_GetVerifyFlags ( config,
verifyFlags )
值:
@ CERT_STORE_CTRL_GET_VERIFY_FLAGS
定义 hitls_cert_type.h:93

Get the certificate verification flags.

参数
config[IN] TLS link configuration
flags[IN] Verification flag, type : uint32_t *.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetVerifyDepth

#define HITLS_CFG_SetVerifyDepth ( config,
depth )
值:
@ CERT_STORE_CTRL_SET_VERIFY_DEPTH
定义 hitls_cert_type.h:86
int32_t HITLS_CFG_CtrlSetVerifyParams(HITLS_Config *config, HITLS_CERT_Store *store, uint32_t cmd, int64_t in, void *inArg)
Set certificate verification parameters.
定义 config_cert.c:1058

Set the certificate verification depth.

参数
config[OUT] TLS link configuration
depth[IN] Verification depth, type: uint32_t
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetVerifyFlags

#define HITLS_CFG_SetVerifyFlags ( config,
verifyFlags )
值:
NULL, CERT_STORE_CTRL_SET_VERIFY_FLAGS, verifyFlags, NULL)
@ CERT_STORE_CTRL_SET_VERIFY_FLAGS
定义 hitls_cert_type.h:92

Set the certificate verification flags.

参数
config[IN] TLS link configuration
flags[IN] Verification flag, type : uint32_t.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_GetVerifyDepth

#define HITLS_GetVerifyDepth ( ctx,
depth )
值:
int32_t HITLS_CtrlGetVerifyParams(HITLS_Ctx *ctx, HITLS_CERT_Store *store, uint32_t cmd, void *out)
Get certificate verification parameters.
定义 conn_create.c:927

Obtain the certificate verification depth.

参数
ctx[IN] TLS link object
depth[OUT] Certificate verification depth, type: int32_t *
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_GetVerifyFlags

#define HITLS_GetVerifyFlags ( ctx,
verifyFlags )
值:

Get the certificate verification flags.

参数
ctx[IN] TLS link object
flags[IN] Verification flag, type : uint32_t *.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetVerifyDepth

#define HITLS_SetVerifyDepth ( ctx,
depth )
值:
int32_t HITLS_CtrlSetVerifyParams(HITLS_Ctx *ctx, HITLS_CERT_Store *store, uint32_t cmd, int64_t in, void *inArg)
Set certificate verification parameters.
定义 conn_create.c:918

Set the certificate verification depth.

参数
ctx[OUT] TLS link object
depth[IN] Verification depth, type: uint32_t
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetVerifyFlags

#define HITLS_SetVerifyFlags ( ctx,
verifyFlags )
值:

Set the certificate verification flags.

参数
ctx[IN] TLS link object
flags[IN] Verification flag, type : uint32_t.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

类型定义说明

◆ HITLS_CertCb

typedef int32_t(* HITLS_CertCb) (HITLS_Ctx *ctx, void *arg)

Process the certificate callback.

注意
This callback function is compatible with OpenSSL and has the same logic as OpenSSL.
参数
ctx[IN] TLS link object
arg[IN] Related parameters arg
返回
HITLS_CERT_CALLBACK_SUCCESS if the callback is successfully executed. HITLS_CERT_CALLBACK_FAILED if the callback fails. HITLS_CERT_CALLBACK_RETRY if the callback is suspended.

◆ HITLS_KeyLogCb

typedef void(* HITLS_KeyLogCb) (HITLS_Ctx *ctx, const char *line)

Key logging callback

参数
ctx[OUT] TLS Link object
line[IN] Content to be recorded

◆ HITLS_PasswordCb

typedef int32_t(* HITLS_PasswordCb) (char *buf, int32_t bufLen, int32_t flag, void *userdata)

Password Callback

参数
buf[OUT] Passwd data.
bufLen[IN] Maximum buffer length.
flag[IN] r/w flag. The value 0 indicates read, and the value 1 indicates write.
userdata[IN] User data.
返回
Passwd Data length

函数说明

◆ HITLS_BuildCertChain()

int32_t HITLS_BuildCertChain ( HITLS_Ctx * ctx,
HITLS_BUILD_CHAIN_FLAG flag )

Before establishing a TLS connection, try to form a certificate chain as much as possible according to the flag.

参数
ctx[OUT] TLS link configuration
flag[IN] Control how to group certificate chains based on flags, see HITLS_BUILD_CHAIN_FLAG.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_AddCertToStore()

int32_t HITLS_CFG_AddCertToStore ( HITLS_Config * config,
HITLS_CERT_X509 * cert,
HITLS_CERT_StoreType storeType,
bool isClone )

Add the certificate to the certificate store that is being used by the current config.

参数
config[IN] TLS link configuration
cert[IN] Certificate to be added
storeType[IN] Indicates which store to add cert.
isClone[IN] Indicates whether deep copy is required. The options are true and false.
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_AddChainCert()

int32_t HITLS_CFG_AddChainCert ( HITLS_Config * config,
HITLS_CERT_X509 * cert,
bool isClone )

Add the certificate to the certificate chain that is being used by the current config.

参数
config[IN] TLS link configuration
cert[IN] Certificate to be added
isClone[IN] Indicates whether deep copy is required. The options are true and false.
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_AddExtraChainCert()

int32_t HITLS_CFG_AddExtraChainCert ( HITLS_Config * config,
HITLS_CERT_X509 * cert )

Add a certificate to the attached certificate chain.

参数
config[OUT] Config handle
cert[IN] X509 certificate
返回
0 indicates success. Other values indicate failure.

◆ HITLS_CFG_BuildCertChain()

int32_t HITLS_CFG_BuildCertChain ( HITLS_Config * config,
HITLS_BUILD_CHAIN_FLAG flag )

Before establishing a TLS connection, try to form a certificate chain as much as possible according to the flag.

参数
config[OUT] TLS link configuration
flag[IN] Control how to group certificate chains based on flags, see HITLS_BUILD_CHAIN_FLAG.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_CheckPrivateKey()

int32_t HITLS_CFG_CheckPrivateKey ( HITLS_Config * config)

Check whether the configured certificate matches the private key.

参数
config[IN] TLS link configuration
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_ClearChainCerts()

int32_t HITLS_CFG_ClearChainCerts ( HITLS_Config * config)

Clear the certificate chain associated with the current certificate.

参数
config[IN] TLS link configuration
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_ClearExtraChainCerts()

int32_t HITLS_CFG_ClearExtraChainCerts ( HITLS_Config * config)

Release the attached certificate chain.

参数
config[IN] TLS link configuration
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_ClearVerifyCrls()

int32_t HITLS_CFG_ClearVerifyCrls ( HITLS_Config * config)

Clear all CRLs in the verify store of the configuration.

参数
config[IN] TLS link configuration
返回值
HITLS_SUCCESSif successful
Forother error codes, see hitls_error.h

◆ HITLS_CFG_CtrlGetVerifyParams()

int32_t HITLS_CFG_CtrlGetVerifyParams ( HITLS_Config * config,
HITLS_CERT_Store * store,
uint32_t cmd,
void * out )

Get certificate verification parameters

参数
config[IN] TLS link configuration
store[IN] Certificate store
cmd[IN] Operation command, HITLS_CERT_CtrlCmd enum
out[OUT] Output parameter
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_CtrlSetVerifyParams()

int32_t HITLS_CFG_CtrlSetVerifyParams ( HITLS_Config * config,
HITLS_CERT_Store * store,
uint32_t cmd,
int64_t in,
void * inArg )

Set certificate verification parameters.

参数
config[OUT] TLS link configuration
store[IN] Certificate store
cmd[IN] Operation command, HITLS_CERT_CtrlCmd enum
in[IN] Input parameter, integer type
inArg[IN] Input parameter, pointer type
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_FreeCert()

int32_t HITLS_CFG_FreeCert ( HITLS_Config * config,
HITLS_CERT_X509 * cert )

Release the certificate.

参数
config[IN] Config handle
cert[IN] X509 certificate
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_FreeKey()

int32_t HITLS_CFG_FreeKey ( HITLS_Config * config,
HITLS_CERT_Key * key )

Release the key.

参数
config[IN] Config handle
key[IN] private key
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_GetCertificate()

HITLS_CERT_X509 * HITLS_CFG_GetCertificate ( const HITLS_Config * config)

Obtain the device certificate in use.

注意
The user cannot release the memory.
参数
config[IN] TLS link configuration
返回
Device certificate

◆ HITLS_CFG_GetCertStore()

HITLS_CERT_Store * HITLS_CFG_GetCertStore ( const HITLS_Config * config)

Obtain the cert store used by the TLS configuration.

注意
The user cannot release the memory.
参数
config[IN] TLS link configuration
返回
Cert store

◆ HITLS_CFG_GetChainCerts()

HITLS_CERT_Chain * HITLS_CFG_GetChainCerts ( HITLS_Config * config)

Obtain the certificate chain that is being used by the current config.

参数
config[IN] TLS link configuration
返回
The certificate chain that is currently in use

◆ HITLS_CFG_GetChainStore()

HITLS_CERT_Store * HITLS_CFG_GetChainStore ( const HITLS_Config * config)

Obtain the chain store used by the TLS configuration.

注意
The user cannot release the memory.
参数
config[IN] TLS link configuration
返回
Chain store

◆ HITLS_CFG_GetDefaultPasswordCb()

HITLS_PasswordCb HITLS_CFG_GetDefaultPasswordCb ( HITLS_Config * config)

Callback for obtaining the default password.

参数
config[IN] TLS link configuration.
返回
Password Callback.

◆ HITLS_CFG_GetDefaultPasswordCbUserdata()

void * HITLS_CFG_GetDefaultPasswordCbUserdata ( HITLS_Config * config)

Obtain the user data used by the password callback.

参数
config[IN] TLS link configuration
返回
User Data

◆ HITLS_CFG_GetExtraChainCerts()

HITLS_CERT_Chain * HITLS_CFG_GetExtraChainCerts ( HITLS_Config * config)

Obtain the attached certificate chain.

参数
config[IN] Config handle
返回
Attach the certificate chain.

◆ HITLS_CFG_GetKeyLogCb()

HITLS_KeyLogCb HITLS_CFG_GetKeyLogCb ( HITLS_Config * config)

Callback for obtaining TLS key logs

参数
config[OUT] TLS Link Configuration
返回值
Callbackfunction for recording key logs

◆ HITLS_CFG_GetPrivateKey()

HITLS_CERT_Key * HITLS_CFG_GetPrivateKey ( HITLS_Config * config)

Obtain the private key of the certificate in use.

注意
The user cannot release the memory.
参数
config[IN] TLS link configuration
返回
Certificate private key

◆ HITLS_CFG_GetVerifyCb()

HITLS_VerifyCb HITLS_CFG_GetVerifyCb ( HITLS_Config * config)

Obtain the certificate verification callback function.

参数
config[OUT] TLS link configuration
返回
Certificate verification callback function

◆ HITLS_CFG_GetVerifyStore()

HITLS_CERT_Store * HITLS_CFG_GetVerifyStore ( const HITLS_Config * config)

Obtain the verify store used by the TLS configuration.

注意
The user cannot release the memory.
参数
config[IN] TLS link configuration
返回
Verify store

◆ HITLS_CFG_LoadCertBuffer()

int32_t HITLS_CFG_LoadCertBuffer ( HITLS_Config * config,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Read the device certificate from the buffer.

参数
config[OUT] TLS link configuration
buf[IN] Certificate data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
bufLen[IN] Data length the bufLen should exclude the end '\0'
format[IN] Data format
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_LoadCertFile()

int32_t HITLS_CFG_LoadCertFile ( HITLS_Config * config,
const char * file,
HITLS_ParseFormat format )

Load the device certificate from the file.

参数
config[OUT] TLS link configuration
file[IN] File name
type[IN] File format
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_LoadCrlBuffer()

int32_t HITLS_CFG_LoadCrlBuffer ( HITLS_Config * config,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Load CRL from buffer and add it into the verify store of the TLS configuration.

参数
config[OUT] TLS link configuration
buf[IN] CRL data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buff of encode needs to end with '\0'
bufLen[IN] Data length the bufLen should exclude the end '\0'
format[IN] Data format, see HITLS_ParseFormat
返回值
HITLS_SUCCESSif successful
Forother error codes, see hitls_error.h

◆ HITLS_CFG_LoadCrlFile()

int32_t HITLS_CFG_LoadCrlFile ( HITLS_Config * config,
const char * file,
HITLS_ParseFormat format )

Load CRL from file and add it into the verify store of the TLS configuration.

参数
config[OUT] TLS link configuration
file[IN] CRL file path
format[IN] Data format, see HITLS_ParseFormat
返回值
HITLS_SUCCESSif successful
Forother error codes, see hitls_error.h

◆ HITLS_CFG_LoadKeyBuffer()

int32_t HITLS_CFG_LoadKeyBuffer ( HITLS_Config * config,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Read the private key of the device certificate from the buffer.

参数
config[OUT] TLS link configuration
buf[IN] Private key data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buff of encode needs to end with '\0'
bufLen[IN] Data length the bufLen should exclude the end '\0'
format[IN] Data format
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_LoadKeyFile()

int32_t HITLS_CFG_LoadKeyFile ( HITLS_Config * config,
const char * file,
HITLS_ParseFormat format )

Load the private key of the device certificate from the file.

参数
config[OUT] TLS link configuration
file[IN] File name
format[IN] Data format
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_LoadVerifyBuffer()

int32_t HITLS_CFG_LoadVerifyBuffer ( HITLS_Config * config,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Load the verification certificates from buffer.

参数
config[OUT] TLS link configuration
buf[IN] Certificate buffer data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
bufLen[IN] Buffer length the bufLen should exclude the end '\0'
format[IN] Certificate format (PEM/DER/ASN1)
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_LoadVerifyDir()

int32_t HITLS_CFG_LoadVerifyDir ( HITLS_Config * config,
const char * path )

Load the verification file from the directory.

参数
config[OUT] TLS link configuration
path[IN] Directory path
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_LoadVerifyFile()

int32_t HITLS_CFG_LoadVerifyFile ( HITLS_Config * config,
const char * file )

Load the verification file from the file.

参数
config[OUT] TLS link configuration
file[IN] File name
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_ParseCAList()

int32_t HITLS_CFG_ParseCAList ( HITLS_Config * config,
const char * input,
uint32_t inputLen,
HITLS_ParseType inputType,
HITLS_ParseFormat format,
HITLS_TrustedCAList ** caList )

Load the CA file and parse it into a trusted CA list.

注意
The user cannot release the memory.
参数
config[OUT] TLS link configuration
input[IN] Input data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the input needs to end with '\0'
inputLen[IN] Length of the input data the inputLen should exclude the end '\0'
inputType[IN] Type of the input data
format[IN] File format
caList[OUT] Trusted CA list
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_ParseCert()

HITLS_CERT_X509 * HITLS_CFG_ParseCert ( HITLS_Config * config,
const uint8_t * buf,
uint32_t len,
HITLS_ParseType type,
HITLS_ParseFormat format )

Parse Certificate file or buffer to X509.

参数
config[IN] TLS link configuration
buf[IN] Certificate file or buffer BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
len[IN] bufLen the len should exclude the end '\0'
type[IN] buf type: file or buffer
format[IN] cert type
返回
HITLS_CERT_X509

◆ HITLS_CFG_ParseKey()

HITLS_CERT_Key * HITLS_CFG_ParseKey ( HITLS_Config * config,
const uint8_t * buf,
uint32_t len,
HITLS_ParseType type,
HITLS_ParseFormat format )

Parse Certificate file or buffer to X509.

参数
config[IN] TLS link configuration
buf[IN] Certificate file or buffer BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buff of encode needs to end with '\0'
len[IN] bufLen the bufLen should exclude the end '\0'
type[IN] buf type: file or buffer
format[IN] cert type
返回
HITLS_CERT_X509

◆ HITLS_CFG_ProviderLoadKeyBuffer()

int32_t HITLS_CFG_ProviderLoadKeyBuffer ( HITLS_Config * config,
const uint8_t * buf,
uint32_t bufLen,
const char * format,
const char * type )

Load the private key of the device certificate from the buffer, when the provider is used.

参数
config[OUT] TLS link configuration
buf[IN] Private key data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buff of encode needs to end with '\0'
bufLen[IN] Data length the bufLen should exclude the end '\0'
format[IN] Data format
type[IN] Data type
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_ProviderLoadKeyFile()

int32_t HITLS_CFG_ProviderLoadKeyFile ( HITLS_Config * config,
const char * file,
const char * format,
const char * type )

Load the private key of the device certificate from the file, when the provider is used.

参数
config[OUT] TLS link configuration
file[IN] File name
format[IN] Data format. e.g. "PEM", "ASN1", etc.
type[IN] Data type. e.g. "PRIKEY_RSA", "PRIKEY_ECC", "PRIKEY_PKCS8_UNENCRYPT", "PRIKEY_PKCS8_ENCRYPT", etc.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_ProviderParseKey()

HITLS_CERT_Key * HITLS_CFG_ProviderParseKey ( HITLS_Config * config,
const uint8_t * buf,
uint32_t len,
HITLS_ParseType type,
const char * format,
const char * encodeType )

Parse Certificate file or buffer to X509.

参数
config[IN] TLS link configuration
buf[IN] Certificate file or buffer BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buff of encode needs to end with '\0'
len[IN] bufLen the bufLen should exclude the end '\0'
type[IN] buf type: file or buffer
format[IN] cert type
encodeType[IN] cert encode type
返回值
HITLS_CERT_X509

◆ HITLS_CFG_RemoveCertAndKey()

int32_t HITLS_CFG_RemoveCertAndKey ( HITLS_Config * config)

Release all loaded certificates and private keys.

参数
config[IN] TLS link configuration
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetCertCb()

int32_t HITLS_CFG_SetCertCb ( HITLS_Config * config,
HITLS_CertCb certCb,
void * arg )

Sets the processing certificate callback function, which checks the passed ctx structure and sets or clears any appropriate certificate, cb can be NULL.

参数
ctx[OUT] TLS link object
cert_cb[IN] Certificate verification callback function
arg[IN] Parameters required in the certificate verification callback function
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetCertificate()

int32_t HITLS_CFG_SetCertificate ( HITLS_Config * config,
HITLS_CERT_X509 * cert,
bool isClone )

Add a device certificate. Only one certificate of each type can be added

参数
config[OUT] TLS link configuration
cert[IN] Device certificate
isClone[IN] Indicates whether deep copy is required. The options are as follows: true: yes; false: no.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetCertStore()

int32_t HITLS_CFG_SetCertStore ( HITLS_Config * config,
HITLS_CERT_Store * store,
bool isClone )

Set the cert store used by the TLS configuration.

注意
If verify store is not set, use cert store to verify the certificate. If chain store is not set, use cert store to construct a certificate chain.
参数
config[OUT] TLS link configuration
store[IN] Trust certificate store
isClone[IN] Indicates whether deep copy is required. The options are true and false.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetChainStore()

int32_t HITLS_CFG_SetChainStore ( HITLS_Config * config,
HITLS_CERT_Store * store,
bool isClone )

Set the chain store used by the TLS configuration, which is used to construct the certificate chain.

参数
config[OUT] TLS link configuration
store[IN] Certificate chain store
isClone[IN] Indicates whether deep copy is required. The options are as follows: true: yes; false: no.
返回值
HITLS_SUCCESS.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetCurrentCert()

int32_t HITLS_CFG_SetCurrentCert ( HITLS_Config * config,
long option )

Set the current certificate to the value based on the option parameter.

参数
config[IN] Configuration
option[IN] Setting options, including HITLS_CERT_SET_FIRST, HITLS_CERT_SET_NEXT
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetDefaultPasswordCb()

int32_t HITLS_CFG_SetDefaultPasswordCb ( HITLS_Config * config,
HITLS_PasswordCb cb )

Set the default password callback, cb can be NULL.

参数
config[OUT] TLS link configuration
cb[IN] Password Callback
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetDefaultPasswordCbUserdata()

int32_t HITLS_CFG_SetDefaultPasswordCbUserdata ( HITLS_Config * config,
void * userdata )

Set the user data used by the password callback.

参数
config[OUT] TLS link configuration
userdata[IN] User data
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetKeyLogCb()

int32_t HITLS_CFG_SetKeyLogCb ( HITLS_Config * config,
HITLS_KeyLogCb callback )

Sets the callback for recording TLS keys.

参数
config[OUT] TLS Link Configuration
callback[IN] Callback function for recording keys
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetPrivateKey()

int32_t HITLS_CFG_SetPrivateKey ( HITLS_Config * config,
HITLS_CERT_Key * privateKey,
bool isClone )

Add the private key of the device certificate. Only one private key can be added for each type of certificate.

参数
config[OUT] TLS link configuration
privateKey[IN] Certificate private key
isClone[IN] Indicates whether deep copy is required. The options are as follows: true: yes; false: no.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetTlcpCertificate()

int32_t HITLS_CFG_SetTlcpCertificate ( HITLS_Config * config,
HITLS_CERT_X509 * cert,
bool isClone,
bool isTlcpEncCert )

Add the device certificate by the ShangMi(SM) cipher suites. Only one certificate can be added for each type.

参数
config[OUT] TLS link configuration
cert[IN] Device certificate
isClone[IN] Indicates whether deep copy is required. The options are as follows: true: yes; false: no.
isTlcpEncCert[IN] Indicates whether the certificate is encrypted by China. The options are as follows: true: yes; false: no.
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_SetTlcpPrivateKey()

int32_t HITLS_CFG_SetTlcpPrivateKey ( HITLS_Config * config,
HITLS_CERT_Key * privateKey,
bool isClone,
bool isTlcpEncCertPriKey )

Add the private key of the device certificate by the ShangMi(SM) cipher suites. Only one private key can be added for each type of certificate.

参数
config[OUT] TLS link configuration
privateKey[IN] Certificate private key
isClone[IN] Indicates whether deep copy is required. The options are as follows: true: yes; false: no.
isTlcpEncCertPriKey[IN] Indicates whether the private key of the encryption certificate is the private key of the encryption certificate. true: yes; false: no.
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_SetVerifyCb()

int32_t HITLS_CFG_SetVerifyCb ( HITLS_Config * config,
HITLS_VerifyCb callback )

Set the certificate verification callback function, cb can be NULL.

参数
config[OUT] TLS link configuration
callback[IN] Certificate verification callback function
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_SetVerifyStore()

int32_t HITLS_CFG_SetVerifyStore ( HITLS_Config * config,
HITLS_CERT_Store * store,
bool isClone )

Set the verify store used by the TLS configuration, which is used for certificate verification.

参数
config[OUT] TLS link configuration.
store[IN] CA certificate store.
isClone[IN] Indicates whether deep copy is required. true indicates need, false indicates not need.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CFG_UseCertificateChainBuffer()

int32_t HITLS_CFG_UseCertificateChainBuffer ( HITLS_Config * config,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Use the certificate chain buffer to set the certificate chain.

参数
config[OUT] TLS link configuration
buf[IN] Certificate chain buffer data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
bufLen[IN] Buffer length the bufLen should exclude the end '\0'
format[IN] Certificate format (PEM/DER/ASN1)
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CFG_UseCertificateChainFile()

int32_t HITLS_CFG_UseCertificateChainFile ( HITLS_Config * config,
const char * file )

Use the certificate chain file to set the certificate chain.

参数
config[OUT] TLS link configuration
file[IN] Certificate chain file name
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_CheckPrivateKey()

int32_t HITLS_CheckPrivateKey ( HITLS_Ctx * ctx)

Check whether the configured certificate matches the private key.

参数
ctx[IN] TLS link object
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_ClearChainCerts()

int32_t HITLS_ClearChainCerts ( HITLS_Ctx * ctx)

Clear the certificate in the current certificate.

参数
ctx[IN] hitls context
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_ClearVerifyCrls()

int32_t HITLS_ClearVerifyCrls ( HITLS_Ctx * ctx)

Clear all CRLs in the verify store of the context.

参数
ctx[IN] TLS link object
返回值
HITLS_SUCCESSif successful
Forother error codes, see hitls_error.h

◆ HITLS_CtrlGetVerifyParams()

int32_t HITLS_CtrlGetVerifyParams ( HITLS_Ctx * ctx,
HITLS_CERT_Store * store,
uint32_t cmd,
void * out )

Get certificate verification parameters.

参数
ctx[IN] TLS handle
store[IN] Certificate store
cmd[IN] Operation command, HITLS_CERT_CtrlCmd enum
out[OUT] Output parameter
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_CtrlSetVerifyParams()

int32_t HITLS_CtrlSetVerifyParams ( HITLS_Ctx * ctx,
HITLS_CERT_Store * store,
uint32_t cmd,
int64_t in,
void * inArg )

Set certificate verification parameters.

参数
ctx[OUT] TLS handle
store[IN] Certificate store
cmd[IN] Operation command, HITLS_CERT_CtrlCmd enum
in[IN] Input parameter, integer type
inArg[IN] Input parameter, pointer type
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_GetCAList()

HITLS_TrustedCAList * HITLS_GetCAList ( const HITLS_Ctx * ctx)

Obtain the trusted CA list of the current context.

参数
ctx[OUT] TLS connection handle
返回值
TrustedCA list

◆ HITLS_GetCertificate()

HITLS_CERT_X509 * HITLS_GetCertificate ( const HITLS_Ctx * ctx)

Obtain the local certificate. Returns the most recently added certificate if it is called before the certificate is selected. If no certificate is added, NULL is returned. It returns the certificate selected during the handshake if a certificate selection occurs, or NULL if no certificate is selected (e.g. on a client that does not use a client certificate).

注意
: Shallow copy, can be used only during the ctx life cycle, and the caller must not release the returned pointer.
参数
ctx[IN] TLS link object
返回
Device certificate

◆ HITLS_GetCertStore()

HITLS_CERT_Store * HITLS_GetCertStore ( const HITLS_Ctx * ctx)

Obtain the cert store used by the TLS link.

参数
ctx[IN] TLS link object
返回
Cert store

◆ HITLS_GetChainStore()

HITLS_CERT_Store * HITLS_GetChainStore ( const HITLS_Ctx * ctx)

Obtain the chain store used by the TLS link.

参数
ctx[IN] TLS object
返回
Chain Store

◆ HITLS_GetDefaultPasswordCb()

HITLS_PasswordCb HITLS_GetDefaultPasswordCb ( HITLS_Ctx * ctx)

Callback for obtaining the default password

参数
ctx[IN] TLS link object
返回
Password Callback

◆ HITLS_GetDefaultPasswordCbUserdata()

void * HITLS_GetDefaultPasswordCbUserdata ( HITLS_Ctx * ctx)

Obtain the user data used by the default password callback.

参数
ctx[IN] TLS link object
返回
User data

◆ HITLS_GetPeerCAList()

HITLS_TrustedCAList * HITLS_GetPeerCAList ( const HITLS_Ctx * ctx)

Obtain the trusted CA list of the peer end.

参数
ctx[OUT] TLS connection handle
返回
Peer CA list

◆ HITLS_GetPeerCertChain()

HITLS_CERT_Chain * HITLS_GetPeerCertChain ( const HITLS_Ctx * ctx)

Obtain the peer certificate chain.

参数
ctx[OUT] TLS connection handle
返回
Peer certificate chain

◆ HITLS_GetPeerCertificate()

HITLS_CERT_X509 * HITLS_GetPeerCertificate ( const HITLS_Ctx * ctx)

Obtain the peer certificate.

注意
: Certificate reference increments by one.
参数
ctx[IN] hitls Context
返回
Peer certificate

◆ HITLS_GetPrivateKey()

HITLS_CERT_Key * HITLS_GetPrivateKey ( HITLS_Ctx * ctx)

Obtain the private key of the certificate in use.

注意
The user cannot release the memory.
参数
ctx[IN] TLS link object
返回
Certificate private key

◆ HITLS_GetVerifyCb()

HITLS_VerifyCb HITLS_GetVerifyCb ( HITLS_Ctx * ctx)

Obtain the certificate verification callback function.

参数
ctx[IN] TLS link object
返回
Certificate verification callback function

◆ HITLS_GetVerifyResult()

int32_t HITLS_GetVerifyResult ( const HITLS_Ctx * ctx,
HITLS_ERROR * verifyResult )

Return the peer certificate verification result of the current context.

参数
ctx[IN] TLS connection handle
verifyResult[OUT] Peer certificate verification result
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_GetVerifyStore()

HITLS_CERT_Store * HITLS_GetVerifyStore ( const HITLS_Ctx * ctx)

Obtain the verify store used by the TLS link.

参数
ctx[IN] TLS link object
返回
Verify store

◆ HITLS_LoadCertBuffer()

int32_t HITLS_LoadCertBuffer ( HITLS_Ctx * ctx,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Read the device certificate from the buffer.

参数
ctx[OUT] TLS link object
buf[IN] Certificate data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
bufLen[IN] Data length the bufLen should exclude the end '\0'
format[IN] Data format
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_LoadCertFile()

int32_t HITLS_LoadCertFile ( HITLS_Ctx * ctx,
const char * file,
HITLS_ParseFormat format )

Use a file to set the device certificate.

参数
ctx[IN/OUT] TLS connection handle
file[IN] File name
format[IN] Data format
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_LoadCrlBuffer()

int32_t HITLS_LoadCrlBuffer ( HITLS_Ctx * ctx,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Load CRL from buffer and add it into the verify store of the TLS context.

参数
ctx[OUT] TLS link object
buf[IN] CRL data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf of encode needs to end with '\0'
bufLen[IN] Data length the bufLen should exclude the end '\0'
format[IN] Data format, see HITLS_ParseFormat
返回值
HITLS_SUCCESSif successful
Forother error codes, see hitls_error.h

◆ HITLS_LoadCrlFile()

int32_t HITLS_LoadCrlFile ( HITLS_Ctx * ctx,
const char * file,
HITLS_ParseFormat format )

Load CRL from file and add it into the verify store of the TLS context.

参数
ctx[OUT] TLS link object
file[IN] CRL file path
format[IN] Data format, see HITLS_ParseFormat
返回值
HITLS_SUCCESSif successful
Forother error codes, see hitls_error.h

◆ HITLS_LoadKeyBuffer()

int32_t HITLS_LoadKeyBuffer ( HITLS_Ctx * ctx,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Read the private key of the device certificate from the buffer.

参数
ctx[OUT] TLS link object.
buf[IN] Private key data. BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buff of encode needs to end with '\0'
bufLen[IN] Data length. the bufLen should exclude the end '\0'
format[IN] Data format.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_LoadKeyFile()

int32_t HITLS_LoadKeyFile ( HITLS_Ctx * ctx,
const char * file,
HITLS_ParseFormat format )

Use the file to set the device private key.

参数
ctx[IN/OUT] TLS connection handle
file[IN] File name.
format[IN] Data format.
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_LoadVerifyBuffer()

int32_t HITLS_LoadVerifyBuffer ( HITLS_Ctx * ctx,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Load the verification certificates from buffer.

参数
ctx[OUT] TLS connection handle
buf[IN] Certificate buffer data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
bufLen[IN] Buffer length the bufLen should exclude the end '\0'
format[IN] Certificate format (PEM/DER/ASN1)
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_LogSecret()

int32_t HITLS_LogSecret ( HITLS_Ctx * ctx,
const char * label,
const uint8_t * secret,
size_t secretLen )

If logging is enabled, the master key is logged

参数
ctx[OUT] TLS Link object.
label[IN] Label
secret[IN] Key
secretLen[IN] Key length.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_ProviderLoadKeyBuffer()

int32_t HITLS_ProviderLoadKeyBuffer ( HITLS_Ctx * ctx,
const uint8_t * buf,
uint32_t bufLen,
const char * format,
const char * type )

Load the private key of the device certificate from the buffer, when the provider is used.

参数
ctx[IN/OUT] TLS connection handle
buf[IN] Private key data.
bufLen[IN] Data length.
format[IN] Data format.
type[IN] Data type.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_ProviderLoadKeyFile()

int32_t HITLS_ProviderLoadKeyFile ( HITLS_Ctx * ctx,
const char * file,
const char * format,
const char * type )

Load the private key of the device certificate from the file, when the provider is used.

参数
ctx[IN/OUT] TLS connection handle
file[IN] File name.
format[IN] Data format.
type[IN] Data type.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_RemoveCertAndKey()

int32_t HITLS_RemoveCertAndKey ( HITLS_Ctx * ctx)

Release all loaded certificates and private keys.

参数
ctx[IN] TLS link object
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetCAList()

int32_t HITLS_SetCAList ( HITLS_Ctx * ctx,
HITLS_TrustedCAList * list )

Set the trusted CA list of the current context.

参数
ctx[OUT] TLS connection handle
list[IN] List of trusted CAs to be set.
返回值
TrustedCA list

◆ HITLS_SetCertCb()

int32_t HITLS_SetCertCb ( HITLS_Ctx * ctx,
HITLS_CertCb certCb,
void * arg )

Set the certificate processing callback function. The callback can check the passed ctx structure and set or clear any appropriate certificate, cb can be NULL.

参数
ctx[OUT] TLS link object
cert_cb[IN] Certificate verification callback function
arg[IN] Parameters required in the certificate verification callback function
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetCertificate()

int32_t HITLS_SetCertificate ( HITLS_Ctx * ctx,
HITLS_CERT_X509 * cert,
bool isClone )

Add a device certificate. Only one certificate can be added for each type.

参数
ctx[OUT] TLS link object
cert[IN] Device certificate
isClone[IN] Flag indicating if the certificate is a clone.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetCertStore()

int32_t HITLS_SetCertStore ( HITLS_Ctx * ctx,
HITLS_CERT_Store * store,
bool isClone )

Set the cert store used by the TLS link.

注意
If verify store is not set, use cert store to verify the certificate. If chain store is not set, use cert store to construct a certificate chain.
参数
ctx[OUT] TLS link object
store[IN] Trust certificate store
isClone[IN] Indicates whether deep copy is required. The options are true and false.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetChainStore()

int32_t HITLS_SetChainStore ( HITLS_Ctx * ctx,
HITLS_CERT_Store * store,
bool isClone )

Set the chain store used by the TLS link to construct the certificate chain.

参数
ctx[OUT] TLS link object
store[IN] Certificate chain
isClone[IN] Indicates whether deep copy is required. The options are true and false.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetCurrentCert()

int32_t HITLS_SetCurrentCert ( HITLS_Ctx * ctx,
long option )

Set the current certificate to the value based on the option parameter.

参数
ctx[OUT] TLS link object
option[IN] Setting options, including HITLS_CERT_SET_FIRST, HITLS_CERT_SET_NEXT
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetDefaultPasswordCb()

int32_t HITLS_SetDefaultPasswordCb ( HITLS_Ctx * ctx,
HITLS_PasswordCb cb )

Set the default password callback, cb can be NULL

参数
ctx[OUT] TLS link object
cb[IN] password Callback
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetDefaultPasswordCbUserdata()

int32_t HITLS_SetDefaultPasswordCbUserdata ( HITLS_Ctx * ctx,
void * userdata )

Set the user data used by the default password callback.

参数
ctx[OUT] TLS link object
userdata[IN] user data
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetPrivateKey()

int32_t HITLS_SetPrivateKey ( HITLS_Ctx * ctx,
HITLS_CERT_Key * key,
bool isClone )

Add the private key of the device certificate. Only one private key can be added for each type of certificate.

参数
ctx[OUT] TLS link object.
pkey[IN] Device private key.
isClone[IN] Indicates whether deep copy is required. The options are as follows: true: yes; false: no.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetVerifyCb()

int32_t HITLS_SetVerifyCb ( HITLS_Ctx * ctx,
HITLS_VerifyCb callback )

Set the certificate verification callback function, cb can be NULL.

参数
ctx[OUT] TLS link object
callback[IN] Certificate verification callback function
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_SetVerifyResult()

int32_t HITLS_SetVerifyResult ( HITLS_Ctx * ctx,
HITLS_ERROR verifyResult )

Set the peer certificate verification result of the current context.

参数
ctx[IN] TLS connection handle
verifyResult[IN] Peer certificate verification result
返回
HITLS_SUCCESS, if successful. For details about other error codes, see hitls_error.h.

◆ HITLS_SetVerifyStore()

int32_t HITLS_SetVerifyStore ( HITLS_Ctx * ctx,
HITLS_CERT_Store * store,
bool isClone )

Set the verify store used by the TLS link for certificate verification.

参数
ctx[OUT] TLS link object
store[IN] CA certificate store
isClone[IN] Indicates whether deep copy is required. The options are true and false.
返回值
HITLS_SUCCESS,ifsuccessful.
Forother error codes, see hitls_error.h.

◆ HITLS_UseCertificateChainBuffer()

int32_t HITLS_UseCertificateChainBuffer ( HITLS_Ctx * ctx,
const uint8_t * buf,
uint32_t bufLen,
HITLS_ParseFormat format )

Use the certificate chain buffer to set the certificate chain.

参数
ctx[OUT] TLS connection handle
buf[IN] Certificate chain buffer data BSL_FORMAT_UNKNOWN/BSL_FORMAT_PEM : the buf needs to end with '\0'
bufLen[IN] Buffer length the bufLen should exclude the end '\0'
format[IN] Certificate format (PEM/DER/ASN1)
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.

◆ HITLS_UseCertificateChainFile()

int32_t HITLS_UseCertificateChainFile ( HITLS_Ctx * ctx,
const char * file )

Use the certificate chain file to set the certificate chain.

参数
ctx[OUT] TLS link configuration
file[IN] Certificate chain file name
返回值
HITLS_SUCCESS,ifsuccessful. For details about other error codes, see hitls_error.h.