…
Secure Sockets Layer
TLSv1.2 Record Layer: Handshake Protocol: Server Key Exchange
…
Handshake Protocol: Server Key Exchange
Handshake Type: Server Key Exchange (12)
Length: 329
EC Diffie-Hellman Server Params
Curve Type: named_curve (0x03)
Named Curve: secp256k1 (0x0016)
…
As you can see, in the “Client Hello” message the client tells the
server that it supports three different elliptic curves (secp256r1,
secp384r1, secp521r1). The server must choose an elliptic curve from
this list. However, the server has chosen a completely different
curve (secp256k1). This is a clear violation of the TLS EC
negotiation protocol [1], and hence the connection fails.
Specifically, iOS does not support the curve chosen by the server, and
that causes the errSSLProtocol error. You can see this in the Darwin
open source for coreTLS (the TLS implementation used by Apple
platforms). Specifically, SSLDecodeECDHKeyParams (file URL below)
contains this code:
switch(ctx->ecdhPeerCurve) {
case tls_curve_secp256r1:
case tls_curve_secp384r1:
case tls_curve_secp521r1:
break;
default:
… logging elided …
return errSSLProtocol;
}
<
http://www.opensource.apple.com/source/coreTLS/coreTLS-82/lib/sslKeyExchange.c>
You should resolve this problem by fixing the server. If that’s not
possible it may be possible to work around this problem on the client,
but only in some situations and definitely at the expense of security
(you’d basically have to disable the ECDHE TLS cypher suites, which
are the ones that allow for forward secrecy [2]).
Share and Enjoy
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
<
http://www.apple.com/developer/>
[1] Specifically, Section 4 of RFC 4492 says:
A TLS client that proposes ECC cipher suites in its ClientHello
message SHOULD include these extensions. Servers implementing ECC
cipher suites MUST support these extensions, and when a client uses
these extensions, servers MUST NOT negotiate the use of an ECC
cipher suite unless they can complete the handshake while respecting
the choice of curves and compression techniques specified by the
client.
-- <
http://www.ietf.org/rfc/rfc4492.txt>
The server here is breaking the “MUST NOT” requirement above. The
paragraph goes on to say:
This eliminates the possibility that a negotiated ECC handshake will
be subsequently aborted due to a client's inability to deal with the
server's EC key.
Which is exactly what’s happened in this case.
[2] <
https://en.wikipedia.org/wiki/Forward_secrecy>
On March 05, 2016 at 14:00:16 PM GMT,
stus...@gmail.com wrote:
>Name: Shravan Kumar
>Person ID: xxxxxxxx
>E-mail:
xxxxxxxxxx
>Team Name: xxxxxxx
>Team ID: xxxxxxx
>Team Type: Individual
>
>PLATFORM AND VERSION
>iOS
>MacBook Pro mid-2014 model
>El Capitan 10.11.3
>Xcode 7.2.1
>
>Test Device: iPhone 6s with iOS 9.2.1
>
>DESCRIPTION OF PROBLEM
>We are trying to connect to this MQTT server
ssl://
channel.cogxio.com,
and already bypassed all of the ATS securities for testing purpose.
Still, the log is throwing this error: CFNetwork SSLHandshake failed
(-9800).
>
>STEPS TO REPRODUCE
>1. Pod MQTTClient-framework:
https://github.com/ckrey/MQTT-Client-Framework
>2. Disable ATS and add exceptions in info.plist
>3. Connect to open MQTT Brokers:
test.mosquitto.org at port 8883
>4. The log will probably you throw the error, if you follow this code.
>
>
https://gist.github.com/tush4r/6df79f40eb6121e3b522
>
>On the other front, all of the non-secure connections with port: 1883 get easily connected without any trouble.