Help with esp32 softap provisioning security version 1
Posted: Sat Apr 19, 2025 12:09 am
I'm trying to write an app in flutter to perform softap provisioning for an ESP32-C6. I am using the structures defined in the proto files, which I have generated for Dart. I've established a secure session using the shared key and that's confirmed in the logs from the esp, but when I try to send the wifi config information using the shared key and the nonce from session establishment, it doesn't work (response I get back has the error that there's an invalid end tag, or invalid wire type, or the message is truncated). Using verbose logs from the esp shows that the original request I sent is not being decrypted correctly either.
I'm using the cryptography package (https://pub.dev/packages/cryptography) and the implementation of my code is here https://gitlab.com/jadelynx912/app-test ... type=heads.
I've been having to do the counting for AES-CTR manually due to the way the package is working, and I do +2 during session establishment (for the decryption of the response to verify that a secure session was established) since the message size is 64 bytes (2 blocks). I should have to do +1 for the wifi config, since that message is less than 32 bytes, but that is not working. I've tried +0, +2, +3, and +4 to the nonce as well, but that didn't work either. I know that the issue is not the message I'm sending since I am able to successfully provision on security version 0.
Any help would be appreciated, and thanks in advance for your time.
I'm using the cryptography package (https://pub.dev/packages/cryptography) and the implementation of my code is here https://gitlab.com/jadelynx912/app-test ... type=heads.
I've been having to do the counting for AES-CTR manually due to the way the package is working, and I do +2 during session establishment (for the decryption of the response to verify that a secure session was established) since the message size is 64 bytes (2 blocks). I should have to do +1 for the wifi config, since that message is less than 32 bytes, but that is not working. I've tried +0, +2, +3, and +4 to the nonce as well, but that didn't work either. I know that the issue is not the message I'm sending since I am able to successfully provision on security version 0.
Any help would be appreciated, and thanks in advance for your time.