m5stack / Core2-for-AWS-IoT-Kit

Accompanying code for use with AWS IoT Kit content. Works with PlatformIO and ESP-IDF v4.2.
https://m5stack.com/collections/m5-core/products/m5stack-core2-esp32-iot-development-kit-for-aws-iot-edukit
MIT License
127 stars 66 forks source link

Multiple device registration causes KID error #80

Open rashedtalukder opened 3 years ago

rashedtalukder commented 3 years ago

If the registration script is run for a second+ device after the first one, it results in a kid error due to the manifest handler only accepting 1 file in the output_files path. Solution is to 1/ reuse signer cert if it exists 2/ generate unique cert names using the serial number and match against manifest name.

Traceback (most recent call last):
  File "/Core2-for-AWS-IoT-EduKit/Blinky-Hello-World/utilities/AWS_IoT_registration_helper/registration_helper.py", line 215, in <module>
    main() 
  File "/Core2-for-AWS-IoT-EduKit/Blinky-Hello-World/utilities/AWS_IoT_registration_helper/registration_helper.py", line 211, in main
    upload_manifest()
  File "/Core2-for-AWS-IoT-EduKit/Blinky-Hello-World/utilities/AWS_IoT_registration_helper/registration_helper.py", line 166, in upload_manifest
    invoke_import_manifest('Default', manifest_data, signer_cert_bytes)
  File "/Core2-for-AWS-IoT-EduKit/Blinky-Hello-World/utilities/AWS_IoT_registration_helper/../trustplatform/TrustnGO/Microchip_manifest_handler.py", line 238, in invoke_import_manifest
    manifest_item = ManifestItem(next(iterator), verification_cert)
  File "/Core2-for-AWS-IoT-EduKit/Blinky-Hello-World/utilities/AWS_IoT_registration_helper/../trustplatform/TrustnGO/Microchip_manifest_handler.py", line 176, in __init__
    self.run()
  File "/Core2-for-AWS-IoT-EduKit/Blinky-Hello-World/utilities/AWS_IoT_registration_helper/../trustplatform/TrustnGO/Microchip_manifest_handler.py", line 195, in run
    raise ValueError('kid does not match certificate value')
ValueError: kid does not match certificate value
mstfldmr commented 2 years ago

deleting IoT thing and IoT certificate also works