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. General Discussion
  3. Encryption, Signing and OTA is there any how-to?

Encryption, Signing and OTA is there any how-to?

Scheduled Pinned Locked Moved General Discussion
42 Posts 6 Posters 10.0k Views 10 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.
  • L LastSamurai

    @Anticimex said in Encryption, Signing and OTA is there any how-to?:

    @LastSamurai I see. Well, I intentionally left the personalizer to be highly customizable since users have varying requirements, but I can add flags to it which preconfigure some typical usecases if that would help?

    That would actually be great! Some flags that automatically set up for:

    • create everything at the gw and save it
    • node: takes the provided HMAC (and aes) and saves it, generates new node id

    and perhaps some others would really help me (and others I hope). I gladly test your new changes, just keep me updated!

    PS We could also add a section to your text describing that you need well working radios (+ caps) because of the longer message sizes. Signing doesn't work for all nodes for me due to that and when I started working with it I thought this to be a problem with signing.

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

    @LastSamurai node IDs is not a signing thing so the personalizer will not touch that.
    And regarding working radios, the "real" documentation feature a troubleshooting section where that topic is covered. Doxygen that is. Link is available through the readme on the library on github. I will see if I can incorporate that somehow on the main site. Unfortunately there is no automatic link between the generate docs which are the most recent, and the article on the main site.

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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      LastSamurai
      Hardware Contributor
      wrote on last edited by
      #16

      I meant the serial number (forgot that name and it is like a node id, right?). The one thats needed for e.g. whitelisting.

      The documentation mentions somewhere that signing might cause errors if the radios aren't working at a 100%? Haven't seen that but that might be important to avoid people being "afraid" of using signing.

      AnticimexA 1 Reply Last reply
      0
      • L LastSamurai

        I meant the serial number (forgot that name and it is like a node id, right?). The one thats needed for e.g. whitelisting.

        The documentation mentions somewhere that signing might cause errors if the radios aren't working at a 100%? Haven't seen that but that might be important to avoid people being "afraid" of using signing.

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

        Both serial and node id is used for whitelisting.
        However, only serial is generated by the personalizer (and only for software signing, atsha204a has a fixed serial).
        This is the full documentation with troubleshooting section: https://ci.mysensors.org/job/Verifiers/job/MySensors/branch/development/Doxygen_HTML/group__MySigninggrp.html

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

        1 Reply Last reply
        0
        • AnticimexA Anticimex

          I hope to be able to file a pull request with updates to the personalizer this or next week. @LastSamurai @MLs @meddie i would really appreciate if you tested and reviewed the change so that you (and others) no longer are deterred from using signing due to its complexity. I will update the pull request until you feel confident in the procedure. I will post a link here when I have something to show for.

          M Offline
          M Offline
          MLs
          wrote on last edited by
          #18

          @Anticimex

          Ofcourse

          //Mattias

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

            While I am working on the personalizer simplifications, perhaps you could have a look at https://www.mysensors.org/about/signing#how-to-use-this where there are (and have been all along) an explicit list of flags to enable/disable for "master" and "slave" devices. I believe this is what you were looking for @LastSamurai ?

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

            L 1 Reply Last reply
            0
            • AnticimexA Anticimex

              While I am working on the personalizer simplifications, perhaps you could have a look at https://www.mysensors.org/about/signing#how-to-use-this where there are (and have been all along) an explicit list of flags to enable/disable for "master" and "slave" devices. I believe this is what you were looking for @LastSamurai ?

              L Offline
              L Offline
              LastSamurai
              Hardware Contributor
              wrote on last edited by
              #20

              @Anticimex Oh, right that looks very helpful! Some shortcuts for these would be great anyways :)

              AnticimexA 1 Reply Last reply
              0
              • L LastSamurai

                @Anticimex Oh, right that looks very helpful! Some shortcuts for these would be great anyways :)

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

                @LastSamurai I agree, and I will rename a a few concepts as well.

                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 Anticimex
                  #22

                  I am inclined to stick to the concept as documented instead of having "node" and "gateway" concepts as we discussed. I will still simplify the procedure.
                  The reason for this is that I believe it is simpler to have this procedure:

                  • Configure personalizer to generate keys
                  • Reconfigure personalizer to retain and store generated keys

                  as opposed to

                  • Configure personalizer for "gateway" (to generate and store keys)
                  • Configure personalizer for "node" (to store retained keys)

                  The reason I think the first and original design is simpler is because it allows you to execute the personalizer once with one setting to obtain keys, then reconfigure the personalizer once and execute the same personalizer on ALL devices. That minimizes the risk of having misalignment in the personalized security data between the nodes. What I will do is to provide two "top-level" definitions which takes care of every setting except the setting of the retained autogenerated keys and the use of ATSHA204A or software signing. The personalizer does output the auto generated keys in a very copy+paste friendly manner so it is not difficult to set these.
                  The only thing which need to be different between nodes/gateways is the serial (if soft signing is used) so that will always be randomly generated (unless one specifically reconfigure the personalizer to use a specific serial).

                  Thoughts on this? I am still open for input as it is you that are the users :)
                  EDIT: I will have four "top-level" flags, so you select ATSHA or soft variant at the top level.

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

                  L 1 Reply Last reply
                  0
                  • AnticimexA Anticimex

                    I am inclined to stick to the concept as documented instead of having "node" and "gateway" concepts as we discussed. I will still simplify the procedure.
                    The reason for this is that I believe it is simpler to have this procedure:

                    • Configure personalizer to generate keys
                    • Reconfigure personalizer to retain and store generated keys

                    as opposed to

                    • Configure personalizer for "gateway" (to generate and store keys)
                    • Configure personalizer for "node" (to store retained keys)

                    The reason I think the first and original design is simpler is because it allows you to execute the personalizer once with one setting to obtain keys, then reconfigure the personalizer once and execute the same personalizer on ALL devices. That minimizes the risk of having misalignment in the personalized security data between the nodes. What I will do is to provide two "top-level" definitions which takes care of every setting except the setting of the retained autogenerated keys and the use of ATSHA204A or software signing. The personalizer does output the auto generated keys in a very copy+paste friendly manner so it is not difficult to set these.
                    The only thing which need to be different between nodes/gateways is the serial (if soft signing is used) so that will always be randomly generated (unless one specifically reconfigure the personalizer to use a specific serial).

                    Thoughts on this? I am still open for input as it is you that are the users :)
                    EDIT: I will have four "top-level" flags, so you select ATSHA or soft variant at the top level.

                    L Offline
                    L Offline
                    LastSamurai
                    Hardware Contributor
                    wrote on last edited by
                    #23

                    @Anticimex That sounds really nice to me. I would also (if thats possible without breaking something in the code) move these new flags and the settings for the HMAC (and everything else that needs to be inserted) to the top of the sketch, so that if you stay with the "default" settings you don't need to scroll down. Just for easy of use and for beginners.

                    Great timing from you btw: I am in the process of switching the controller anyways and will redo some of my nodes too. Now I can incorporate signing (and perhaps encryption) too.

                    AnticimexA 1 Reply Last reply
                    0
                    • L LastSamurai

                      @Anticimex That sounds really nice to me. I would also (if thats possible without breaking something in the code) move these new flags and the settings for the HMAC (and everything else that needs to be inserted) to the top of the sketch, so that if you stay with the "default" settings you don't need to scroll down. Just for easy of use and for beginners.

                      Great timing from you btw: I am in the process of switching the controller anyways and will redo some of my nodes too. Now I can incorporate signing (and perhaps encryption) too.

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

                      @LastSamurai I am pretty much rewriting the entire personalizer. So I am glad to have a motivated test team at hand ;)
                      Ease of use is prio1 with flexibility coming in second.

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

                      1 Reply Last reply
                      3
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #25

                        Agreed, if you can make the configuration easy of the most common commands, it would be great for beginners. ;)

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

                          There is a pull request now for a new personalizer. Please try it. It might still be a few issues, but I need more test coverage.
                          https://github.com/mysensors/MySensors/pull/794

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

                          L 1 Reply Last reply
                          1
                          • AnticimexA Anticimex

                            There is a pull request now for a new personalizer. Please try it. It might still be a few issues, but I need more test coverage.
                            https://github.com/mysensors/MySensors/pull/794

                            L Offline
                            L Offline
                            LastSamurai
                            Hardware Contributor
                            wrote on last edited by
                            #27

                            @Anticimex I already download the pr... the new sketch looks very nice! I'll try it out tomorrow.

                            1 Reply Last reply
                            1
                            • L Offline
                              L Offline
                              LastSamurai
                              Hardware Contributor
                              wrote on last edited by
                              #28

                              Seems to work just fine. The output is way cleaner and the options are easy to use imo (tried the PERSONALIZE_SOFT_RANDOM_SERIAL). One questions though:
                              The output gives me EEPROM and Key Storage. With different values for the Serial number. What's the difference here?

                              AnticimexA 1 Reply Last reply
                              0
                              • L LastSamurai

                                Seems to work just fine. The output is way cleaner and the options are easy to use imo (tried the PERSONALIZE_SOFT_RANDOM_SERIAL). One questions though:
                                The output gives me EEPROM and Key Storage. With different values for the Serial number. What's the difference here?

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

                                @LastSamurai Can you please provide the output?
                                The sketch will output EEPROM value first, and (in the case of PERSONALIZE_SOFT_RANDOM_SERIAL) generate a new serial which will replace the value in EEPROM. If you run the sketch without any flags set, it will just show the currently stored states.

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

                                1 Reply Last reply
                                0
                                • L Offline
                                  L Offline
                                  LastSamurai
                                  Hardware Contributor
                                  wrote on last edited by
                                  #30

                                  Haven't saved it. Will rerun it later ;) There were just different categories and one was EEPROM another was Key Storage. Inbetween was the gererated key (which was the same as in the key storage). So I guess it read the values, wrote the new ones and displayed the new ones. Might be a little confusing though. I'll try to post it later

                                  Everything seems to be working now though with the signing enabled.

                                  AnticimexA 1 Reply Last reply
                                  0
                                  • L LastSamurai

                                    Haven't saved it. Will rerun it later ;) There were just different categories and one was EEPROM another was Key Storage. Inbetween was the gererated key (which was the same as in the key storage). So I guess it read the values, wrote the new ones and displayed the new ones. Might be a little confusing though. I'll try to post it later

                                    Everything seems to be working now though with the signing enabled.

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

                                    @LastSamurai EEPROM is exactly what it says; the data in EEPROM.
                                    Key storage is the keys being stored "somewhere", it could be EEPROM (if you use soft signing) or ATSHA204A if you use that. If you execute the key generation stage, you will see "Key generation" instead of "Key storage".
                                    The special case is the PERSONALIZE_SOFT_RANDOM_SERIAL in which you will do both key generation and key storage (but only generation for the serial).

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

                                    1 Reply Last reply
                                    0
                                    • L Offline
                                      L Offline
                                      LastSamurai
                                      Hardware Contributor
                                      wrote on last edited by
                                      #32

                                      This is what I get:

                                      +------------------------------------------------------------------------------------+
                                      |                           MySensors security personalizer                          |
                                      +------------------------------------------------------------------------------------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                               Configuration settings                               |
                                      +------------------------------------------------------------------------------------+
                                      | * Guided personalization/storage of keys in EEPROM                                 |
                                      | * Guided storage and generation of random serial in EEPROM                         |
                                      | * Software based personalization (no ATSHA204A usage whatsoever)                   |
                                      | * Will not require UART confirmation before locking ATSHA204A configuration        |
                                      | * Will store HMAC key to EEPROM                                                    |
                                      | * Will store AES key to EEPROM                                                     |
                                      | * Will generate soft serial using software                                         |
                                      | * Will store soft serial to EEPROM                                                 |
                                      +------------------------------------------------------------------------------------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                           Hardware security peripherals                            |
                                      +--------------+--------------+--------------+------------------------------+--------+
                                      | Device       | Status       | Revision     | Serial number                | Locked |
                                      +--------------+--------------+--------------+------------------------------+--------+
                                      | AVR          | DETECTED     | N/A          | N/A (generation required)    | N/A    |
                                      +--------------+--------------+--------------+------------------------------+--------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                                       EEPROM                                       |
                                      +--------+--------+------------------------------------------------------------------+
                                      | Key ID | Status | Key                                                              |
                                      +--------+--------+------------------------------------------------------------------+
                                      | HMAC   | OK     | ... |
                                      | AES    | OK     | 00000000000000000000000000000000                                 |
                                      | SERIAL | OK     | 0E0103FA44D749F163                                               |
                                      +--------+--------+------------------------------------------------------------------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                                   Key generation                                   |
                                      +--------+--------+------------------------------------------------------------------+
                                      | Key ID | Status | Key                                                              |
                                      +--------+--------+------------------------------------------------------------------+
                                      | SERIAL | OK     | 0F5B932A87D43AD318                                               |
                                      +--------+--------+------------------------------------------------------------------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                                    Key storage                                     |
                                      +--------+--------+------------------------------------------------------------------+
                                      | Key ID | Status | Key                                                              |
                                      +--------+--------+------------------------------------------------------------------+
                                      | HMAC   | OK     | ... |
                                      | AES    | OK     | 00000000000000000000000000000000                                 |
                                      | SERIAL | OK     | 0F5B932A87D43AD318                                               |
                                      +--------+--------+------------------------------------------------------------------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                                  WHAT TO DO NEXT?                                  |
                                      +------------------------------------------------------------------------------------+
                                      | This device has now been personalized. Run this sketch with its current settings   |
                                      | on all the devices in your network that have security enabled.                     |
                                      +------------------------------------------------------------------------------------+
                                      
                                      +------------------------------------------------------------------------------------+
                                      |                                  Execution result                                  |
                                      +------------------------------------------------------------------------------------+
                                      | SUCCESS                                                                            |
                                      +------------------------------------------------------------------------------------+
                                      

                                      Ah ok. Still a little confusing in my opinion. Why show the key storage at all with Soft_serial? In this case the key always gets saved in the eeprom (right?). Just the "key generation" and one eeprom afterwards or one before and one after (with different names) would be clearer imo.
                                      Just some (hopefully constructive) critisism. I still like it way more than the old system!

                                      AnticimexA 1 Reply Last reply
                                      0
                                      • L LastSamurai

                                        This is what I get:

                                        +------------------------------------------------------------------------------------+
                                        |                           MySensors security personalizer                          |
                                        +------------------------------------------------------------------------------------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                               Configuration settings                               |
                                        +------------------------------------------------------------------------------------+
                                        | * Guided personalization/storage of keys in EEPROM                                 |
                                        | * Guided storage and generation of random serial in EEPROM                         |
                                        | * Software based personalization (no ATSHA204A usage whatsoever)                   |
                                        | * Will not require UART confirmation before locking ATSHA204A configuration        |
                                        | * Will store HMAC key to EEPROM                                                    |
                                        | * Will store AES key to EEPROM                                                     |
                                        | * Will generate soft serial using software                                         |
                                        | * Will store soft serial to EEPROM                                                 |
                                        +------------------------------------------------------------------------------------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                           Hardware security peripherals                            |
                                        +--------------+--------------+--------------+------------------------------+--------+
                                        | Device       | Status       | Revision     | Serial number                | Locked |
                                        +--------------+--------------+--------------+------------------------------+--------+
                                        | AVR          | DETECTED     | N/A          | N/A (generation required)    | N/A    |
                                        +--------------+--------------+--------------+------------------------------+--------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                                       EEPROM                                       |
                                        +--------+--------+------------------------------------------------------------------+
                                        | Key ID | Status | Key                                                              |
                                        +--------+--------+------------------------------------------------------------------+
                                        | HMAC   | OK     | ... |
                                        | AES    | OK     | 00000000000000000000000000000000                                 |
                                        | SERIAL | OK     | 0E0103FA44D749F163                                               |
                                        +--------+--------+------------------------------------------------------------------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                                   Key generation                                   |
                                        +--------+--------+------------------------------------------------------------------+
                                        | Key ID | Status | Key                                                              |
                                        +--------+--------+------------------------------------------------------------------+
                                        | SERIAL | OK     | 0F5B932A87D43AD318                                               |
                                        +--------+--------+------------------------------------------------------------------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                                    Key storage                                     |
                                        +--------+--------+------------------------------------------------------------------+
                                        | Key ID | Status | Key                                                              |
                                        +--------+--------+------------------------------------------------------------------+
                                        | HMAC   | OK     | ... |
                                        | AES    | OK     | 00000000000000000000000000000000                                 |
                                        | SERIAL | OK     | 0F5B932A87D43AD318                                               |
                                        +--------+--------+------------------------------------------------------------------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                                  WHAT TO DO NEXT?                                  |
                                        +------------------------------------------------------------------------------------+
                                        | This device has now been personalized. Run this sketch with its current settings   |
                                        | on all the devices in your network that have security enabled.                     |
                                        +------------------------------------------------------------------------------------+
                                        
                                        +------------------------------------------------------------------------------------+
                                        |                                  Execution result                                  |
                                        +------------------------------------------------------------------------------------+
                                        | SUCCESS                                                                            |
                                        +------------------------------------------------------------------------------------+
                                        

                                        Ah ok. Still a little confusing in my opinion. Why show the key storage at all with Soft_serial? In this case the key always gets saved in the eeprom (right?). Just the "key generation" and one eeprom afterwards or one before and one after (with different names) would be clearer imo.
                                        Just some (hopefully constructive) critisism. I still like it way more than the old system!

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

                                        @LastSamurai Well, I designed it like this intentionally because I want the "experience" to be uniform.
                                        You have selected a mode which generates a key and stores a key. So it will shows the key(s) it generates and also the key(s) it store. Key generation and key storage is normally two separate things.
                                        You can if you so like completely customize what keys you generate and store using the "advanced" config flags.
                                        The log is designed to show exactly what is happening.
                                        You could if you wanted to tell it to generate a serial but not store it. Or tell it to not generate a serial but store one you have configured yourself. Hence the tables are separated.

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

                                        L 1 Reply Last reply
                                        0
                                        • AnticimexA Anticimex

                                          @LastSamurai Well, I designed it like this intentionally because I want the "experience" to be uniform.
                                          You have selected a mode which generates a key and stores a key. So it will shows the key(s) it generates and also the key(s) it store. Key generation and key storage is normally two separate things.
                                          You can if you so like completely customize what keys you generate and store using the "advanced" config flags.
                                          The log is designed to show exactly what is happening.
                                          You could if you wanted to tell it to generate a serial but not store it. Or tell it to not generate a serial but store one you have configured yourself. Hence the tables are separated.

                                          L Offline
                                          L Offline
                                          LastSamurai
                                          Hardware Contributor
                                          wrote on last edited by LastSamurai
                                          #34

                                          @Anticimex Well that makes sense too. I was just a little confused seeing 2 serial keys the first time. I figured it out though, so other will too ;)
                                          Nice work though, much easier to use than the old version!

                                          When I have the time I'll try it with some other nodes in the next days.

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


                                          8

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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