c - 使用设备配置服务时出现错误和段错误

标签 c azure-iot-hub azure-iot-sdk

我正在尝试使用 c SDK 从我的设备使用设备配置服务来连接到集线器。我正在使用个人注册和 X.509。我使用 SDK 的“dice_device_enrollment”工具生成的证书在集线器上创建了个人注册。我还在设备上安装了证书。当我运行代码时,执行 Prov_Device_LL_DoWork() 函数时出现 (OpenSSL) 错误。当我第二次调用Prov_Device_LL_DoWork()时,程序段错误。

输出:

08:11:25 10-10-2018  [info] Prov_Device_LL_DoWork
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/c-utility/adapters/x509_openssl.c Func:log_ERR_get_error Line:29 Failure creating private key evp_key
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/c-utility/adapters/x509_openssl.c Func:log_ERR_get_error Line:36   [0] error:0906D06C:PEM routines:PEM_read_bio:no start line
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/c-utility/adapters/x509_openssl.c Func:log_ERR_get_error Line:36   [1] error:0906D064:PEM routines:PEM_read_bio:bad base64 decode
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/c-utility/adapters/tlsio_openssl.c Func:log_ERR_get_error Line:428 unable to use x509 authentication
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1251 Failed creating the OpenSSL instance.
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1000 Error: io_open failed
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/provisioning_client/src/prov_transport_mqtt_common.c Func:create_connection Line:567 Failure connecting to mqtt server
Error: Time:Wed Oct 10 08:11:25 2018 File:/home/tijmen/azure-iot-sdk-c/provisioning_client/src/prov_transport_mqtt_common.c Func:prov_transport_common_mqtt_dowork Line:874 unable to create amqp connection
08:11:25 10-10-2018  [info] Prov_Device_LL_DoWork
Segmentation fault

相同的代码可以在我的开发机器上运行,但使用的 OpenSSL 版本略有不同: 在开发机器上 OpenSSL 1.0.1t 2016 年 5 月 3 日 在设备上 OpenSSL 1.0.2d 2015 年 7 月 9 日

我错过的 OpenSSL 版本有要求吗?

最佳答案

事实证明,升级 OpenSSL 可以解决这个问题。 我从 https://github.com/openssl/openssl/tree/OpenSSL_1_0_2-stable 构建了 OpenSSL 版本 1.0.2q并将其链接到我的应用程序。这解决了错误。看来 SDK,至少 X.509 功能需要比 1.0.2d 2015 年 7 月 9 日更高版本的 OpenSSL。

关于c - 使用设备配置服务时出现错误和段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52755182/

相关文章:

azure - 从浏览器端连接到 Azure IoT/事件中心

javascript - Azure IoT 推送通知

Azure IoT边缘以编程方式[NodeJS]创建边缘和叶子设备之间的父子关系

Azure IoT - 如果服务器和客户端都更改设备孪生属性怎么办?

c# - 在同一进程中处理消息并将其发送到云端而不丢失数据的良好设计是什么?

azure - 安装适用于 C 的 Azure IoT SDK 时遇到问题

c - 为什么我得到一个close : Bad file descriptor error for this fork pipe c program?

c - 我如何使用指针来使用 malloc 存储多个字符串

c - Linux 链接一个共享对象

C 警告 'return' 没有值,函数返回非空