Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure_IoT_Central_ESP32] Failed decoding SAS key #2352

Closed
matsujirushi opened this issue Sep 28, 2022 · 3 comments
Closed

[Azure_IoT_Central_ESP32] Failed decoding SAS key #2352

matsujirushi opened this issue Sep 28, 2022 · 3 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@matsujirushi
Copy link
Contributor

Describe the bug
"Failed decoding SAS key" occurs when trying individual enrollments of SAS with sample code Azure_IoT_Central_ESP32.

To Reproduce

  1. Generate SAS Key with openssl rand -base64 64 command.
  2. Set SAS Key to IOT_CONFIG_DEVICE_KEY

Expected behavior
The SAS Key generation command openssl rand -base64 64 uses what is written in the Azure IoT Central document.
I am generating a 64 byte key, but it seems that Azure_IoT_Central_ESP32 only supports up to 32 bytes.

I think you should increase ECODED_SAS_KEY_BUFFER_SIZE in the sample code to 64 or change the Azure IoT Central documentation.

Screenshots

Generate SAS key:

$ openssl rand -base64 64
JX5MSR2bjrEpY3siZjcMxaTDcZ//7OPjdmER024lETmj8mZVXHVMvHE/9ELwqomI
tb3TRkmTzdbHbe1ASsR6Lg==

Log:

1970/1/1 00:00:00 [INFO] Connecting to WIFI wifi_ssid seeed2g
..
1970/1/1 00:00:01 [INFO] WiFi connected, IP address: 192.168.1.106
1970/1/1 00:00:01 [INFO] Setting time using SNTP
......
2022/9/28 11:48:07 [INFO] Time initialized!
2022/9/28 11:48:07 [INFO] Azure IoT client initialized (state=2)
2022/9/28 11:48:07 [ERROR] Failed decoding SAS key.
2022/9/28 11:48:07 [ERROR] Failed creating mqtt password for DPS connection.
2022/9/28 11:48:07 [ERROR] Failed initializing MQTT client.
2022/9/28 11:48:07 [ERROR] Azure IoT client is in error state.
@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Sep 28, 2022
@ericwol-msft ericwol-msft self-assigned this Sep 29, 2022
@ericwol-msft
Copy link
Contributor

Yes, the default autogenerated keysize in IoT Central is 32 bytes, but also supports (and DPS) 64 byte device keys. Will update the sample with longer 64 byte key.

@matsujirushi
Copy link
Contributor Author

@ericwol-msft
Copy link
Contributor

Issue resolved with Azure/azure-sdk-for-c-arduino#30

@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants