Using X509 to Provision Devices in IoT Central outputs json auth key errors

Copper Contributor

We are using an ESP32 to connect to IoT Central. We have been connecting using symm keys but now we are wanting to move forward to production and need to use x509 instead. But when using the following example from esp-azure, I get the following error: 

https://github.com/espressif/esp-azure/tree/master/examples/prov_dev_client_ll_sample 

<- 14:36:06 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_LEAST_ONCE = 0x01 | TOPIC_NAME: $dps/registrations/res/401/?$rid=1 | PACKET_ID: 2 | PAYLOAD_LEN: 156
Error: Time:Tue Oct 22 14:36:06 2019 File:*/esp-azure/azure-iot-sdk-c/provisioning_client/src/prov_device_ll_client.c Func:prov_transport_process_json_reply Line:323 failure retrieving json auth key value
Error: Time:Tue Oct 22 14:36:06 2019 File:*/esp-azure/azure-iot-sdk-c/provisioning_client/src/prov_transport_mqtt_common.c Func:prov_transport_common_mqtt_dowork Line:965 Unable to process registration reply.
I (7640) AZURE_LIB: Doing SDK Work
Error: Time:Tue Oct 22 14:36:06 2019 File:*/esp-azure/azure-iot-sdk-c/provisioning_client/src/prov_device_ll_client.c Func:on_transport_registration_data Line:572 Failure retrieving data from the provisioning service
Failure encountered on registration PROV_DEVICE_RESULT_PARSING
E (7680) esp-tls: write error :-80:
Info: Error from SSL_write: -80
-> 14:36:06 DISCONNECT
Error: Time:Tue Oct 22 14:36:06 2019 File:*/esp-azure/port/src/tlsio_esp_tls.c Func:tlsio_esp_tls_destroy Line:152 tlsio_esp_tls_destroy called while not in TLSIO_STATE_CLOSED.
I (7700) AZURE_LIB: Registeration Failed...

 

 

Is there a special route I need to take to implement dps to connect to IoT Central? Documentation do not do a good job in explaining the actual code needed to connect to IoT Central specifically. 

 

 

4 Replies
Greetings - can you give us some more information.

1. Have you created a device in IoTCentral ?
2. Also have you uploaded the root cert you are using here to the IoT Central app.

Actually was able to resolve the issue. Turns out it was just a x509 cert creation error. 

 

Thank you! 

Got it, let us know how we can help.
Thank you! Actually just had a question that popped up in my head. Is there anyway around the idea of hard coding in the scope id for the DPS for the IoT Central to make our devices more susceptible for IoT Central app changes ?