diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2017-03-27 23:52:41 +0300 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2017-03-27 23:52:41 +0300 |
commit | 5d3bf781a6feb6edc1bf70efcf80c374597f6d9b (patch) | |
tree | bbbd06ab3ff6a6c506e19e491544fac657de208b /thirdparty | |
parent | 0e83c667359312ae529de685360530e0c5c50a45 (diff) |
Updated the TlsTest.exe tool to work better with Mono 4.8.0.
Diffstat (limited to 'thirdparty')
-rw-r--r-- | thirdparty/TlsTest/TlsTest.cs | 18 | ||||
-rwxr-xr-x | thirdparty/TlsTest/TlsTest.exe | bin | 11264 -> 11776 bytes |
2 files changed, 14 insertions, 4 deletions
diff --git a/thirdparty/TlsTest/TlsTest.cs b/thirdparty/TlsTest/TlsTest.cs index 42a09d902..4a137baa2 100644 --- a/thirdparty/TlsTest/TlsTest.cs +++ b/thirdparty/TlsTest/TlsTest.cs @@ -41,6 +41,8 @@ public class TlsTest Console.WriteLine("\t--ssl3 \tUse SSLv3"); Console.WriteLine("\t--tls \tUse TLSv1"); Console.WriteLine("\t--tls1 \tUse TLSv1"); + Console.WriteLine("\t--tls11 \tUse TLSv1.1"); + Console.WriteLine("\t--tls12 \tUse TLSv1.2"); Console.WriteLine("{0}class", Environment.NewLine); Console.WriteLine("\t--stream\tDirectly use the SslClientStream [default]"); Console.WriteLine("\t--web \tUse the WebRequest/WebResponse classes"); @@ -57,7 +59,7 @@ public class TlsTest private static bool show; private static bool time; private static bool web; - private static Mono.Security.Protocol.Tls.SecurityProtocolType protocol = Mono.Security.Protocol.Tls.SecurityProtocolType.Default; + private static Mono.Security.Protocol.Tls.SecurityProtocolType? protocol; private static X509CertificateCollection certificates = new X509CertificateCollection(); private static NetworkCredential basicCred; private static NetworkCredential digestCred; @@ -93,6 +95,12 @@ public class TlsTest case "--tls1": protocol = Mono.Security.Protocol.Tls.SecurityProtocolType.Tls; break; + case "--tls11": + protocol = Mono.Security.Protocol.Tls.SecurityProtocolType.Tls11; + break; + case "--tls12": + protocol = Mono.Security.Protocol.Tls.SecurityProtocolType.Tls12; + break; // class case "--stream": web = false; @@ -157,7 +165,8 @@ public class TlsTest { content = GetWebPage(url); } - else { + else + { content = GetStreamPage(url); } } @@ -183,7 +192,8 @@ public class TlsTest public static string GetWebPage(string url) { ServicePointManager.CertificatePolicy = new TestCertificatePolicy(); - ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)(int)protocol; + if (protocol != null) + ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)(int)protocol.Value; Uri uri = new Uri(url); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri); @@ -218,7 +228,7 @@ public class TlsTest Socket socket = new Socket(ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp); socket.Connect(new IPEndPoint(ip, uri.Port)); NetworkStream ns = new NetworkStream(socket, false); - SslClientStream ssl = new SslClientStream(ns, uri.Host, false, protocol, certificates); + SslClientStream ssl = new SslClientStream(ns, uri.Host, false, protocol ?? Mono.Security.Protocol.Tls.SecurityProtocolType.Default, certificates); ssl.ServerCertValidationDelegate += new CertificateValidationCallback(CertificateValidation); StreamWriter sw = new StreamWriter(ssl); diff --git a/thirdparty/TlsTest/TlsTest.exe b/thirdparty/TlsTest/TlsTest.exe Binary files differindex a4195c20f..84996219d 100755 --- a/thirdparty/TlsTest/TlsTest.exe +++ b/thirdparty/TlsTest/TlsTest.exe |