Help Center/ Meeting/ Client SDK Reference/ Windows SDK/ API Reference/ Basic Settings/ Setting Certificate Verification Information
Updated on 2024-09-13 GMT+08:00

Setting Certificate Verification Information

SetCAVerifyInfo

API Description

This API is used to set certificate verification information.

Precautions

  1. This API is optional. By default, certificate verification is disabled.
  2. This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.

Method Definition

HWM_SDK_AGENT_API hwmsdk::HwmErrCode SetCAVerifyInfo(const HwmCAVerifyInfo* CAVerifyInfo);

Callback Function

virtual void OnSetCAVerifyInfoResult(hwmsdk::HwmErrCode ret, const char* reason) {};

Parameter Description

Table 1 HwmCAVerifyInfo description

Parameter

Mandatory

Type

Description

verifyMode

Yes

HwmVerifyMode

Verification mode.

certPath

No

char[]

User-defined path for storing the certificate. If this parameter is left empty, the built-in certificate is used for verification.

Table 2 Enumerated values of HwmVerifyMode

Enumerated Value

Description

VERIFY_MODE_NONE

No verification.

VERIFY_MODE_SERVER

Verify the server certificate.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
*  Set certificate verification information.
*/
void demoSetCAVerifyInfoDlg::SetCAVerifyInfo()
{
    hwmsdkagent::HwmCAVerifyInfo info{};
    info.verifyMode = hwmsdkagent::HwmVerifyMode::;
    CString certPathCString;
    m_certPathEdit.GetWindowText(certPathCString);
    std::string certPath = CTools::UNICODE2UTF(certPathCString.GetString());
    errno_t res = strcpy_s(info.certPath, sizeof(info.certPath), certPath.c_str());
    if (res != 0)
    {
        AfxMessageBox(_T("certPath copy error"));
    }

    int ret = hwmsdkagent::SetCAVerifyInfo(&info);
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("set CAVerifyInfo error"));
        return;
    }
    CDialogEx::OnOK();
}