Search Unity

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

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

  1. Zocker1996

    Zocker1996

    Joined:
    Jan 12, 2015
    Posts:
    20
    Using the following code with Scripting Runtime Version .NET 4.6

    Code (CSharp):
    1. using System.Net.Security;
    2. using System.Net.Sockets;
    3. using UnityEngine:
    4. public class TlsTest : MonoBehaviour{
    5.     void Start(){
    6.         TcpClient client = new TcpClient ();
    7.         client.Connect ("localhost", 56782);
    8.         SslStream ssl = new SslStream (client.GetStream());
    9.         ssl.AuthenticateAsClient ("localhost");
    10.     }
    11. }
    gives me this error:
    Code (CSharp):
    1. Assets/Main.cs(8,19): error CS0012: The type `Mono.Security.Interface.IMonoSslStream' is defined in an assembly that is not referenced. Consider adding a reference to assembly `Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'

    Using the code with .NET 3.5 is fine BUT .NET 3.5 is missing TLS 1.2 (4.6 should have it).
    Since I need TLS 1.2 using .NET 3.5 isn't a solution.

    I searched for the needed DLL, found it here (https://github.com/danzel/Npgsql/blob/master/lib/Mono.Security/4.0/Mono.Security.dll) and added a reference.
    This gives me this error:
    Code (CSharp):
    1. Assets/Main.cs(8,19): error CS7069: Reference to type `Mono.Security.Interface.IMonoSslStream' claims it is defined assembly `Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756', but it could not be found
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    You should report a bug. You should also post in the Scripting Previews forum, where the people working on 4.6 seem to show up pretty often.
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Since .Net 4.6 in Unity is currently "Experimental", you should expect issues like this until the Unity devs have completed the feature. File a bug as already mentioned.