2***@qq.com
2***@qq.com
  • 发布:2026-04-13 17:06
  • 更新:2026-04-13 17:06
  • 阅读:24

ios端uni.configMTL使用自签名证书双向认证失败

分类:uni-app


如上配置了自签名证书server,
无论是server: [base + "leaf.cer",
base + "subca.cer",
base + "server.cer"]
还是server: [base + "leaf.cer",
base + "subca.cer"],
还是server: [base + "server.cer"]
均报错:<Weex>[log]WXBridgeContext.mm:1324, jsLog: ? client:---COMMA---/static/client.p12 at pages/index/test_cert_ios.vue:24
<Weex>[log]WXBridgeContext.mm:1324, jsLog: ? server:---COMMA---/static/server.cer at pages/index/test_cert_ios.vue:25
<Weex>[log]WXBridgeContext.mm:1324, jsLog: ✅ configMTLS 成功 at pages/index/test_cert_ios.vue:44
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
Connection 8: default TLS Trust evaluation failed(-9807)
Connection 8: TLS Trust encountered error 3:-9807
Connection 8: encountered error(3:-9807)
Task <0A3361E8-7D8E-400F-9529-9D82173EDEAD>.<1> HTTP load failed, 0/0 bytes (error code: -1202 [3:-9807])
Task <0A3361E8-7D8E-400F-9529-9D82173EDEAD>.<1> finished with error [-1202] Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “dfec-uat.cwjh.cn” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x1110b1600) s: dfec-uat.cwjh.cn i: DFMC Sub CA>",
"<cert(0x111026400) s: DFMC Sub CA i: DFMC Root CA>",
"<cert(0x111026c00) s: DFMC Root CA i: DFMC Root CA>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://dfec-uat.cwjh.cn/public/v2/vehicle/control, NSErrorFailingURLStringKey=https://dfec-uat.cwjh.cn/public/v2/vehicle/control, NSUnderlyingError=0x600000cac9f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x600003320820>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9807, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9807, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x1110b1600) s: dfec-uat.cwjh.cn i: DFMC Sub CA>",
"<cert(0x111026400) s: DFMC Sub CA i: DFMC Root CA>",
"<cert(0x111026c00) s: DFMC Root CA i: DFMC Root CA>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <0A3361E8-7D8E-400F-9529-9D82173EDEAD>.<1>"
), _kCFStreamErrorCodeKey=-9807, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0A3361E8-7D8E-400F-9529-9D82173EDEAD>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x600003320820>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “dfec-uat.cwjh.cn” which could put your confidential information at risk.}
<Weex>[error]WXBridgeContext.mm:1324, jsLog: ❌ 请求失败---COMMA------BEGIN:JSON---{"errMsg":"request:fail abort statusCode:-1 The certificate for this server is invalid. You might be connecting to a server that is pretending to be “dfec-uat.cwjh.cn” which could put your confidential information at risk.(-1202)"}---END:JSON--- at pages/index/test_cert_ios.vue:54

ios端在uni.configMTL时如何配置服务器端的自签名证书?server字段需要如何配置?还是说ios端uni.configMTL不支持server配置自签名证书?

2026-04-13 17:06 负责人:无 分享
已邀请:

要回复问题请先登录注册