ios - GCDAsyncSocket 与 bonjour 服务 : does startTLS initiate TLS handshake
<p><p> <a href="/image/iJusk.png" rel="noreferrer noopener nofollow"><img src="/image/iJusk.png" alt="enter image description here"/></a>我尝试使用 <code>TLS</code> 握手加密对等通信,该握手使用 <code>GCDAsyncSocket</code> 库的 <code>startTLS</code> 方法。
Bonjour 服务由服务器发布,客户端连接到发布的主机名。建立套接字连接后,我正在为服务器调用 <code>startTLS</code>,如下所示。</p>
<pre><code>
forKey:(NSString *)kCFStreamSSLIsServer];
[settings setObject:(__bridge id _Nonnull)(certs)
forKey:(NSString *)kCFStreamSSLCertificates];
CFRelease(certs);
settings = ;
;
;
</code></pre>
<p>下面的客户端是我正在使用的设置。</p>
<pre><code> NSMutableDictionary *settings = [ init];
settings = ;
settings = ;
forKey:GCDAsyncSocketManuallyEvaluateTrust];
[settings setObject:(__bridge id _Nonnull)(certs)
forKey:(NSString *)kCFStreamSSLCertificates];
;
</code></pre>
<p>在客户端和服务器之间开始握手之后。
我在 <code>wireshark</code> 的帮助下调试了这两者之间的数据传输。
在 <code>wireshark</code> 日志中,它显示握手是使用 TCP 协议(protocol)而不是 <code>TLS</code> 发生的。
我希望握手应该通过 TLSv1.2 协议(protocol)进行。附上相同的屏幕截图。
任何机构都可以帮助我提供示例代码。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我能够找出问题所在。这是wireshark的问题。在 wireshark 中,安全端口是 443,但对于 bonjour 服务,该端口是本地端口,所以我将 bonjour 服务的端口硬编码为 ex 12120 并发布了 bonjour 服务。</p>
<p>现在在wireshark Edit->Preferences->Protocol->HTTP 中,在此wireshark 开始通过TLSv1.2 显示正确的日志(例如客户端hello 和服务器hello 等)后,HTTP 将安全端口更改为12120。谢谢大家的支持。</p></p>
<p style="font-size: 20px;">关于ios - GCDAsyncSocket 与 bonjour 服务 : does startTLS initiate TLS handshake,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/39745736/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/39745736/
</a>
</p>
页:
[1]