Error mbedtls_ssl_handshake()fail when attempting to post data to azure in SPRESENSE

Asked 2 years ago, Updated 2 years ago, 100 views

We are running the LTE Azure-IoT sample application in the SPRESENSE SDK by referring to the site below.

https://developer.sony.com/develop/spresense/docs/sdk_tutorials_ja.html

The azure side generates the Azure IoT Hub name and IoT device name, the primary target shared access key, and saves it in azureiot on the sd card, and stores the portal-azure-com.pem in the CERTS directory as well.

However, if you type lte_azureiot send "ss" in the command, you will fail.
If anyone knows the cause or solution, please let me know.

LTE connect...
LTE connect... OK.

Device message:ss -->Cloud
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake() retry
mbedtls_ssl_handshake()fail
Fail—Connect

LTE disconnect...
lte_radio_off
lte_power_off
lte_finalize
LTE disconnect...OK

spresense

2022-09-30 18:05

1 Answers

Hello.

As far as the command is concerned, the SSL handshake seems to have failed.
The SSL handshake is verifying that the specified certificate is correct, so it may have failed.

Why don't you re-create the certificate portal-azure-com.pem by referring to the following site?
https://developer.sony.com/develop/spresense/docs/sdk_tutorials_ja.html#_%E6%8E%A5%E7%B6%9A%E7%94%A8%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E4%BD%9C%E 6% 88%90

The caveat is that you must use Baltimore CyberTrust Root in this sample, so you must download it from the Baltimore CyberTrust Root tab as instructed in "5. Click on the certificate to download the portal-azure-com.pem from the Baltimore CyberTrust Root

I hope it will be helpful.

August 8, 2022

It seems that the certificates used by https://portal.azure.com/ for the server to connect with AzureIoT sample are now different.
If you look at the source code for lte_azureiot, it appears that you are going to connect to https://<IoT Hub Name>.azure-devices.net.
Download this certificate (Baltimore CyberTrust Root), rename it portal-azure-com.pem and copy it to the CERTS directory on the SD card to ensure proper operation.(I tried it on my account and it worked fine.)
<IoT Hub Name> is the same name as described in resources.txt.


2022-09-30 18:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.