Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Unity 2017.1 - TLS 1.2 still not working with .NET 4.6

Discussion in 'Experimental Scripting Previews' started by Zocker1996, Aug 9, 2017.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I'm seeing a similar error, and this is the top search result (even though it's not exactly the same). I'm attempting to connect to a MySQL server, and it's failing with UNITYTLS_INTERNAL_ERROR and UNITYTLS_X509VERIFY_NOT_DONE:

    This is in 2019.3.9f1. Any idea how to get around this?
     
  2. dchertoff

    dchertoff

    Joined:
    May 25, 2020
    Posts:
    7
    I guess unity is still relying on the bugged version of mono that does not implement the callback for ServicePointManager.ServerCertificateValidationCallback when using a secure websocket connection. There was an issue raised in the bug tracker, but it was closed as won't fix (https://issuetracker.unity3d.com/is...nnection-setup-with-a-self-signed-certificate).

    Some of us have to use self-signed certificates in a secure environment where we can't rely on users installing certificates to their local root store. This bug has been quite infuriating as there is no way around it as far as I can tell.

    edit to add: using 2019.4.11
     
    Novack likes this.
  3. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Still dealing with this, working with 2020.3.0f1.

    No way around it, as far as I have found. Certificate validation override methods are still not available or not functional either.
     
  4. ioesten

    ioesten

    Joined:
    Feb 19, 2018
    Posts:
    14
    When using UnityWebRequest for WebGL https GET call to netflify i got "Unable to complete SSL connection" and log file showed "Curl error 35: Handshake did not perform verification. UnityTls error code: 7"

    Thought it might just be some out of date certificates, so updated Windows updated to 2020.3.8f1 - no difference.
    Added various version of self certificate validation - no joy.

    Rewrote code to use HttpWebRequest now seeing
    TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_NOT_DONE

    Basically the same problem still. The real irony is that the original code worked just fine until now, several builds from same code base still work happily. Trying to run with just a different fbx in the project, see above. New builds also do not work, fail with CORS issue - quote from colleague investigating: "The only difference I can see is that in the new build, the pre-flight OPTIONS request is sent after the actual GET request for the data but it should happen first so client knows what cross origin requests are allowed.."

    Anyone have any good news for this at all?? How are we going to tell customer that all his existing builds are fine, but sorry, we cannot create with new models - tears out some more hair :(
     
  5. JanB93

    JanB93

    Joined:
    Sep 4, 2017
    Posts:
    1
    Getting the same error when trying to send an email with System.Net.Mail.SmtpClient on android and editor. Everything was working fine and from one day to another nothing is working now.

    Mono.Security.Interface.TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_NOT_DONE
    at 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) [0x00036] in <aa976c2104104b7ca9e1785715722c9d>:0
    at Mono.Unity.UnityTlsContext.ProcessHandshake () [0x00082] in <aa976c2104104b7ca9e1785715722c9d>:0
    at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in <aa976c2104104b7ca9e1785715722c9d>:0
    at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus)
    at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00006] in <aa976c2104104b7ca9e1785715722c9d>:0
    at Mono.Net.Security.AsyncProtocolRequest+<ProcessOperation>d__24.MoveNext () [0x000ff] in <aa976c2104104b7ca9e1785715722c9d>:0

    It even stopped working on devices where my app is working for 2 years.
    Also tried all steps that were mentioned in previous post. Tried Unity Version 2019.4 and switching to 2020.3 did not help.
     
  6. RGV

    RGV

    Joined:
    Jan 25, 2016
    Posts:
    48
    We got the same mess on August 11th.
     
  7. Nickjd331

    Nickjd331

    Joined:
    Aug 22, 2014
    Posts:
    29
    I don't know if anyone can help me but I've still been getting the error message "TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2.". It had been working find for years, but due to the disabling of 1.0 and 1.1 I've got stuck.

    I've followed lots of suggestions in this thread in regards to TLS issues, but having no luck. It now consistently fails to send emails.

    I am currently using Unity LTS 2020.3.21, testing in the editor, with the iOS platform.

    My current code is as follows, but I've tried many variations.

    Code (CSharp):
    1. SmtpClient smtpServer = new SmtpClient("smtp-mail.outlook.com");
    2.         smtpServer.Port = 587;
    3.         smtpServer.EnableSsl = true;
    4.         smtpServer.UseDefaultCredentials = false;
    5.         smtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
    6.         smtpServer.Credentials = new System.Net.NetworkCredential("secretusername ", "secret password") as ICredentialsByHost;
    7.         ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
    8.         ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    9.    
    10.         smtpServer.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
    11.         smtpServer.SendAsync(mail, toEmail);
    Many thanks if anyone can shed some light on this.
     
  8. LT23Live

    LT23Live

    Joined:
    Jul 8, 2014
    Posts:
    98
    This is the exact same issue for me. Did you resolve this?
     
  9. LT23Live

    LT23Live

    Joined:
    Jul 8, 2014
    Posts:
    98
    Were you able to resolve this issue?
     
  10. LT23Live

    LT23Live

    Joined:
    Jul 8, 2014
    Posts:
    98
    @andreasreich are you able to help with this? I am running into the same issue and our clients are very upset.
     
  11. LT23Live

    LT23Live

    Joined:
    Jul 8, 2014
    Posts:
    98
    We just switched email services to one that isn't secued with TLS 1.2
     
  12. Nickjd331

    Nickjd331

    Joined:
    Aug 22, 2014
    Posts:
    29
    I've done the same for now, but it's not a suitable long term solution for us. Still eager to hear of a fix!
     
  13. ZhouHyan

    ZhouHyan

    Joined:
    Sep 5, 2017
    Posts:
    4
    I have the same problem,I have a need by using mqtt with ssl(TLS1.2) to connect with broker.I made it success with a .net app project,but it failed on Unity Editor(2020.3.26f) with same code.
    I wonder know using platform native SSL libraries is still the best option?
    @andreasreich
    Code (CSharp):
    1. MQTTnet.Exceptions.MqttCommunicationException: A call to SSPI failed, see inner exception. ---> 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: 4294936064
    2.   at 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) [0x00036] in <0463b2ef957545c0a51b42f372cd4fbb>:0
    3.   at Mono.Unity.UnityTlsContext.ProcessHandshake () [0x00082] in <0463b2ef957545c0a51b42f372cd4fbb>:0
    4.   at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in <0463b2ef957545c0a51b42f372cd4fbb>:0
    5.   at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus)
    6.   at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00006] in <0463b2ef957545c0a51b42f372cd4fbb>:0
    7.   at Mono.Net.Security.AsyncProtocolRequest+<ProcessOperation>d__24.MoveNext () [0x000ff] in <0463b2ef957545c0a51b42f372cd4fbb>:0
    8.  
     
    Last edited: Mar 7, 2022