Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. Zocker1996


    Jan 12, 2015
    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=, 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 ( 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=, Culture=neutral, PublicKeyToken=0738eb9f132ed756', but it could not be found
  2. Baste


    Jan 24, 2013
    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


    Mar 26, 2013
    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.