RestClient: SSL Instructions (Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_UNKNOWN_ERROR)

Hello everyone,

I’m writing the code that should get some info from the server on the virtual machine with self-signed certificate. I found your package and it’s wonderfull! I’ve searched for few hours, but never found any documentation about the SSL certificates… Without the SSL Certificate validation i get this error: Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_UNKNOWN_ERROR Also I tried to find any answer for resolving this problem but never found one so my code would work properly, Please help,

With best wishes, Nikita Kalachev

For the code, I just wrote this:

`using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using UnityEditor; using Models; using Proyecto26; using Proyecto26.Common; using RSG; using RSG.Exceptions; using RSG.Promises;

public class RESTCPack : MonoBehaviour { // Start is called before the first frame update void Start() { Debug.Log(“I’m alive! Hope it’ll work!”); }

// Update is called once per frame
void Update()
{
    RestClient.Get("https://someurl/").Then(res =>
    {
       Debug.Log("Response" + res.Text + "Ok");
    }); 
}

/*
public class CertificateHandlerPublicKey : CertificateHandler
{

    // Encoded RSAPublicKey
    private static string PUB_KEY = "somepublickey";
    protected override bool ValidateCertificate(byte[] certificateData)
    {
        X509Certificate2 certificate = new X509Certificate2(certificateData);
        string pk = certificate.GetPublicKeyString();
        Debug.Log(pk);
        if (pk.ToLower().Equals(PUB_KEY.ToLower()))
            return true;
        return false;
    }
}

*/

}`

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@maifeeulasad Thank you for the help, I also tried it with default web request (UnityWebRequest) and found the same result. Will create an issue on unity forum shortly. Appreciated!