Hi All,
Thank you for your help. Problem resolved.
Here what I have done to make it working:
- follow the tutorial AWS IoT - TLS Client Certificate Authentication | to sign a certificate
- With sudo, import the zymkey into pkcs#11 PKCS#11 Support
- Delete the code block from line 430 ~ 440, aws-iot-device-client/source/main.cpp at main · awslabs/aws-iot-device-client · GitHub
#else
if (config.config.secureElement.enabled)
{
LOGM_ERROR(
TAG,
"*** %s: Secure Element configuration is enabled but feature is not compiled into binary.",
DC_FATAL_ERROR);
deviceClientAbort(
"Invalid configuration. Secure Element configuration is enabled but feature is not compiled into binary.",
EXIT_FAILURE);
}
- Compile the binary file of aws-iot-device-client by command below with debian bulleye:
# Building
git clone https://github.com/awslabs/aws-iot-device-client
cd aws-iot-device-client
mkdir build
cd build
cmake -DEXCLUDE_SECURE_ELEMENT="OFF" ../
cmake --build . --target aws-iot-device-client
- Add configuration
{
...
"secure-element": {
"enabled": false,
"pkcs11-lib": "<replace_with_pkcs11_lib_path>",
"secure-element-pin": "<replace_with_secure_element_pin>",
"secure-element-key-label": "<replace_with_secure_element_key_label>",
"secure-element-slot-id": replace_with_secure_element_slot_id_integer,
"secure-element-token-label": "<replace_with_secure_element_token_label>"
}
...
}
- Make sure the endpoint of IoT Core allows TLS 1.2
- Execute the aws-iot-device-client with root permission
- Finally, the console show the log if everything works:
sign resizing because digest and key lengths (32/64) do not match
2024-07-04T01:57:47.313Z [INFO] {SharedCrtResourceManager.cpp}: MQTT connection established with return code: 0
2024-07-04T01:57:47.313Z [INFO] {SharedCrtResourceManager.cpp}: Shared MQTT connection is ready!
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Config shadow is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Jobs is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Secure Tunneling is enabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Device Defender is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Sample shadow is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Pub Sub is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Sensor Publish is disabled
2024-07-04T01:57:47.314Z [INFO] {SharedCrtResourceManager.cpp}: Starting Device Client features.
2024-07-04T01:57:47.314Z [INFO] {SecureTunnelingFeature.cpp}: Running Secure Tunneling!
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Client base has been notified that Secure Tunneling has started