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.
  • 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
                                • AndurilA Offline
                                  AndurilA Offline
                                  Anduril
                                  wrote on last edited by
                                  #21

                                  @Anticimex I thought to be using only soft signing...

                                  #include <sha204_library.h>
                                  #include <sha204_lib_return_codes.h>
                                  #define MY_CORE_ONLY
                                  #include <MySensor.h>
                                  
                                  #if DOXYGEN
                                  #define LOCK_CONFIGURATION
                                  #define LOCK_DATA
                                  #define SKIP_KEY_STORAGE
                                  #define USER_KEY
                                  #define SKIP_UART_CONFIRMATION
                                  #define USE_SOFT_SIGNING
                                  #define STORE_SOFT_KEY
                                  #define USER_SOFT_KEY
                                  #define STORE_SOFT_SERIAL
                                  #define USER_SOFT_SERIAL
                                  #define STORE_AES_KEY
                                  #define USER_AES_KEY
                                  #endif
                                  
                                  //#define LOCK_CONFIGURATION
                                  
                                  //#define LOCK_DATA
                                  
                                  //#define SKIP_KEY_STORAGE
                                  
                                  //#define USER_KEY
                                  
                                  //#define SKIP_UART_CONFIRMATION
                                  
                                  #define USE_SOFT_SIGNING
                                  
                                  #define STORE_SOFT_KEY
                                  
                                  #define USER_SOFT_KEY
                                  
                                  #define STORE_SOFT_SERIAL
                                  
                                  #define USER_SOFT_SERIAL
                                  
                                  #define STORE_AES_KEY
                                  
                                  #define USER_AES_KEY
                                  
                                  #if defined(SKIP_UART_CONFIRMATION) && !defined(USER_KEY)
                                  #error You have to define USER_KEY for boards that does not have UART
                                  #endif
                                  
                                  #ifdef USER_KEY
                                  /** @brief The user-defined HMAC key to use for personalization */
                                  #define MY_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
                                  /** @brief The data to store in key slot 0 */
                                  const uint8_t user_key_data[32] = {MY_HMAC_KEY};
                                  #endif
                                  
                                  #ifdef USER_SOFT_KEY
                                  

                                  I copied the header of the SecurityPersonalizer (just stripped the comments to make it shorter). Do I have activated atsh somewhere without noticing?

                                  AnticimexA 1 Reply Last reply
                                  0
                                  • AndurilA Anduril

                                    @Anticimex I thought to be using only soft signing...

                                    #include <sha204_library.h>
                                    #include <sha204_lib_return_codes.h>
                                    #define MY_CORE_ONLY
                                    #include <MySensor.h>
                                    
                                    #if DOXYGEN
                                    #define LOCK_CONFIGURATION
                                    #define LOCK_DATA
                                    #define SKIP_KEY_STORAGE
                                    #define USER_KEY
                                    #define SKIP_UART_CONFIRMATION
                                    #define USE_SOFT_SIGNING
                                    #define STORE_SOFT_KEY
                                    #define USER_SOFT_KEY
                                    #define STORE_SOFT_SERIAL
                                    #define USER_SOFT_SERIAL
                                    #define STORE_AES_KEY
                                    #define USER_AES_KEY
                                    #endif
                                    
                                    //#define LOCK_CONFIGURATION
                                    
                                    //#define LOCK_DATA
                                    
                                    //#define SKIP_KEY_STORAGE
                                    
                                    //#define USER_KEY
                                    
                                    //#define SKIP_UART_CONFIRMATION
                                    
                                    #define USE_SOFT_SIGNING
                                    
                                    #define STORE_SOFT_KEY
                                    
                                    #define USER_SOFT_KEY
                                    
                                    #define STORE_SOFT_SERIAL
                                    
                                    #define USER_SOFT_SERIAL
                                    
                                    #define STORE_AES_KEY
                                    
                                    #define USER_AES_KEY
                                    
                                    #if defined(SKIP_UART_CONFIRMATION) && !defined(USER_KEY)
                                    #error You have to define USER_KEY for boards that does not have UART
                                    #endif
                                    
                                    #ifdef USER_KEY
                                    /** @brief The user-defined HMAC key to use for personalization */
                                    #define MY_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
                                    /** @brief The data to store in key slot 0 */
                                    const uint8_t user_key_data[32] = {MY_HMAC_KEY};
                                    #endif
                                    
                                    #ifdef USER_SOFT_KEY
                                    

                                    I copied the header of the SecurityPersonalizer (just stripped the comments to make it shorter). Do I have activated atsh somewhere without noticing?

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

                                    @Anduril try ditching the SHA204 library includes at the top. Not sure if they are required for soft signing. Can't remember if I put them there for a reason.... Long time ago I coded for MySensors :(

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

                                    AndurilA 1 Reply Last reply
                                    0
                                    • AnticimexA Anticimex

                                      @Anduril try ditching the SHA204 library includes at the top. Not sure if they are required for soft signing. Can't remember if I put them there for a reason.... Long time ago I coded for MySensors :(

                                      AndurilA Offline
                                      AndurilA Offline
                                      Anduril
                                      wrote on last edited by
                                      #23

                                      @Anticimex Thank you. Deactivating those sha libs made the code compile and work.

                                      AnticimexA 1 Reply Last reply
                                      0
                                      • AndurilA Anduril

                                        @Anticimex Thank you. Deactivating those sha libs made the code compile and work.

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

                                        @Anduril :thumbsup:

                                        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