Skip to content

Legacy Version of SSL Pinning

pzheng edited this page Sep 29, 2019 · 1 revision

确认了 objc-sdk 有 websocket ssl pin 的版本范围:3.1.6 ~ 7.1.0

源码修改方案(参考 PR):

  • 删除 AVIMWebSocketWrapper.m 文件中的如下代码:
if (self.security) {
    request.AVIM_SSLPinnedCertificates = [self pinnedCertificates];
    _webSocket.SSLPinningMode = AVIMSSLPinningModePublicKey;
}
  • 替换 AVIMWebSocket.m 中的一行代码:
if (!_secure && self.readyState == AVIM_CONNECTING && aStream == _inputStream) {

替换为

BOOL usingPinnedCerts = [[_urlRequest AVIM_SSLPinnedCertificates] count] > 0;
if ((!_secure || !usingPinnedCerts) && self.readyState == AVIM_CONNECTING && aStream == _inputStream) {