Search Unity

Error on SignalR connection : UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED

Discussion in 'Multiplayer' started by Morph12345, Jun 28, 2019.

  1. Morph12345

    Morph12345

    Joined:
    Apr 10, 2015
    Posts:
    7
    Hi,
    I start to develop a custom multiplayer server using SignalR.

    The server part is ok and works with a custom console app client (connection and message exchange works).

    When I implement this in Unity (2019.1.8f1 or 2019.2.0b7) i get this error :

    There was an error opening the connection:System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (One or more errors occurred.) ---> System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Security.Interface.TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED

    There is only 5 results on google and no solution proposed, not even a clue on what to do.

    Client code :
    Code (CSharp):
    1.  var connection = new HubConnection("http://localhost:60791/");
    2.    
    3.         var myHub = connection.CreateHubProxy("ClientHub");
    4.  
    5.         connection.Start().ContinueWith(task => {
    6.             if (task.IsFaulted)
    7.             {
    8.                 Debug.LogError($"There was an error opening the connection:{task.Exception.GetBaseException()}");
    9.             }
    10.             else
    11.             {
    12.                 Debug.Log("Connected");
    13.             }
    14.  
    15.         }).Wait();
    Server code :
    Code (CSharp):
    1. app.UseSignalR(configure =>
    2.             {
    3.                 configure.MapHub<ClientHub>("/ClientHub");
    4.             });
    Anyone has already deal with that ?

    Thanks for your help :)
     
  2. mbussidk

    mbussidk

    Joined:
    May 9, 2017
    Posts:
    67
    that is a TLS handshake error, Unity can’t verify the certificate. Are you using a self signed certificate like, for example, the automatically generated one from the Dotnet runtime?
     
    Joe-Censored likes this.