Giter VIP home page Giter VIP logo

Comments (7)

lucam-sma avatar lucam-sma commented on August 17, 2024

Hi all,
as an update, I got the same error even with X509 authentication procedure (in place of the SAS method described above)

from iot-middleware-freertos-samples.

danewalton avatar danewalton commented on August 17, 2024

Hi @acvin
Thanks for the question. Off the top of my head, I'm hoping to do a few sanity checks. I want to make sure these credentials are formatted correctly.

For SAS key, it should resemble the following:

/**
 * @brief Device symmetric key
 *
 */
#define democonfigDEVICE_SYMMETRIC_KEY      "fsOVd4h4yabcd7CrgnMGP4UGVnPM0NbFRxyzxvbSoC4="

For the Cert auth (RSA), it should resemble the following:

/**
 * @brief Client's X509 Certificate.
 *
 */
#define democonfigCLIENT_CERTIFICATE_PEM    \
"-----BEGIN CERTIFICATE-----\n" \
"MIIC/zCCAeegAwIBAgIUUISm0r63y4CCdmo4wjQKFehIaMMwDQYJKoZIhvcNAQEL\n" \
"BQAwDzENMAsGA1UEAwwEdGVtcDAeFw0yMjAxMjExOTE3MzFaFw0yMjAyMjAxOTE3\n" \
"MzFaMA8xDTALBgNVBAMMBHRlbXAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n" \
"AoIBAQD6cmYAi9EUTQlNTRLXXdx7ialWAEziXyeV1mNnwVBKYD90T1g7pdo+2xRm\n" \
"kaMEonk1PAHSRyXz8XcUdLup2Gzr/C8iOh71pv3mXpLcf0RwQiRDG5DvFU/VMADm\n" \
"ugGCSe2A/PCAqqICQrLWOIToTD3GMwjvvfYvxLbA+RbN3cXfImzDjFQniUduzCgO\n" \
"Z4gxq0TX0FSC3VhJNmo8RTf+SLl/1S5aTQNCzvjcj/juv1NnDfbSd36efNXSLtA2\n" \
"qxGuqEhy/n0+GVBeXUgfJ2Ns7VBng7gBOabh/V23vP8gd8BIIRAEpdVrkWHCVjZo\n" \
"HAqsYrDBLZMPO6Lot8hC7abcdn8lAgMBAAGjUzBRMB0GA1UdDgQWBBRvKB3uNgdB\n" \
"wykTGf3OYzl9n3/nQzAfBgNVHSMEGDAWgBRvKB3uNgdBwykTGf3OYzl9n3/nQzAP\n" \
"BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCDx/g2xbASB6cwxSAU\n" \
"GQCeDyFR2ZAjJ19zQVn1RPvHi3lhfSZJA++JrpvCKOokbp4p3rRArxsVSELAG9I4\n" \
"DWj0G962ffpJO4FhGRNQAceQVPkSrk/gefhHIE5zBFxkWnA/QoVkmDVslciYdRGx\n" \
"vrit6/p3JUS9HN9nF7pX+Nf4q1cqSZTiQHawVFGogjTOMs8KuaqqObDCz25e7bag\n" \
"SX7Ld+pFa7Za4feyI1UZEkVXsLFwV1hYd24BKwR293iD+gt2EIrUOx3wL0SLIIl5\n" \
"ohd05GMa3KuKCDKGnjEfzJbI87LZusU9p3VuaXyeKhD4IShVLW9xNIU+2CjOkWoN\n" \
"uqcc\n" \
"-----END CERTIFICATE-----"

/**
 * @brief Client's private key.
 * 
 */
#define democonfigCLIENT_PRIVATE_KEY_PEM    \
"-----BEGIN RSA PRIVATE KEY-----\n" \
"MIIEpgIBAAKCAQEA+nJmAIvRFE0JTU0S113ce4mpVgBM4l8nldZjZ8FQSmA/dE9Y\n" \
"O6XaPtsUZpGjBKJ5NTwB0kcl8/F3FHS7qdhs6/wvIjoe9ab95l6S3H9EcEIkQxuQ\n" \
"7xVP1TAA5roBgkntgPzwgKqiAkKy1jiE6Ew9xjMI7732L8S2wPkWzd3F3yJsw4xU\n" \
"J4lHbswoDmeIMatE19BUgt1YSTZqPEU3/ki5f9Uhjk0DQs743I/47r9TZw320nd+\n" \
"nnzV0i7QNqsRrqhIcv59PhlQXl1IHydjbO1QZ4O4ATmm4f1dt7z/IHfASCEQBKXV\n" \
"a5FhwlY2aBwKrGKwwS2TDzui6LfIQuzVAwp/JQIDAQABAoIBAQCryTZQH5ddPm4n\n" \
"+Lr4wOgQUN+3HuOdzrkfXPu4WnARZC2CQT57Q4sM3EcFB9ZywmMzcaKqMqVEy5br\n" \
"kBp9KPelc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iSg2oh+bQ/8SUoY4lBpBUFCl\n" \
"ga+tINVoaaRKs51FYgXfnjEBJug71lfBoeKPyhqvu/wpwHTHcYG7kXjvlc6VdKOj\n" \
"pZUTBPSNyMWddrmykPTEsbnDutgIbt5LMFH2RVc+luX39XOYkJ9i+1R7\n" \
"-----END RSA PRIVATE KEY-----"

Do yours look similar?

from iot-middleware-freertos-samples.

lucam-sma avatar lucam-sma commented on August 17, 2024

Hi @danewalton ,
both look similar. The formatting for SAS and the headers for the X509. I have tried to switch between SAS and X509, same results. It seems related to the Mbedtls issue.
I will try to fall back to a previous version to see if anything has changed.
Any hint from your side? Could I activate a more verbose debug?

from iot-middleware-freertos-samples.

danewalton avatar danewalton commented on August 17, 2024

Hmmm I'm running on windows WSL2 with Ubuntu 20.04. I have the samples working on it.

Are you able to get a Wireshark trace of what you are seeing?

from iot-middleware-freertos-samples.

lucam-sma avatar lucam-sma commented on August 17, 2024

Hi @danewalton,
I am repeating the operation over WSL2 on Windows 10, using Ubuntu 20.04 LTS. Debug messages are slightly different with the same error message. Please find below my debug console:

[INFO] [AzureIoTDemo] [vApplicationIPNetworkEventHook:162] ---------STARTING DEMO---------
[INFO] [AzureIoTDemo] [vApplicationIPNetworkEventHook:171]
IP Address: 192.168.1.100
[INFO] [AzureIoTDemo] [vApplicationIPNetworkEventHook:174] Subnet Mask: 255.255.255.0
[INFO] [AzureIoTDemo] [vApplicationIPNetworkEventHook:177] Gateway Address: 192.168.1.1
[INFO] [AzureIoTDemo] [vApplicationIPNetworkEventHook:180] DNS Server Address: 1.1.1.1
[INFO] [AzureIoTDemo] [prvConnectToServerWithBackoffRetries:580] Creating a TLS connection to cuc.azure-devices.net:8883.
[ERROR] [TlsTransport] [tlsHandshake:571] Failed to perform TLS handshake: lMbedtlsError[-128]= : .
[ERROR] [TlsTransport] [TLS_Socket_Connect:729] Failed to do TLS handshake 4.
[WARN] [AzureIoTDemo] [prvConnectToServerWithBackoffRetries:603] Connection to the IoT Hub failed [4]. Retrying connection with backoff and jitter [133]ms.`

Please find attached the Wireshark dump. It seems is correctly started, then it gets a RST request from the host.

Screenshot from 2022-01-25 10-38-01
Thank you

from iot-middleware-freertos-samples.

lucam-sma avatar lucam-sma commented on August 17, 2024

Hi @danewalton
Finally figured out the issue, that was related to our internal firewall preventing incoming DTLS connections.
Thank you for your support!

from iot-middleware-freertos-samples.

danewalton avatar danewalton commented on August 17, 2024

Sounds good glad you were able to figure it out!

from iot-middleware-freertos-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.