From 17908cfc10a4e0079fdcad08cf331c3184d5b3cf Mon Sep 17 00:00:00 2001 From: Simon Oxtoby Date: Wed, 11 Mar 2020 11:42:01 +1000 Subject: [PATCH] Forcing TLS 1.2 for websocket connections --- SlackNet/IWebSocket.cs | 2 +- SlackNet/WebSocketFactory.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SlackNet/IWebSocket.cs b/SlackNet/IWebSocket.cs index 93fb38f..4c272fc 100644 --- a/SlackNet/IWebSocket.cs +++ b/SlackNet/IWebSocket.cs @@ -17,7 +17,7 @@ public interface IWebSocket : IDisposable IObservable Messages { get; } } - class WebSocketWrapper : IWebSocket + public class WebSocketWrapper : IWebSocket { private readonly WebSocket _webSocket; diff --git a/SlackNet/WebSocketFactory.cs b/SlackNet/WebSocketFactory.cs index a65387e..5710700 100644 --- a/SlackNet/WebSocketFactory.cs +++ b/SlackNet/WebSocketFactory.cs @@ -1,4 +1,5 @@ -using WebSocket4Net; +using System.Security.Authentication; +using WebSocket4Net; namespace SlackNet { @@ -9,6 +10,6 @@ public interface IWebSocketFactory class WebSocketFactory : IWebSocketFactory { - public IWebSocket Create(string uri) => new WebSocketWrapper(new WebSocket(uri)); + public IWebSocket Create(string uri) => new WebSocketWrapper(new WebSocket(uri, sslProtocols: SslProtocols.Tls12)); } } \ No newline at end of file