From 9f44469886f357afd3d203f3cee01f44f0856b76 Mon Sep 17 00:00:00 2001 From: Himanshu-Sharma-ODC Date: Tue, 23 Oct 2018 21:43:17 +0530 Subject: [PATCH 1/3] added method to use selected CipherSuites for SSL encryption --- Sources/ScClient/client.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/ScClient/client.swift b/Sources/ScClient/client.swift index 34bcc48..0024aec 100644 --- a/Sources/ScClient/client.swift +++ b/Sources/ScClient/client.swift @@ -213,6 +213,16 @@ public class ScClient : Listener, WebSocketDelegate { public func loadSSLCertificateFromData(data : Data, usePublicKeys : Bool = false) { socket.security = SSLSecurity(certs: [SSLCert(data: data)], usePublicKeys: usePublicKeys) } + + /** + To use an SSL encrypted connection, you need to tell Starscream about the cipher suites your server supports. + If you don't know which cipher suites are supported by your server, you can try pointing SSL Labs at it and checking the results. + - Parameters: + - cipherSuites: list of ciphersuites that will be chosen by client to select encryption algorithm + */ + public func useCipherSuites(cipherSuites : [SSLCipherSuite]) { + socket.enabledSSLCipherSuites = cipherSuites; + } } From 9119da65f69ea32b0cdf07b57778472a8455dea4 Mon Sep 17 00:00:00 2001 From: Himanshu-Sharma-ODC Date: Fri, 26 Oct 2018 17:31:11 +0530 Subject: [PATCH 2/3] Added support for enabbling and disabling compression --- Sources/ScClient/client.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sources/ScClient/client.swift b/Sources/ScClient/client.swift index 0024aec..b2d3c52 100644 --- a/Sources/ScClient/client.swift +++ b/Sources/ScClient/client.swift @@ -224,5 +224,18 @@ public class ScClient : Listener, WebSocketDelegate { socket.enabledSSLCipherSuites = cipherSuites; } + /** + Enables compression of data. + */ + public func enableCompression(){ + socket.enableCompression = true; + } + + /** + Disables compression of data. + */ + public func disableCompression(){ + socket.enableCompression = false; + } } From 08bdfcb0c12ebaf18642f86220c7787c99194f84 Mon Sep 17 00:00:00 2001 From: Himanshu-Sharma-ODC Date: Fri, 26 Oct 2018 23:44:44 +0530 Subject: [PATCH 3/3] Implemented disablingg of SSL validation --- Sources/ScClient/client.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sources/ScClient/client.swift b/Sources/ScClient/client.swift index b2d3c52..9ee6860 100644 --- a/Sources/ScClient/client.swift +++ b/Sources/ScClient/client.swift @@ -228,14 +228,21 @@ public class ScClient : Listener, WebSocketDelegate { Enables compression of data. */ public func enableCompression(){ - socket.enableCompression = true; + socket.enableCompression = true } /** Disables compression of data. */ public func disableCompression(){ - socket.enableCompression = false; + socket.enableCompression = false + } + + /** + Enables you to ignore SSL cert validation, so a self signed SSL certificate can be used. + */ + public func disableSSLValidation(){ + socket.disableSSLCertValidation = true } }