App Transport Security disabled and still getting SSL Handshake Error

假装没事ソ 提交于 2019-12-13 01:13:29

问题


I'm having trouble with making a connection to an API over HTTPS/SSL. I've completely disabled App Transport Security (ATS) using the below dictionary (despite the fact that the SSL certificate passes all the tests from NSCURL).

<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
</plist>

BUT: There's still an SSL Handshake error (below) that, when Googled, only suggests it's to do with App Transport Security.

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

I've created a minimal sample project that demonstrates the issue, available on GitHub (https://github.com/samheather/AppTransportSecurityDemo). You should find that on running the project it crashes within a couple of seconds (straight after it tries to make the connection in viewDidLoad).

The domain that I'm trying to connect to is https://demo.heather.sh, and a sample URL that the certificate that has a response (so the certificate can be viewed) is https://demo.heather.sh:443/checkOnline.

Any ideas anyone?

Thanks!

Sam


回答1:


As described on iOS App Transport Security not accepting TLSv1.2 connection and plist exceptions not making any difference, the issue was that the server wasn't serving the certificate combined with the Intermediate certificate. Now that this is fixed, everything works :)

As Anand (above) says, a great tool to check this is: http://ssllabs.com/ssltest/analyze.html?d=



来源:https://stackoverflow.com/questions/36208890/app-transport-security-disabled-and-still-getting-ssl-handshake-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!