Unity Https请求加载图片存在证书认证问题(Cert verify failed)

Unity Https请求加载图片存在证书认证问题

-问题
废话不多说,上出错日志:

Curl error 51: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_UNKNOWN_ERROR
Curl error 51: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_UNKNOWN_ERROR
AsyncLoadImage url:https://10.19.120.137:443/pic?2ddd21ie9-e*6d34131a4m8ep=t1i3i*d1=*ipd1=*=s3b4i8d0e*c6f29e56e-a025af--5147113z43as=3ie4=&AccessKeyId=/bYOWWOiw2LHsT1K&Expires=1585402513&Signature=Ka0Q4uKQJ5rzmmEbuKJqJB0EkMs=, Error:Unknown Error

-修改前代码
Unity Https请求加载图片存在证书认证问题(Cert verify failed)_第1张图片
-解决方法
1,创建证书认证脚本,继承UnityEngine.Networking.CertificateHandler

using UnityEngine.Networking;

public class CertHandler : CertificateHandler {
     
    protected override bool ValidateCertificate (byte[] certificateData) {
     
        return true;
    }
}

2,对于每一个UnityWebRequest,在发送前都创建一个实例,即可。
-修改后代码
Unity Https请求加载图片存在证书认证问题(Cert verify failed)_第2张图片
-至此结束

你可能感兴趣的:(Unity,unity,https)