HarmonyOS rcp如何跳过https证书验证

我的代码如下,但是无效,报错“code”:1007900060,“data”:“SSL peer certificate or SSH remote key was not OK”

private requestConfiguration(): rcp.Configuration {
  return {
    transfer: {
      timeout: {
        connectMs: QDCommonConstants.HTTP_TIMEOUT,
        transferMs: QDCommonConstants.HTTP_TIMEOUT,
      },
    },
    dns: {
      dnsOverHttps: {
        url: QDCtxConfig.getHref(), 
        skipCertificatesValidation: true,
      }
    }
  }
}

let req = new rcp.Request(url);
if (params) {
  let arr = Object.keys(params)
  if (arr.length > 0) {
    req.content = new rcp.Form(params)
    req.method = method.toUpperCase()
  }
}
req.headers = this.header(url)
req.configuration = this.requestConfiguration()
let resp: rcp.Response = await QDHttpRequest.session.fetch(req)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
HarmonyOS
2024-12-27 18:05:50
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
aquaa

可以试下把security属性的remoteValidation设置为skip试下

参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/remote-communication-rcp-V5#section1597118916425

分享
微博
QQ
微信
回复
2024-12-27 19:51:07


相关问题
HarmonyOS https请求如何跳过证书信任
1105浏览 • 1回复 待解决
HarmonyOS HTTPS请求如何验证服务器证书
1707浏览 • 1回复 待解决
HarmonyOS HTTPS证书过期
797浏览 • 1回复 待解决
HarmonyOS 网络请求跳过ssl证书校验
1131浏览 • 1回复 待解决
HarmonyOS 如何忽略掉https证书校验
624浏览 • 1回复 待解决
https如何设置ca证书和客户端证书
1405浏览 • 1回复 待解决
HarmonyOS rcp网络请求证书配置
907浏览 • 1回复 待解决
HarmonyOS ArkTS中是否有证书验证
667浏览 • 1回复 待解决
HarmonyOS https请求证书配置,报2300058
1032浏览 • 1回复 待解决
https请求带有ca证书的图片的具体实现
2656浏览 • 1回复 待解决