Search Unity

MySQL Error: UNITYTLS_X509VERIFY_NOT_DONE

Discussion in 'Formats & External Tools' started by mAxYoLo01, Nov 13, 2020.

  1. mAxYoLo01

    mAxYoLo01

    Joined:
    May 18, 2020
    Posts:
    2
    Hello,
    I'm trying to connect a Unity project to a remote MySQL database (first time I try this).
    I've been stuck for hours due to this error:
    Code (CSharp):
    1. TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_NOT_DONE
    2. Mono.Unity.Debug.CheckAndThrow (Mono.Unity.UnityTls+unitytls_errorstate errorState, Mono.Unity.UnityTls+unitytls_x509verify_result verifyResult, System.String context, Mono.Security.Interface.AlertDescription defaultAlert) (at <aa976c2104104b7ca9e1785715722c9d>:0)
    3. Mono.Unity.UnityTlsContext.ProcessHandshake () (at <aa976c2104104b7ca9e1785715722c9d>:0)
    4. Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) (at <aa976c2104104b7ca9e1785715722c9d>:0)
    5. (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus)
    6. Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) (at <aa976c2104104b7ca9e1785715722c9d>:0)
    7. Mono.Net.Security.AsyncProtocolRequest+<ProcessOperation>d__24.MoveNext () (at <aa976c2104104b7ca9e1785715722c9d>:0)
    8. --- End of stack trace from previous location where exception was thrown ---
    9. System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
    10. System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
    11. System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
    12. System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
    13. System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () (at <9577ac7a62ef43179789031239ba8798>:0)
    14. Mono.Net.Security.AsyncProtocolRequest+<StartOperation>d__23.MoveNext () (at <aa976c2104104b7ca9e1785715722c9d>:0)
    15. Rethrow as AuthenticationException: A call to SSPI failed, see inner exception.
    16. System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
    17. Mono.Net.Security.MobileAuthenticatedStream+<ProcessAuthentication>d__47.MoveNext () (at <aa976c2104104b7ca9e1785715722c9d>:0)
    18. Rethrow as AggregateException: One or more errors occurred.
    19. System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <9577ac7a62ef43179789031239ba8798>:0)
    20. System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) (at <9577ac7a62ef43179789031239ba8798>:0)
    21. System.Threading.Tasks.Task.Wait () (at <9577ac7a62ef43179789031239ba8798>:0)
    22. Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) (at <aa976c2104104b7ca9e1785715722c9d>:0)
    23. System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) (at <aa976c2104104b7ca9e1785715722c9d>:0)
    24. MySql.Data.MySqlClient.NativeDriver.StartSSL () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    25. MySql.Data.MySqlClient.NativeDriver.Open () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    26. MySql.Data.MySqlClient.Driver.Open () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    27. MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    28. MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    29. MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    30. MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    31. MySql.Data.MySqlClient.MySqlPool.GetConnection () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    32. MySql.Data.MySqlClient.MySqlConnection.Open () (at <5bcfdf23711c4d2fa921347752c12a65>:0)
    33. SQLManager.SetupSQLConnection () (at Assets/Scripts/SQLManager.cs:24)
    34. SQLManager.Start () (at Assets/Scripts/SQLManager.cs:11)
    And here is the code of my SQLManager script:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using MySql.Data.MySqlClient;
    5.  
    6. public class SQLManager : MonoBehaviour
    7. {
    8.     MySqlConnection connection;
    9.     void Start()
    10.     {
    11.         SetupSQLConnection();
    12.     }
    13.  
    14.     private void SetupSQLConnection()
    15.     {
    16.         if (connection == null)
    17.         {
    18.             string connectionString = "SERVER=server;" + "DATABASE=database;" + "UID=uid;" + "PASSWORD=password;";
    19.             try
    20.             {
    21.                 connection = new MySqlConnection(connectionString);
    22.                 connection.Open();
    23.             }
    24.             catch (MySqlException ex)
    25.             {
    26.                 Debug.LogError("MySQL Error: " + ex.ToString());
    27.             }
    28.         }
    29.     }
    30. }
    31.  
    Any ideas to how to solve this? I am very unfamiliar to all of this certificate stuff.
    Thanks in advance.
     
  2. mAxYoLo01

    mAxYoLo01

    Joined:
    May 18, 2020
    Posts:
    2