unity 最近在做有关接入百度的人脸比对的项目

我用的是百度的c# sdk (使用百度api的请忽略,咱们不是一个思路),但是把sdk接入后,将参数配置好后,报错:

WebException: Error writing request: The authentication or decryption has failed.
TLSException

解决方案:
在访问百度的api之前请先进行授权,我现在的解决方案是用一个非常愚蠢的策略覆盖证书策略,它只说“是,好,你可以连接”。将来,我可以让这个检查证书,或者根据证书来自哪里接受或拒绝。

有任何问题可以添加 QQ群 207019099

public static bool Validator(object sender,X509Certificate certificate,X509Chain chain,SslPolicyErrors policyErrors)
    {
        return true;
    }

    public static void Instate()
    {
        ServicePointManager.ServerCertificateValidationCallback = Validator;
    }

猜你喜欢

转载自blog.csdn.net/gaofei12300/article/details/77162599
今日推荐