2 years, 2 months ago.

How to add a Protocol name to Application Layer Protocol Negotiation (ALPN) ProtocolNameList

According to this guide of AWS https://docs.aws.amazon.com/iot/latest/developerguide/protocols.html you must use the ALPN protocol name "x-amzn-mqtt-ca" in the ALPN ProtocolNameList sent by the client as part of the ClientHello message. The question is how to add this name to the ALPN list in mbed.

The TlsSocket class uses the ssl.h header file which has the mbedtls_ssl_conf_alpn_protocols function, but it does not look like it is actually used by the TlsSocket class.

So the questions are

1. How to add this ALPN name?

2. Is it ok to invoke these functions directly?

3. Can anyone refer me to an example which adds ALPN protocol names to the ALPN ProtocolNameList?

You help is greatly appreciated!

1 Answer

2 years, 2 months ago.

Hi Willie,

Thank you for your question and interest in Mbed TLS.

The TlsSocket is a simple socket wrapper on top of TLS, using Mbed TLS. It does not cover all of the TLS functionality. Of course, you can enhance the functionality of TlsSocket to add ALPN support as well.

If you have the TLS configuration, then you cn call these functions directly, however, it is much cleaner and prefered to encapsulate the calls withing TlsSocket.

You can find an example in the TLS repository, for a TLS client that adds ALPN string. It gets as parameter a comma sepearated list of ALPN names, parses this list from the seperator, and calls mbedtls_ssl_conf_alpn_protocols.


Mbed Support


Assigned to Ron Eldor 2 years, 2 months ago.

This means that the question has been accepted and is being worked on.