简体   繁体   中英

App Transport Security disabled and still getting SSL Handshake Error

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

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=

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM