How to connect to AWS IoT Core using AWS Embedded SDK from coreMQTT library using mbedTLS

0

I am trying to connect my IoT embedded device to connect to AWS IoT Core MQTT broker by using AWS Embedded C SDK (https://github.com/aws/aws-iot-device-sdk-embedded-C).

I can see that the SDK is using coreMQTT library. This library has dependency on the Transport layer which user need to provide. In the sample demo, the transport layer security is using openssl. Unfortunately I don't have it. I am thinking to use alternative, from online research, it seems mbedTLS is a good alternative. But I could not find online a sample using mbedTLS to connect to AWS IoT Core using coreMQTT. Could someone help me please.

misterb
질문됨 2년 전704회 조회
1개 답변
1

Hi misterb.

The fleet provisioning demo uses mbedTLS: https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/main/demos/fleet_provisioning/fleet_provisioning_with_csr/mqtt_operations.c#L673lL692

Implementation of the transport layer here: https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/main/platform/posix/transport/src/mbedtls_pkcs11_posix.c

You can find more examples in the FreeRTOS and amazon-freertos repos.

Please see here: https://www.freertos.org/network-interface.html

The transport interface implementations included in the FreeRTOS download are split into two files - a wrapper C file specific to the TCP stack, and a supplemental C file specific to using a TLS stack with the selected TCP stack. For example, to use FreeRTOS+TCP with mbedTLS, build sockets_wrapper.c from the network_transport/freertos_plus_tcp directory in the source code distribution, then build using_mbedtls.c from the using_mbedtls subdirectory.

Available transports: https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Source/Application-Protocols/network_transport

mbedtls in particular: https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls.c

And part of the demos that use it: https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_demo_helpers.c#L614-L624

The amazon-freertos repo contains embedded reference implementations for many boards. You can find a coreMQTT demo there: https://github.com/aws/amazon-freertos/blob/main/demos/coreMQTT/mqtt_demo_mutual_auth.c

An mbedtls transport implementation here: https://github.com/aws/amazon-freertos/blob/main/libraries/freertos_plus/standard/tls/src/iot_tls.c

The demo calls this through one of the secure sockets implementations:

profile pictureAWS
전문가
Greg_B
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인