From 089d9acc7364a2ad16d072425849d3b3f360f0a6 Mon Sep 17 00:00:00 2001 From: Tang Tianyong Date: Sun, 20 Aug 2017 22:40:41 +0800 Subject: [PATCH 1/2] Pick a SRWebSocket change about SSL pinning --- AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m index 4ef304deb..b5dd46260 100755 --- a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m +++ b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m @@ -1543,7 +1543,9 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode; } assert(_readBuffer); - if (!_secure && self.readyState == AVIM_CONNECTING && aStream == _inputStream) { + // didConnect fires after certificate verification if we're using pinned certificates. + BOOL usingPinnedCerts = [[_urlRequest AVIM_SSLPinnedCertificates] count] > 0; + if ((!_secure || !usingPinnedCerts) && self.readyState == AVIM_CONNECTING && aStream == _inputStream) { [self didConnect]; } [self _pumpWriting]; From 0a92acca609d37b91f7761ed6fd27533a28d11eb Mon Sep 17 00:00:00 2001 From: Tang Tianyong Date: Sun, 20 Aug 2017 22:41:08 +0800 Subject: [PATCH 2/2] Turn off WebSocket SSL pinning --- AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m b/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m index f1018fa40..d683affa2 100644 --- a/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m +++ b/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m @@ -497,11 +497,6 @@ - (void)internalOpenWebSocketConnection:(NSString *)server { _webSocket = [[AVIMWebSocket alloc] initWithURLRequest:request]; } - if (self.security) { - request.AVIM_SSLPinnedCertificates = [self pinnedCertificates]; - _webSocket.SSLPinningMode = AVIMSSLPinningModePublicKey; - } - _webSocket.delegate = self; [_webSocket open]; }