NWProtocolTLS.Options init() supported default cipher suites iOS 13 ?

Hello,


I have a local WebSocket server running inside an iOS app on iOS 13+. I'm using Swift NIO Transport Services for the server.


I'm using NWProtocolTLS.Options from Network framework to specify TLS options for my server.


I am providing my server as an XCFramework and want to let users to be able to specify different parameters when launching the server.


For specifiying the TLS supported version, everything is working fine by using :


public func sec_protocol_options_set_max_tls_protocol_version(_ options: sec_protocol_options_t, _ version: tls_protocol_version_t)


public func sec_protocol_options_set_min_tls_protocol_version(_ options: sec_protocol_options_t, _ version: tls_protocol_version_t)


But I also want to be able to specify some cipher suites. I saw that I can use :


public func sec_protocol_options_append_tls_ciphersuite(_ options: sec_protocol_options_t, _ ciphersuite: tls_ciphersuite_t)


But it seems that some cipher suites are enabled by default and I can't restrict the cipher suites just to the ones I want, I can just append others.


NWProtocolTLS.Options class has an init() function which states "Initializes a default set of TLS connection options" on Apple documentation.


So my question is, is there a way to know what TLS parameters this initialization does ? Especially the list of cipher suites enabled by default ? Because I can't find any information about it from my research. I used a tool to test handshake with my server to discover the cipher suites supported and enabled by default but I don't think it is a good way to be sure about this information.


And is there a way to specify only cipher suites I want to be supported by my server by using NWProtocolTLS.Options ?


Thank you in advance,


Christophe

Accepted Reply

No, NWProtocolTLS.Options does not provide a default list of Cipher Suites.

| So, when using NWProtocolTLS.Options initializer, I have no way to retrieve the list of

| cipher suites that are enabled by default in the current environment, correct ?


There is no API to restrict NWProtocolTLS.Options to a specific Cipher Suite on a connection. I would open an enhancement request for this and follow up with the specific feedback number on this thread.

| Therefore, I cannot restrict to some specific cipher suites if I wanted to ? I can only

| append ones from tls_ciphersuite_t enum ?



Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Replies

Yes, a default set of cipher suites is not documented anywhere because different cipher suites could apply to different situations. For example, certain cipher suites used in TLS 1.2 versus TLS 1.3. tls_ciphersuite_t, does have each of the available optionslisted here by AES, Cha Cha Poly, Elliptic Curve, and RSA in case this helps.



Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Hi,


Thanks for the reply, I understand.

I have seen the tls_ciphersuite_t enum but it does not help with knowing what cipher suites are supported by default when I call NWProtocolTLS.Options initializer.


So, when using NWProtocolTLS.Options initializer, I have no way to retrieve the list of cipher suites that are enabled by default in the current environment, correct ? Therefore, I cannot restrict to some specific cipher suites if I wanted to ? I can only append ones from tls_ciphersuite_t enum ?


Thanks,

Christophe B.

No, NWProtocolTLS.Options does not provide a default list of Cipher Suites.

| So, when using NWProtocolTLS.Options initializer, I have no way to retrieve the list of

| cipher suites that are enabled by default in the current environment, correct ?


There is no API to restrict NWProtocolTLS.Options to a specific Cipher Suite on a connection. I would open an enhancement request for this and follow up with the specific feedback number on this thread.

| Therefore, I cannot restrict to some specific cipher suites if I wanted to ? I can only

| append ones from tls_ciphersuite_t enum ?



Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Hi,


Thank you very much for your answer, it's clear.


Okay, thanks, it would be great to be able to specify only certain cipher suites.


Christophe B.