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. Signing_Soft in dev branch - How to do?

Signing_Soft in dev branch - How to do?

Scheduled Pinned Locked Moved Development
24 Posts 3 Posters 4.7k Views 4 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.
  • AndurilA Offline
    AndurilA Offline
    Anduril
    wrote on last edited by
    #1

    Hey there,

    I was thinking to add signing to my setup, but don't know how. I had a look at the SecureActuator sketch and read Anticimexs explanation a few times.
    I'm going to use soft signing in my gateway (ESP8266) and my nodes. Maybe future nodes will include an atsha204.
    In Anticimexs text he said to need a hmac key to use this, but in the new sketch there is none. Only the random seed pin is selected. Is the hmac not necessary anymore? But that wouldn't make sense to me as this is kind of the preshared key. I also looked in the MyConfig but didn't found anything. Would be realy nice if someone can point me to the right direction.
    Another point I thought about with signing and ota updates: isn't that a little senseless? If you transfer the sketch in plain text OTA then the hmac key is visible to an attacked too. Signing the Update request is good for the security of this node, but the whole network will be kind of exposed afterwards... or am I missing something?

    TheoLT 1 Reply Last reply
    0
    • AndurilA Anduril

      Hey there,

      I was thinking to add signing to my setup, but don't know how. I had a look at the SecureActuator sketch and read Anticimexs explanation a few times.
      I'm going to use soft signing in my gateway (ESP8266) and my nodes. Maybe future nodes will include an atsha204.
      In Anticimexs text he said to need a hmac key to use this, but in the new sketch there is none. Only the random seed pin is selected. Is the hmac not necessary anymore? But that wouldn't make sense to me as this is kind of the preshared key. I also looked in the MyConfig but didn't found anything. Would be realy nice if someone can point me to the right direction.
      Another point I thought about with signing and ota updates: isn't that a little senseless? If you transfer the sketch in plain text OTA then the hmac key is visible to an attacked too. Signing the Update request is good for the security of this node, but the whole network will be kind of exposed afterwards... or am I missing something?

      TheoLT Offline
      TheoLT Offline
      TheoL
      Contest Winner
      wrote on last edited by
      #2

      @Anduril I'm by no means an expert on this. But I studied the signing tutorial this week, because I'm planning the same thing as you are. I think you need to define the HMAC in the MySensors config.h file.

      It sounds logic to me anyway, because there you define it once. And it'll be available in all sketch and gateway nodes. Good luck and let me know if it worked.

      1 Reply Last reply
      0
      • AndurilA Offline
        AndurilA Offline
        Anduril
        wrote on last edited by
        #3

        @TheoL only problem is there is no config.h.
        @Anticimex I checked everything again and compared to the 1.5 lib still in my download folder. There is an option #define MY_HMAC_KEY in the MyConfig.h which is not present in the version of the dev branch. Is that intended or only a mistake?

        TheoLT 1 Reply Last reply
        0
        • AndurilA Anduril

          @TheoL only problem is there is no config.h.
          @Anticimex I checked everything again and compared to the 1.5 lib still in my download folder. There is an option #define MY_HMAC_KEY in the MyConfig.h which is not present in the version of the dev branch. Is that intended or only a mistake?

          TheoLT Offline
          TheoLT Offline
          TheoL
          Contest Winner
          wrote on last edited by
          #4

          @Anduril Sorry my mistake. It is MyConfig.h in the mysensors library directory. I just added my and I've allmost added my first signing node. W00t.

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

            On development branch, all secrets are either stored in the atsha204 or on eeprom/nonvolatile memory. They are not exposed in the sketch. The documentation is updated to reflect this. My signing forum post has a link to doxygen where this is explained. Please let me know if anything remain unclear.

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

            1 Reply Last reply
            0
            • TheoLT Offline
              TheoLT Offline
              TheoL
              Contest Winner
              wrote on last edited by
              #6

              I'm not able to get the signing to work on the ethernet gateway. The sketch is getting to big. I'll continue tomorrow.

              1 Reply Last reply
              0
              • AndurilA Offline
                AndurilA Offline
                Anduril
                wrote on last edited by
                #7

                Thanks a lot @Anticimex for your explanation, I tried to personalize one of my arduinos, but only got serial output of FFFFFF.... as keys for HMAC, Serial and AES. I have nothing connected to this Arduino Nano, so the seedpin should be floating. Anything I did wrong? I only activated #define USE_SOFT_SIGNINGand nothing else. As far as I read your doxygen this should generate random key but not store them in eeprom.

                AnticimexA 1 Reply Last reply
                0
                • AndurilA Anduril

                  Thanks a lot @Anticimex for your explanation, I tried to personalize one of my arduinos, but only got serial output of FFFFFF.... as keys for HMAC, Serial and AES. I have nothing connected to this Arduino Nano, so the seedpin should be floating. Anything I did wrong? I only activated #define USE_SOFT_SIGNINGand nothing else. As far as I read your doxygen this should generate random key but not store them in eeprom.

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

                  @Anduril i am not sure the personolizer supports random key generation for sw signing as I consider it too predictable (I cannot as a sketch designer guarantee that you use a good seed for the rng). I suggest you fantasize together a key or generate it using some other tool when using soft signing and then store it in eeprom using the personalizer. FFFF:s looks a lot like eeprom reset values indicating nothing has been written.

                  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
                    #9

                    Oh, and if you have that configuration, yes, you select not to store anything in eeprom. So naturally, the keys read out are FFFF:s as you have not stored any data.

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

                    1 Reply Last reply
                    0
                    • AndurilA Offline
                      AndurilA Offline
                      Anduril
                      wrote on last edited by
                      #10

                      @Anticimex I completely agree with you that this would not garantee a good random number. Thanks for explaining all this to me.
                      One point still open to me is the AES key. Is it only used for encryption (which does not give a real security in our case)? I suppose it should be also kind of pre shared key, so same value on all nodes? I don't want to enable encryption at the moment, but might be good to already write keys to all nodes in case I want to use it in future.

                      AnticimexA 2 Replies Last reply
                      0
                      • AndurilA Anduril

                        @Anticimex I completely agree with you that this would not garantee a good random number. Thanks for explaining all this to me.
                        One point still open to me is the AES key. Is it only used for encryption (which does not give a real security in our case)? I suppose it should be also kind of pre shared key, so same value on all nodes? I don't want to enable encryption at the moment, but might be good to already write keys to all nodes in case I want to use it in future.

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

                        @Anduril correct. AES is a symmetric crypto which provide some obfuscation. The same key is needed in all nodes. Signing is a per node configuration while encryption is global. None or all in that case.

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

                        1 Reply Last reply
                        0
                        • AndurilA Anduril

                          @Anticimex I completely agree with you that this would not garantee a good random number. Thanks for explaining all this to me.
                          One point still open to me is the AES key. Is it only used for encryption (which does not give a real security in our case)? I suppose it should be also kind of pre shared key, so same value on all nodes? I don't want to enable encryption at the moment, but might be good to already write keys to all nodes in case I want to use it in future.

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

                          @Anduril also, AES key can and should be different from HMAC key.

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

                          1 Reply Last reply
                          0
                          • AndurilA Offline
                            AndurilA Offline
                            Anduril
                            wrote on last edited by
                            #13

                            @Anticimex of course they should be different. I will use my password safe to create independent and strong keys.
                            What length should the keys have? And how to add them in sketch? I tried with a 64 character hex key. But when adding it in as pure string or with 0x01,0x02,... the serial says all to be 0x00.

                            AnticimexA 1 Reply Last reply
                            0
                            • AndurilA Anduril

                              @Anticimex of course they should be different. I will use my password safe to create independent and strong keys.
                              What length should the keys have? And how to add them in sketch? I tried with a 64 character hex key. But when adding it in as pure string or with 0x01,0x02,... the serial says all to be 0x00.

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

                              @Anduril the only sketch you add the keys to is the personalizer. And it should already have examples for how the keys should look. The personalizer will store your keys on the device. Then you reflash it with your sketch.

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

                              1 Reply Last reply
                              0
                              • AndurilA Offline
                                AndurilA Offline
                                Anduril
                                wrote on last edited by
                                #15

                                @Anticimex yeah first flash the personalizer and afterwards my own sketch. But where in the personalizer.ino to add the key? I tried in line 162, but serial monitor shows only

                                #define MY_SOFT_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
                                EEPROM configuration:
                                SOFT_HMAC_KEY | 0000000000000000000000000000000000000000000000000000000000000000
                                
                                #define USER_SOFT_KEY 0xDC, 0x59, 0x84, 0xC0, 0x5E, 0xDA, 0xD3, 0x2C, 0x59, 0x12, 0xB0, 0xE3, 0x55, 0x75, 0x7C, 0x51, 0xDC, 0x59, 0x84, 0xC0, 0x5E, 0xDA, 0xD3, 0x2C, 0x59, 0x12, 0xB0, 0xE3, 0x55, 0x75, 0x7C, 0x51
                                

                                with this definition (only arbitrary key). Is that correct?

                                AnticimexA 1 Reply Last reply
                                0
                                • AndurilA Anduril

                                  @Anticimex yeah first flash the personalizer and afterwards my own sketch. But where in the personalizer.ino to add the key? I tried in line 162, but serial monitor shows only

                                  #define MY_SOFT_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
                                  EEPROM configuration:
                                  SOFT_HMAC_KEY | 0000000000000000000000000000000000000000000000000000000000000000
                                  
                                  #define USER_SOFT_KEY 0xDC, 0x59, 0x84, 0xC0, 0x5E, 0xDA, 0xD3, 0x2C, 0x59, 0x12, 0xB0, 0xE3, 0x55, 0x75, 0x7C, 0x51, 0xDC, 0x59, 0x84, 0xC0, 0x5E, 0xDA, 0xD3, 0x2C, 0x59, 0x12, 0xB0, 0xE3, 0x55, 0x75, 0x7C, 0x51
                                  

                                  with this definition (only arbitrary key). Is that correct?

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

                                  @Anduril No, you cannot add spaces to the definition. It has to look exactly like the example. And you must not rename it. It's called MY_SOFT_HMAC_KEY. not USER_SOFT_KEY.

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

                                  1 Reply Last reply
                                  0
                                  • AndurilA Offline
                                    AndurilA Offline
                                    Anduril
                                    wrote on last edited by
                                    #17

                                    OK i found the problem, I misunderstood something. I thought I have to add the keys to the enabling command of USER_SOFT_KEY. but there are the real keys some lines below that with correct example how to look like. Now it works and I personalized my first node. Thanks a lot @Anticimex

                                    AnticimexA 1 Reply Last reply
                                    1
                                    • AndurilA Anduril

                                      OK i found the problem, I misunderstood something. I thought I have to add the keys to the enabling command of USER_SOFT_KEY. but there are the real keys some lines below that with correct example how to look like. Now it works and I personalized my first node. Thanks a lot @Anticimex

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

                                      @Anduril :thumbsup:

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

                                      1 Reply Last reply
                                      0
                                      • AndurilA Offline
                                        AndurilA Offline
                                        Anduril
                                        wrote on last edited by
                                        #19

                                        @Anticimex Does this also work with a nodeMCU? I tried to personalize my ESP today and got an error:

                                        C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp: In constructor 'atsha204Class::atsha204Class(uint8_t)':
                                        
                                        C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp:16:18: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
                                        
                                          device_port_DDR = portModeRegister(port);
                                        
                                                          ^
                                        
                                        C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp:18:18: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
                                        
                                          device_port_OUT = portOutputRegister(port);
                                        
                                                          ^
                                        
                                        C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp:20:17: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
                                        
                                          device_port_IN = portInputRegister(port);
                                        
                                                         ^
                                        
                                        Bibliothek sha204 im Ordner: C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204 (legacy) wird verwendet
                                        Bibliothek MySensors in Version 2.0.0-beta im Ordner: C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\MySensors  wird verwendet
                                        Bibliothek EEPROM in Version 1.0 im Ordner: C:\Users\Mat\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\EEPROM  wird verwendet
                                        exit status 1
                                        Fehler beim Kompilieren.
                                        
                                        AnticimexA 1 Reply Last reply
                                        0
                                        • AndurilA Anduril

                                          @Anticimex Does this also work with a nodeMCU? I tried to personalize my ESP today and got an error:

                                          C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp: In constructor 'atsha204Class::atsha204Class(uint8_t)':
                                          
                                          C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp:16:18: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
                                          
                                            device_port_DDR = portModeRegister(port);
                                          
                                                            ^
                                          
                                          C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp:18:18: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
                                          
                                            device_port_OUT = portOutputRegister(port);
                                          
                                                            ^
                                          
                                          C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204\sha204_library.cpp:20:17: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
                                          
                                            device_port_IN = portInputRegister(port);
                                          
                                                           ^
                                          
                                          Bibliothek sha204 im Ordner: C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\sha204 (legacy) wird verwendet
                                          Bibliothek MySensors in Version 2.0.0-beta im Ordner: C:\Dropbox\Projekt-Micha\Arduino Sketch\libraries\MySensors  wird verwendet
                                          Bibliothek EEPROM in Version 1.0 im Ordner: C:\Users\Mat\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\EEPROM  wird verwendet
                                          exit status 1
                                          Fehler beim Kompilieren.
                                          
                                          AnticimexA Offline
                                          AnticimexA Offline
                                          Anticimex
                                          Contest Winner
                                          wrote on last edited by
                                          #20

                                          @Anduril that's an error from the atsha driver. It is not adapted for "exotic" architectures. I recommend soft signing (or that you create a or with necessary adjustments that are backwards compatible with the Arduino boards currently in use).

                                          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


                                          17

                                          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