Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. [security] Introducing signing support to MySensors

[security] Introducing signing support to MySensors

Scheduled Pinned Locked Moved Development
security
491 Posts 48 Posters 334.2k Views 30 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O otto001

    @Anticimex:

    Thanks anyway! I will try again without signing. Maybe there is a problem in the recent devel-branch. With stable 1.4 it compiled without any issues...
    /update: does not compile with the "standard" ethernet-gw sketch too.... not related to signing...

    AnticimexA Offline
    AnticimexA Offline
    Anticimex
    Contest Winner
    wrote on last edited by
    #94

    @otto001
    Alright. Thanks for confirming. I had a rough period on development with the signing support when I was developing it. Other commits kept breaking it (not intentionally but because there was other changes to the init sequences and such which did not take signing into account). And I have been busy doing other things so I have not refreshed my own sketches to HEAD on development for a couple of months so I am uncertain on the working state at the moment, but I trust @hek to let me know if something breaks again :)
    I will get back on track soon I hope but project :baby: is coming up and is sure to mess quite a bit with my schedule :) so I trust others to keep me informed if signing support should fail.

    Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

    1 Reply Last reply
    0
    • F Offline
      F Offline
      franklin216
      wrote on last edited by
      #95

      I do not understand how to set the Backend in the myconfig.h.

      "you need to decide what signing backend to use. This is done in MyConfig.h"

      But how? Just by commenting out the Pin Define?

      1 Reply Last reply
      0
      • AnticimexA Offline
        AnticimexA Offline
        Anticimex
        Contest Winner
        wrote on last edited by
        #96

        My post is not really up2date with the code at the moment (at least on development branch). You now pick you backend by argument to the MySensor constructor. I will check with @hek how we should handle this post when master and development are diverging.

        Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

        1 Reply Last reply
        0
        • F Offline
          F Offline
          franklin216
          wrote on last edited by
          #97

          Thank you for your quick reply :-) Now it is clearer to me.

          1 Reply Last reply
          0
          • AnticimexA Offline
            AnticimexA Offline
            Anticimex
            Contest Winner
            wrote on last edited by
            #98

            Good! I will look into how the post can be clearer and handle the code specifics better with respect to both "master" and "development" where applicable. Sorry for the discrepancy :)

            Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

            1 Reply Last reply
            0
            • AnticimexA Offline
              AnticimexA Offline
              Anticimex
              Contest Winner
              wrote on last edited by
              #99

              First post updated to better reflect the state of the 'development' branch. Signing is currently not available on 'master'.

              Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

              1 Reply Last reply
              0
              • scalzS Offline
                scalzS Offline
                scalz
                Hardware Contributor
                wrote on last edited by scalz
                #100

                Hi @Anticimex,

                I read your first post and followed it, it was very interesting and comprehensible. So I am trying autentication to see how it looks. I entered the key in a Gateway (nano) and a mini pro node. The mini is running DHT Humidity sketch (I know it is not very interesting node for autentication but it's easy on breadboard). I am using latest dev branch. Communication seems to work but i am a little confused with serial output on GW as I see some no sign. It seems that humidity is ok, but not the temperature child.. but I am not sure.

                What do you think I am doing wrong?

                Edit: I am getting others nosign... Does presentation and version messages uses autentication too? because they seem to be ok but not the child sensors value..

                Here is GW logs:

                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=15,pt=2,l=2,sg=0:1
                0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01F989B
                0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=1:1.5 b1
                10;255;0;0;17;1.5 b1
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:017DA4B
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=1:0
                10;255;3;0;6;0
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01C7E11
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=1:Humidity
                10;255;3;0;11;Humidity
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:017B669
                0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=1:1.0
                10;255;3;0;12;1.0
                0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
                10;0;0;0;7;
                0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
                10;1;0;0;6;
                0;0;3;0;9;no sign
                0;0;3;0;9;no sign
                AnticimexA 1 Reply Last reply
                0
                • scalzS scalz

                  Hi @Anticimex,

                  I read your first post and followed it, it was very interesting and comprehensible. So I am trying autentication to see how it looks. I entered the key in a Gateway (nano) and a mini pro node. The mini is running DHT Humidity sketch (I know it is not very interesting node for autentication but it's easy on breadboard). I am using latest dev branch. Communication seems to work but i am a little confused with serial output on GW as I see some no sign. It seems that humidity is ok, but not the temperature child.. but I am not sure.

                  What do you think I am doing wrong?

                  Edit: I am getting others nosign... Does presentation and version messages uses autentication too? because they seem to be ok but not the child sensors value..

                  Here is GW logs:

                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=15,pt=2,l=2,sg=0:1
                  0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                  0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01F989B
                  0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=1:1.5 b1
                  10;255;0;0;17;1.5 b1
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                  0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:017DA4B
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=1:0
                  10;255;3;0;6;0
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                  0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01C7E11
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=1:Humidity
                  10;255;3;0;11;Humidity
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                  0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:017B669
                  0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=1:1.0
                  10;255;3;0;12;1.0
                  0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
                  10;0;0;0;7;
                  0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
                  10;1;0;0;6;
                  0;0;3;0;9;no sign
                  0;0;3;0;9;no sign
                  AnticimexA Offline
                  AnticimexA Offline
                  Anticimex
                  Contest Winner
                  wrote on last edited by
                  #101

                  @scalz Thanks.
                  Could you please also post the construction code of your MySensor object.
                  And also your MyConfig.h changes (where you enable the signing functionality). Don't post your private key though :)
                  The initial setup is all signed and well but then your node seem to not even attempt to sign the data it sends (because it should have sent a c=3,t=16 and waited for a c=3,t=17 prior to any sensor data).
                  I see from the first two messages that the gateway has been informed that your sensor require signatures (of messages from the gateway). And the gateway do respond that it also require signautres but for some reason your sensor do not sign the sensor values (the presentation handshaking is transmitted in signed form as expected).
                  I don't have a quick answer to why your node does not sign it's sensor data. Could you also share your code that transmits (in your sketch that is). Perhaps the easiest is to post the entire sketch :) (WITHOUT your private key).

                  I am afraid I have to prioritize my newborn son, so I hope for understanding if my replies will be delayed. @hek might know if something has happened on dev branch that could affect signing. I did thoroughly test it when it was submitted but I have not been keeping track on activities on dev for a while now.

                  Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                  1 Reply Last reply
                  0
                  • scalzS Offline
                    scalzS Offline
                    scalz
                    Hardware Contributor
                    wrote on last edited by scalz
                    #102

                    @Anticimex: Congratulation for your son! it is not hurry, no problem. and thank you for taking time.
                    So maybe I am missing something, because I have no key in the sketch??? I am using ATSHA hardware chip.. The key is stored by using SHAPersonalizer, isn't it??

                    I have not made any changes in Myconfig.h as it is default enabled. So it is like this:

                    // Disable to completly disable signing functionality in library
                    #define MY_SIGNING_FEATURE
                    

                    And the node sketch:

                    #include <SPI.h>
                    #include <MyTransportNRF24.h>
                    #include <MyHwATMega328.h>
                    #include <MySensor.h> 
                    #include <DHT.h>  
                    #include <MySigningAtsha204.h>
                    
                    #define CHILD_ID_HUM 0
                    #define CHILD_ID_TEMP 1
                    #define HUMIDITY_SENSOR_DIGITAL_PIN 5
                    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                    
                    MyTransportNRF24 radio;  // NRFRF24L01 radio driver
                    MyHwATMega328 hw; // Select AtMega328 hardware profile
                    MySigningAtsha204 signer; // Select HW ATSHA signing backend
                    MySensor gw(radio, hw, signer);
                    
                    DHT dht;
                    float lastTemp;
                    float lastHum;
                    boolean metric = true; 
                    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                    
                    
                    void setup()  
                    { 
                      gw.begin(NULL, 10);
                      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
                    
                      // Send the Sketch Version Information to the Gateway
                      gw.sendSketchInfo("Humidity", "1.0");
                    
                      // Register all sensors to gw (they will be created as child devices)
                      gw.present(CHILD_ID_HUM, S_HUM);
                      gw.present(CHILD_ID_TEMP, S_TEMP);
                      
                      metric = gw.getConfig().isMetric;
                    }
                    
                    void loop()      
                    {  
                      delay(dht.getMinimumSamplingPeriod());
                    
                      float temperature = dht.getTemperature();
                      if (isnan(temperature)) {
                          Serial.println("Failed reading temperature from DHT");
                      } else if (temperature != lastTemp) {
                        lastTemp = temperature;
                        if (!metric) {
                          temperature = dht.toFahrenheit(temperature);
                        }
                        gw.send(msgTemp.set(temperature, 1));
                        Serial.print("T: ");
                        Serial.println(temperature);
                      }
                      
                      float humidity = dht.getHumidity();
                      if (isnan(humidity)) {
                          Serial.println("Failed reading humidity from DHT");
                      } else if (humidity != lastHum) {
                          lastHum = humidity;
                          gw.send(msgHum.set(humidity, 1));
                          Serial.print("H: ");
                          Serial.println(humidity);
                      }
                    
                      gw.sleep(SLEEP_TIME); //sleep a bit
                    }
                    

                    and in Serial Gateway, I have only changed this:

                    // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                    //MySigningNone signer;
                    //MySigningAtsha204Soft signer;
                    MySigningAtsha204 signer;
                    
                    // Hardware profile 
                    MyHwATMega328 hw;
                    
                    // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                    // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
                    #ifdef WITH_LEDS_BLINKING
                    MySensor gw(transport, hw , signer, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
                    #else
                    MySensor gw(transport, hw , signer);
                    #endif
                    
                    AnticimexA 1 Reply Last reply
                    0
                    • scalzS scalz

                      @Anticimex: Congratulation for your son! it is not hurry, no problem. and thank you for taking time.
                      So maybe I am missing something, because I have no key in the sketch??? I am using ATSHA hardware chip.. The key is stored by using SHAPersonalizer, isn't it??

                      I have not made any changes in Myconfig.h as it is default enabled. So it is like this:

                      // Disable to completly disable signing functionality in library
                      #define MY_SIGNING_FEATURE
                      

                      And the node sketch:

                      #include <SPI.h>
                      #include <MyTransportNRF24.h>
                      #include <MyHwATMega328.h>
                      #include <MySensor.h> 
                      #include <DHT.h>  
                      #include <MySigningAtsha204.h>
                      
                      #define CHILD_ID_HUM 0
                      #define CHILD_ID_TEMP 1
                      #define HUMIDITY_SENSOR_DIGITAL_PIN 5
                      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                      
                      MyTransportNRF24 radio;  // NRFRF24L01 radio driver
                      MyHwATMega328 hw; // Select AtMega328 hardware profile
                      MySigningAtsha204 signer; // Select HW ATSHA signing backend
                      MySensor gw(radio, hw, signer);
                      
                      DHT dht;
                      float lastTemp;
                      float lastHum;
                      boolean metric = true; 
                      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                      
                      
                      void setup()  
                      { 
                        gw.begin(NULL, 10);
                        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
                      
                        // Send the Sketch Version Information to the Gateway
                        gw.sendSketchInfo("Humidity", "1.0");
                      
                        // Register all sensors to gw (they will be created as child devices)
                        gw.present(CHILD_ID_HUM, S_HUM);
                        gw.present(CHILD_ID_TEMP, S_TEMP);
                        
                        metric = gw.getConfig().isMetric;
                      }
                      
                      void loop()      
                      {  
                        delay(dht.getMinimumSamplingPeriod());
                      
                        float temperature = dht.getTemperature();
                        if (isnan(temperature)) {
                            Serial.println("Failed reading temperature from DHT");
                        } else if (temperature != lastTemp) {
                          lastTemp = temperature;
                          if (!metric) {
                            temperature = dht.toFahrenheit(temperature);
                          }
                          gw.send(msgTemp.set(temperature, 1));
                          Serial.print("T: ");
                          Serial.println(temperature);
                        }
                        
                        float humidity = dht.getHumidity();
                        if (isnan(humidity)) {
                            Serial.println("Failed reading humidity from DHT");
                        } else if (humidity != lastHum) {
                            lastHum = humidity;
                            gw.send(msgHum.set(humidity, 1));
                            Serial.print("H: ");
                            Serial.println(humidity);
                        }
                      
                        gw.sleep(SLEEP_TIME); //sleep a bit
                      }
                      

                      and in Serial Gateway, I have only changed this:

                      // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                      //MySigningNone signer;
                      //MySigningAtsha204Soft signer;
                      MySigningAtsha204 signer;
                      
                      // Hardware profile 
                      MyHwATMega328 hw;
                      
                      // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                      // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
                      #ifdef WITH_LEDS_BLINKING
                      MySensor gw(transport, hw , signer, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
                      #else
                      MySensor gw(transport, hw , signer);
                      #endif
                      
                      AnticimexA Offline
                      AnticimexA Offline
                      Anticimex
                      Contest Winner
                      wrote on last edited by
                      #103

                      @scalz Thanks :)
                      Correct. With HW ATSHA204A no key in the sketch is necessary.
                      And your setup seem ok since there are signed messages being passed successfully so the HW seem ok.

                      Perhaps you could add a debug print that dumps your messages in the gateway before they are checked for signatures in MySensor::process?
                      Just put debug(PSTR("read: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d\n"), msg.sender, msg.last, msg.destination, msg.sensor, mGetCommand(msg), msg.type, mGetPayloadType(msg), mGetLength(msg), mGetSigned(msg)); before #ifdef MY_SIGNING_FEATURE.
                      You could also do the corresponding thing in your nodes MySensor::sendRoute function so we can see what data you send in order to determine why your node has decided it should not be signed.

                      It could be you stumbled over a library bug because I see in the code that in sendRoute the if case looks funky.
                      It says:
                      if (DO_SIGN(message.destination) && message.sender == nc.nodeId && !mGetAck(message) && mGetLength(msg) &&
                      but I think it should say
                      if (DO_SIGN(message.destination) && message.sender == nc.nodeId && !mGetAck(message) && mGetLength(message) &&
                      Try to change this and see what happens. I have a strong suspicion that your node's msg buffer is empty, and sendRoute therefore don't sign the message because it gets the length from the wrong buffer.

                      @hek if @scalz tests this successfully, could you patch it? I think it is a bug that it checks mGetLength(msg) and not mGetLength(message) in MySensor::sendRoute.

                      Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                      1 Reply Last reply
                      0
                      • hekH Offline
                        hekH Offline
                        hek
                        Admin
                        wrote on last edited by
                        #104

                        @Anticimex
                        I could probably fix it tonight if it turns out wrong.

                        1 Reply Last reply
                        0
                        • scalzS Offline
                          scalzS Offline
                          scalz
                          Hardware Contributor
                          wrote on last edited by scalz
                          #105

                          @Anticimex @Hek
                          Thank you very much for debugging!
                          First, I tried to add the debug watch. And like you said it seems there was no value.
                          Then, I looked at sendRoute like you advised, and oh!, it makes sense. A tiny small bug is living there !
                          So I changed mGetLength(msg) with mGetLength(message)
                          And now... it seems to work well! yeah! I am so happy :smiley:

                          If you want below is my GW logs (with the debug watch too), but I think it's ok now. there is no unwanted "nosign" anymore.

                          0;0;3;0;9;gateway started, id=0, parent=0, distance=0
                          0;0;3;0;14;Gateway startup complete.
                          0;0;3;0;9;read: 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=15,pt=2,l=2,sg=0:1
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=15,pt=2,l=2,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01F428B
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=1:1.5 b1
                          10;255;0;0;17;1.5 b1
                          0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:013E014
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=1:0
                          10;255;3;0;6;0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:0174D82
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=1:Humidity
                          10;255;3;0;11;Humidity
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01827E7
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=1:1.0
                          10;255;3;0;12;1.0
                          0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=0
                          0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
                          10;0;0;0;7;
                          0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0
                          0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
                          10;1;0;0;6;
                          0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0
                          0;0;3;0;9;read: 10-10-0 s=1,c=3,t=16,pt=0,l=0,sg=0:
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01E4D70
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                          0;0;3;0;9;read: 10-10-0 s=1,c=1,t=0,pt=7,l=5,sg=1:23.0
                          10;1;1;0;0;23.0
                          0;0;3;0;9;read: 10-10-0 s=1,c=1,t=0,pt=7,l=5,sg=0
                          0;0;3;0;9;read: 10-10-0 s=0,c=3,t=16,pt=0,l=0,sg=0:
                          0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:0148CE9
                          0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                          0;0;3;0;9;read: 10-10-0 s=0,c=1,t=1,pt=7,l=5,sg=1:36.0
                          10;0;1;0;1;36.0
                          

                          I have just a last question regarding signature :

                          • in the future, when Mysensors new version will be released, does the controller will have to check the signature and to store the PSK? I think so, as the logs shows it is crypted. For doing this we should inspire ourselves
                            with your atsha_soft, isn't it? It is just curiosity of mine, as I am looking at your libs, and I am thinking about what changes will be involved on controller side when the moment will come for plugin update...

                          Now, I have to check the atsha soft version too, then ota with the recently great improvement of tekka..., and understand all new changes in the message format...lots of things.
                          I like this lib! 1.4 is smart, but dev branch looks very well done and much more optimized.

                          See you soon!

                          AnticimexA 1 Reply Last reply
                          0
                          • scalzS scalz

                            @Anticimex @Hek
                            Thank you very much for debugging!
                            First, I tried to add the debug watch. And like you said it seems there was no value.
                            Then, I looked at sendRoute like you advised, and oh!, it makes sense. A tiny small bug is living there !
                            So I changed mGetLength(msg) with mGetLength(message)
                            And now... it seems to work well! yeah! I am so happy :smiley:

                            If you want below is my GW logs (with the debug watch too), but I think it's ok now. there is no unwanted "nosign" anymore.

                            0;0;3;0;9;gateway started, id=0, parent=0, distance=0
                            0;0;3;0;14;Gateway startup complete.
                            0;0;3;0;9;read: 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=15,pt=2,l=2,sg=0:1
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=15,pt=2,l=2,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01F428B
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=1:1.5 b1
                            10;255;0;0;17;1.5 b1
                            0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=6,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:013E014
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=1:0
                            10;255;3;0;6;0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:0174D82
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=1:Humidity
                            10;255;3;0;11;Humidity
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=8,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=16,pt=0,l=0,sg=0:
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01827E7
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=1:1.0
                            10;255;3;0;12;1.0
                            0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=0
                            0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
                            10;0;0;0;7;
                            0;0;3;0;9;read: 10-10-0 s=0,c=0,t=7,pt=0,l=0,sg=0
                            0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
                            10;1;0;0;6;
                            0;0;3;0;9;read: 10-10-0 s=1,c=0,t=6,pt=0,l=0,sg=0
                            0;0;3;0;9;read: 10-10-0 s=1,c=3,t=16,pt=0,l=0,sg=0:
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:01E4D70
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                            0;0;3;0;9;read: 10-10-0 s=1,c=1,t=0,pt=7,l=5,sg=1:23.0
                            10;1;1;0;0;23.0
                            0;0;3;0;9;read: 10-10-0 s=1,c=1,t=0,pt=7,l=5,sg=0
                            0;0;3;0;9;read: 10-10-0 s=0,c=3,t=16,pt=0,l=0,sg=0:
                            0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=17,pt=6,l=25,sg=0,st=ok:0148CE9
                            0;0;3;0;9;read: 0-0-10 s=255,c=3,t=17,pt=6,l=25,sg=0
                            0;0;3;0;9;read: 10-10-0 s=0,c=1,t=1,pt=7,l=5,sg=1:36.0
                            10;0;1;0;1;36.0
                            

                            I have just a last question regarding signature :

                            • in the future, when Mysensors new version will be released, does the controller will have to check the signature and to store the PSK? I think so, as the logs shows it is crypted. For doing this we should inspire ourselves
                              with your atsha_soft, isn't it? It is just curiosity of mine, as I am looking at your libs, and I am thinking about what changes will be involved on controller side when the moment will come for plugin update...

                            Now, I have to check the atsha soft version too, then ota with the recently great improvement of tekka..., and understand all new changes in the message format...lots of things.
                            I like this lib! 1.4 is smart, but dev branch looks very well done and much more optimized.

                            See you soon!

                            AnticimexA Offline
                            AnticimexA Offline
                            Anticimex
                            Contest Winner
                            wrote on last edited by
                            #106

                            @scalz Great! Thanks for finding and testing this.
                            I am not sure I understand your question. You mean to store the PSK of atsha_soft in encrypted form in the sketch? That is difficult since the encryption secret then needs to be stored somewhere as well.
                            I would recommend (if you do use atsha_soft) to burn the fuses to prevent memory readout to protect the PSK.
                            Normally, this implementation is stored in the gateway which should be physically protected in any case, so the need to protekt PSK in the gateway is less critical than in a node which may be located "outside".

                            Secure OTA is currently unsupported. It might be supported in the future.

                            Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                            1 Reply Last reply
                            0
                            • scalzS Offline
                              scalzS Offline
                              scalz
                              Hardware Contributor
                              wrote on last edited by scalz
                              #107

                              Oh, sorry for my bad english!
                              Is signing just between a Node and a Gateway. or is the controller involved too? Maybe it's a dumb question, I have not checked yet the changes in message.
                              For OTA, I understand it is not suppported by signature as you explained in your tuto. But, in the other hand, I think that for initiating an ota, it should need a signed message, so I think it is good.

                              AnticimexA 1 Reply Last reply
                              0
                              • scalzS scalz

                                Oh, sorry for my bad english!
                                Is signing just between a Node and a Gateway. or is the controller involved too? Maybe it's a dumb question, I have not checked yet the changes in message.
                                For OTA, I understand it is not suppported by signature as you explained in your tuto. But, in the other hand, I think that for initiating an ota, it should need a signed message, so I think it is good.

                                AnticimexA Offline
                                AnticimexA Offline
                                Anticimex
                                Contest Winner
                                wrote on last edited by
                                #108

                                @scalz You decide if your component will require signatures when you create your signer. That is, if you want your gateway to be able to sign messages sent to an actuator (like a lock) but you don't want your gateway to require signed messages from your nodes, you pass a argument to the constructor like this:
                                MySigningAtsha204 signer(false);
                                That will

                                • Configure that node/gw to support signed message processing using HW ATSHA
                                • Have that node/gw inform others that it does not require signed messages
                                • Still permit that node/gw to sign messages sent to other nodes/gw who do requre signing

                                If you stick to default constructor arguments or pass true, the difference is that the node/gw will also inform others that it requires signed messages, and will ignore/discard any message that is not signed which it receive (and is targeted to that particular node/gw). It will not affect messages which are to be relayed, so the node will still work as a relay for unsigned messages.

                                Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                1 Reply Last reply
                                0
                                • scalzS Offline
                                  scalzS Offline
                                  scalz
                                  Hardware Contributor
                                  wrote on last edited by
                                  #109

                                  @Anticimex:
                                  ok, it is good to know. You have thought about everything!
                                  If signer(true) for gateway, Will the controller (Jeedom, Domoticz..) see a crypted payload in serial transmission or will it work like before (I understand there are some changes in message structure, but what about crypted payload, does the controller need to decrypt?)

                                  AnticimexA 1 Reply Last reply
                                  0
                                  • scalzS scalz

                                    @Anticimex:
                                    ok, it is good to know. You have thought about everything!
                                    If signer(true) for gateway, Will the controller (Jeedom, Domoticz..) see a crypted payload in serial transmission or will it work like before (I understand there are some changes in message structure, but what about crypted payload, does the controller need to decrypt?)

                                    AnticimexA Offline
                                    AnticimexA Offline
                                    Anticimex
                                    Contest Winner
                                    wrote on last edited by
                                    #110

                                    @scalz We only sign messages. There is no encryption involved. And the signature is stored without affecting the message contents so it is perfectly compatible with all controllers. The only thing that could affect a controller is the new sign bit in the message header but I don't think that will make any difference as it is not relevant to the controller. It is the gateway that manages this for it.

                                    Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                    1 Reply Last reply
                                    0
                                    • scalzS Offline
                                      scalzS Offline
                                      scalz
                                      Hardware Contributor
                                      wrote on last edited by
                                      #111

                                      ok, it is new for me, so I am mixing vocabulary, but I understand the concept. Thank you, and now I have my answer. no big changes for controller side, great! It makes sense, but I was not sure.

                                      1 Reply Last reply
                                      0
                                      • hekH Offline
                                        hekH Offline
                                        hek
                                        Admin
                                        wrote on last edited by
                                        #112

                                        Fix pushed to development.

                                        1 Reply Last reply
                                        0
                                        • AnticimexA Offline
                                          AnticimexA Offline
                                          Anticimex
                                          Contest Winner
                                          wrote on last edited by
                                          #113

                                          Thanks for that!

                                          Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          11

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular