Setting Certificate Verification Information
SetCAVerifyInfo
API Description
This API is used to set certificate verification information.
Precautions
- This API is optional. By default, certificate verification is disabled.
- 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
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. |
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(); } |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot