Hi,
For a few days now I've been trying to get my test-setup to work. I am using a NodeMCU Wifi MQTT gateway connected to my Mosquitto server and a single Arduino pro mini node, both with NRF24 radios. The node is supposed to be updated over the air later on, so I installed the latest MYSBootloader.
I had almost everything up an running 2 days ago including message signing. The only problem remaining was, that while FOTA updates were working, serial firmware uploads through the Arduino IDE were failing. I was able to solve this by compiling the bootloader for a reduced upload speed and at the same time upgraded gateway and node from library version 2.1.1 to 2.2. As it turned out, with version 2.2 over-the-air updates were no longer working. So I downgraded both nodes to version 2.1.1 which fixed FOTA for me.
Unfortunately, message signing seems to be broken now. This is the debug output from the node:
5656 MCO:SLP:WUP=-1
+++ request
5660 Will not sign message for destination 0 as it does not require it
5668 TSF:MSG:SEND,4-4-0-0,s=1,c=2,t=36,pt=0,l=0,sg=0,ft=0,st=OK:
5677 MCO:SLP:MS=3000,SMS=1,I1=255,M1=255,I2=255,M2=255
5683 Will not sign message for destination 0 as it does not require it
5691 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:1520
5937 TSF:MSG:READ,0-0-4,s=1,c=3,t=16,pt=0,l=0,sg=1:
5943 Skipping security for command 3 type 16
SHA256: 118E8C33213D6E353FDF26D2B28D84A5D745CFE2F099D3B2B4AAAAAAAAAAAAAA
5976 Will not sign message for destination 0 as it does not require it
5992 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:118E8C33213D6E353FDF26D2B28D84A5D745CFE2F099D3B2B4
6004 Transmitted nonce
6141 TSF:MSG:READ,0-0-4,s=1,c=1,t=36,pt=0,l=1,sg=1:1
Signature in message: 019753BF095A75BF7ED5A2A7CAE4ECDEBC916EFDF06B044A
Message to process: 00040E01240131
Current nonce: 118E8C33213D6E353FDF26D2B28D84A5D745CFE2F099D3B2B4AAAAAAAAAAAAAA
HMAC: 215BD88BE0543189561A6FCE26ADFAB61E8CF6C6EB2E16BBD514BD506C55082D
Signature bad: 015BD88BE0543189561A6FCE26ADFAB61E8CF6C6EB2E16BB
6324 Signature verification failed!
6334 !TSF:MSG:SIGN VERIFY FAIL
6400 MCO:SLP:TPD
This is the corresponding output on the gateway:
0;255;3;0;9;TSF:MSG:READ,4-4-0,s=1,c=2,t=36,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: gateway1-out/4/1/2/0/36
0;255;3;0;9;TSF:MSG:READ,4-4-0,s=255,c=3,t=22,pt=5,l=4,sg=0:1520
0;255;3;0;9;Sending message on topic: gateway1-out/4/255/3/0/22
0;255;3;0;9;Message arrived on topic: gateway1-in/4/1/1/0/36
0;255;3;0;9;Skipping security for command 3 type 16
0;255;3;0;9;TSF:MSG:SEND,0-0-4-4,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
0;255;3;0;9;Nonce requested from 4. Waiting...
0;255;3;0;9;TSF:MSG:READ,4-4-0,s=255,c=3,t=17,pt=6,l=25,sg=0:118E8C33213D6E353FDF26D2B28D84A5D745CFE2F099D3B2B4
0;255;3;0;9;Nonce received from 4.
0;255;3;0;9;Proceeding with signing...
0;255;3;0;9;Message to process: 00040E01240131
0;255;3;0;9;Current nonce: 118E8C33213D6E353FDF26D2B28D84A5D745CFE2F099D3B2B4AAAAAAAAAAAAAA
0;255;3;0;9;HMAC: 959753BF095A75BF7ED5A2A7CAE4ECDEBC916EFDF06B044ACD49D19B741939C4
0;255;3;0;9;Signature in message: 019753BF095A75BF7ED5A2A7CAE4ECDEBC916EFDF06B044A
0;255;3;0;9;Message signed
0;255;3;0;9;Message to send has been signed
0;255;3;0;9;TSF:MSG:SEND,0-0-4-4,s=1,c=1,t=36,pt=0,l=1,sg=1,ft=0,st=OK:1
Config on the node:
#define MY_SMART_SLEEP_WAIT_DURATION_MS (700ul)
#define MY_DEBUG_VERBOSE_SIGNING //!< Enable signing related debug prints to serial monitor
#define MY_SIGNING_SOFT //!< Software signing
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //!< Unconnected analog pin for random seed
#define MY_SIGNING_REQUEST_SIGNATURES
#define MY_SIGNING_SIMPLE_PASSWD "mysecretpw"
Config on the gateway:
#define MY_DEBUG_VERBOSE_SIGNING //!< Enable signing related debug prints to serial monitor
#define MY_SIGNING_SOFT //!< Software signing
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //!< Unconnected analog pin for random seed
#define MY_SIGNING_SIMPLE_PASSWD "mysecretpw"
Any hint or help would be greatly appreciated!
Best regards,
Christian