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. Signing or encrypting the data

Signing or encrypting the data

Scheduled Pinned Locked Moved General Discussion
38 Posts 9 Posters 8.7k Views 9 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.
  • AnticimexA Anticimex

    That depend on what bootloader you use. If you use MYSbootloader, then it won't work as it is the bootloader that manages the radio. But if you use dualoptiboot, the OTA solution is radio independent as the firmware is transferred in a "mysensors context" and stored on external flash before rebooting and then the dualoptiboot bootloader moves that firmware to internal flash. So with dualoptiboot, it should be possible to encrypt the data.
    But note that in both cases, signing won't be used for performance reasons. The checksum of the firmware will be signed though.
    It is in the pipeline to support SHA256 checksumming the firmware and sign that checksum for greater security (it currently uses crc). But it is not yet in place. @tekka is our core team OTA developer, he might fill you in on the details on OTA with respect to signing and encryption and which variant supports what.

    M Offline
    M Offline
    meddie
    wrote on last edited by
    #19

    @Anticimex said:

    That depend on what bootloader you use. If you use MYSbootloader, then it won't work as it is the bootloader that manages the radio. But if you use dualoptiboot, the OTA solution is radio independent as the firmware is transferred in a "mysensors context" and stored on external flash before rebooting and then the dualoptiboot bootloader moves that firmware to internal flash. So with dualoptiboot, it should be possible to encrypt the data.

    OK, nice to hear that its possible. When i have to put an external flash and a dualoptibootloader, then its not the problem.

    But note that in both cases, signing won't be used for performance reasons.

    What do mean, i didnt understand. Can you explain this please.
    Thank you very much!
    Greets Eddie

    AnticimexA 1 Reply Last reply
    0
    • AnticimexA Anticimex

      @meddie What's preventing anyone from walking up to your window and feeling if it is locked or not?
      Or look at it this way:
      1 = open, 0 = locked. If sent in clear text, an eavesdropper sees '1' or '0'. Now, assuming he knows which is what, then he knows the window is opened or closed. But that is really not important information.
      So what do you get by encrypting that data? Well, you achieve "some certainty" that an eavesdropper don't know if you just locked your window. But he will know for sure you did something with the window at that point in time. And there is a 50% chance, you locked the window.
      Now, that being said; encryption is supported for both NRF24 and RFM69 radios, so if it makes you feel better, just enable it. It won't makes things worse. But signing provides a far greater security value than encryption, so if you really care about security, you should prioritize signing.

      R Offline
      R Offline
      Rasenheizung
      wrote on last edited by
      #20

      @Anticimex said:

      @meddie What's preventing anyone from walking up to your window and feeling if it is locked or not?
      Or look at it this way:
      1 = open, 0 = locked. If sent in clear text, an eavesdropper sees '1' or '0'. Now, assuming he knows which is what, then he knows the window is opened or closed. But that is really not important information.
      So what do you get by encrypting that data? Well, you achieve "some certainty" that an eavesdropper don't know if you just locked your window. But he will know for sure you did something with the window at that point in time. And there is a 50% chance, you locked the window.
      Now, that being said; encryption is supported for both NRF24 and RFM69 radios, so if it makes you feel better, just enable it. It won't makes things worse. But signing provides a far greater security value than encryption, so if you really care about security, you should prioritize signing.

      Maybe it's my bad English or I really haven't understood it correctly.

      Signing: Verifies the sender and receiver are known.
      Encryption: Encodes the message so it's only readable for you.

      So in conclusion, if I'm signing my messages I'm only getting my messages and only I am able to read my messages. So no third party can give me wrong messages and can't read my messages? He also should not be able to read if I'm playing with my door/window nore if I'm opening or closing it.

      AnticimexA 1 Reply Last reply
      0
      • M meddie

        @Anticimex said:

        That depend on what bootloader you use. If you use MYSbootloader, then it won't work as it is the bootloader that manages the radio. But if you use dualoptiboot, the OTA solution is radio independent as the firmware is transferred in a "mysensors context" and stored on external flash before rebooting and then the dualoptiboot bootloader moves that firmware to internal flash. So with dualoptiboot, it should be possible to encrypt the data.

        OK, nice to hear that its possible. When i have to put an external flash and a dualoptibootloader, then its not the problem.

        But note that in both cases, signing won't be used for performance reasons.

        What do mean, i didnt understand. Can you explain this please.
        Thank you very much!
        Greets Eddie

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

        @meddie a signature takes up part of the available payload space. For nrf24 it is 27 bytes. For a signature to be efficient it needs to be reasonably large, say have the available payload. That leaves have the amount left for binary data. OTA require MANY packages to transfer a typical sketch. For each package a nonce exchange will take place. For this reason, signing is not used for streams. And it does not have to be. A stream should always be checksummed in order to be fully validated. A signature only needs to cover that checksum.

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

        ahmedadelhosniA 1 Reply Last reply
        1
        • R Rasenheizung

          @Anticimex said:

          @meddie What's preventing anyone from walking up to your window and feeling if it is locked or not?
          Or look at it this way:
          1 = open, 0 = locked. If sent in clear text, an eavesdropper sees '1' or '0'. Now, assuming he knows which is what, then he knows the window is opened or closed. But that is really not important information.
          So what do you get by encrypting that data? Well, you achieve "some certainty" that an eavesdropper don't know if you just locked your window. But he will know for sure you did something with the window at that point in time. And there is a 50% chance, you locked the window.
          Now, that being said; encryption is supported for both NRF24 and RFM69 radios, so if it makes you feel better, just enable it. It won't makes things worse. But signing provides a far greater security value than encryption, so if you really care about security, you should prioritize signing.

          Maybe it's my bad English or I really haven't understood it correctly.

          Signing: Verifies the sender and receiver are known.
          Encryption: Encodes the message so it's only readable for you.

          So in conclusion, if I'm signing my messages I'm only getting my messages and only I am able to read my messages. So no third party can give me wrong messages and can't read my messages? He also should not be able to read if I'm playing with my door/window nore if I'm opening or closing it.

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

          @Rasenheizung well, I thought I just explained why encryption is pointless in this case. Unless the attacker is exceptionally stupid, he will be able to deduce the content of a simple message, encrypted or not, by just examining the traffic over a period of time. It is dangerous to underestimate your adversary so that is why I do not recommend encryption only I'd you care about security. But as I said, if you feel better with it, just use it. But don't expect your data to be truly private just because you obfuscate it.

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

          M 1 Reply Last reply
          1
          • AnticimexA Anticimex

            @Rasenheizung well, I thought I just explained why encryption is pointless in this case. Unless the attacker is exceptionally stupid, he will be able to deduce the content of a simple message, encrypted or not, by just examining the traffic over a period of time. It is dangerous to underestimate your adversary so that is why I do not recommend encryption only I'd you care about security. But as I said, if you feel better with it, just use it. But don't expect your data to be truly private just because you obfuscate it.

            M Offline
            M Offline
            meddie
            wrote on last edited by
            #23

            @Anticimex
            no, 100% safety wll never be possible. But i would feel me better when i know that the messages are not so easy readable for someone who has a mysensors too.
            I have some weeks ago read in the FHEM Forum, there has a user build a second gateway just for testing, and as he started them the whole sensors has sended the data twice to both gateways. The logical
            I didnt try this, but it's scary when it is so easy possible to read the sensors.

            1 Reply Last reply
            0
            • sundberg84S Offline
              sundberg84S Offline
              sundberg84
              Hardware Contributor
              wrote on last edited by
              #24

              @meddie This is not uncommon, build yourself a 433mhz gateway and you will receive every 433 message in that gateway range... also a bit scary since many home alarms and other security things use 433mhz.

              Controller: Proxmox VM - Home Assistant
              MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
              MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
              RFLink GW - Arduino Mega + RFLink Shield, 433mhz

              1 Reply Last reply
              0
              • AnticimexA Anticimex

                @meddie a signature takes up part of the available payload space. For nrf24 it is 27 bytes. For a signature to be efficient it needs to be reasonably large, say have the available payload. That leaves have the amount left for binary data. OTA require MANY packages to transfer a typical sketch. For each package a nonce exchange will take place. For this reason, signing is not used for streams. And it does not have to be. A stream should always be checksummed in order to be fully validated. A signature only needs to cover that checksum.

                ahmedadelhosniA Offline
                ahmedadelhosniA Offline
                ahmedadelhosni
                wrote on last edited by ahmedadelhosni
                #25

                @Anticimex said:

                OTA require MANY packages to transfer a typical sketch. For each package a nonce exchange will take place. For this reason, signing is not used for streams. And it does not have to be. A stream should always be checksummed in order to be fully validated. A signature only needs to cover that checksum.

                Please bear with me. I just want to be sure I understand it well.
                "For this reason, signing is not used for streams." Means that signing is not used when uploading a sketch. Does this lead to a hacker replacing my sketch ?

                A stream should always be checksummed in order to be fully validated

                Checksum will make sure that the sketch is transferred correctly to avoid data corruption, NOT security, correct ?

                A signature only needs to cover that checksum

                So you propose that a signature must be added with the checksum for security, correct ??

                So in brief. OTA is not secured at the moment and the code can be replaced easily with an unsigned one, correct ?

                Thanks.

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

                  You are perfectly correct. But if you reach my level of paranoia, you will find that encryption provides little comfort. But you may use it to your hearts content of course.

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

                  1 Reply Last reply
                  1
                  • ahmedadelhosniA ahmedadelhosni

                    @Anticimex said:

                    OTA require MANY packages to transfer a typical sketch. For each package a nonce exchange will take place. For this reason, signing is not used for streams. And it does not have to be. A stream should always be checksummed in order to be fully validated. A signature only needs to cover that checksum.

                    Please bear with me. I just want to be sure I understand it well.
                    "For this reason, signing is not used for streams." Means that signing is not used when uploading a sketch. Does this lead to a hacker replacing my sketch ?

                    A stream should always be checksummed in order to be fully validated

                    Checksum will make sure that the sketch is transferred correctly to avoid data corruption, NOT security, correct ?

                    A signature only needs to cover that checksum

                    So you propose that a signature must be added with the checksum for security, correct ??

                    So in brief. OTA is not secured at the moment and the code can be replaced easily with an unsigned one, correct ?

                    Thanks.

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

                    @ahmedadelhosni said:

                    Please bear with me. I just want to be sure I understand it well.
                    "For this reason, signing is not used for streams." Means that signing is not used when uploading a sketch. Does this lead to a hacker replacing my sketch ?

                    No, I stated that the sketch is checksummed and that checksum is signed. So no, a hacker won't (probably) be able to replace your sketch. Lest he is able to produce one that yields the exact same checksum AND manages to inject it so that the signed checksum is arrived in a timely manner for the receiver to take it into account.

                    Checksum will make sure that the sketch is transferred correctly so to avoid data corruption, correct ?

                    "Sure" in this aspect is a very relative term. But yes, that is it's purpose.

                    So you propose that a signature must be added with the checksum for security, correct ??

                    No, I say it is added if signing is enabled. But please be aware that the current version of MYSBootloader does not support signing. Future versions will do.

                    So in brief. OTA is not secured at the moment and the code can be replaced easily with an unsigned one, correct ?

                    No, as I said, dualoptiboot should be secure. But the use of CRC as checksum is not as secure as SHA256 would be, so the security is not as good as it can be.

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

                    ahmedadelhosniA M 2 Replies Last reply
                    2
                    • AnticimexA Anticimex

                      @ahmedadelhosni said:

                      Please bear with me. I just want to be sure I understand it well.
                      "For this reason, signing is not used for streams." Means that signing is not used when uploading a sketch. Does this lead to a hacker replacing my sketch ?

                      No, I stated that the sketch is checksummed and that checksum is signed. So no, a hacker won't (probably) be able to replace your sketch. Lest he is able to produce one that yields the exact same checksum AND manages to inject it so that the signed checksum is arrived in a timely manner for the receiver to take it into account.

                      Checksum will make sure that the sketch is transferred correctly so to avoid data corruption, correct ?

                      "Sure" in this aspect is a very relative term. But yes, that is it's purpose.

                      So you propose that a signature must be added with the checksum for security, correct ??

                      No, I say it is added if signing is enabled. But please be aware that the current version of MYSBootloader does not support signing. Future versions will do.

                      So in brief. OTA is not secured at the moment and the code can be replaced easily with an unsigned one, correct ?

                      No, as I said, dualoptiboot should be secure. But the use of CRC as checksum is not as secure as SHA256 would be, so the security is not as good as it can be.

                      ahmedadelhosniA Offline
                      ahmedadelhosniA Offline
                      ahmedadelhosni
                      wrote on last edited by
                      #28

                      @Anticimex Great. now it is very clear :) Thanks a lot

                      I will order all ICs soon and test this in real life :)

                      M 1 Reply Last reply
                      1
                      • ahmedadelhosniA ahmedadelhosni

                        @Anticimex Great. now it is very clear :) Thanks a lot

                        I will order all ICs soon and test this in real life :)

                        M Offline
                        M Offline
                        meddie
                        wrote on last edited by
                        #29

                        @ahmedadelhosni
                        Fine, please let stay me informed, because i am very interested too.

                        ahmedadelhosniA 1 Reply Last reply
                        0
                        • M meddie

                          @ahmedadelhosni
                          Fine, please let stay me informed, because i am very interested too.

                          ahmedadelhosniA Offline
                          ahmedadelhosniA Offline
                          ahmedadelhosni
                          wrote on last edited by ahmedadelhosni
                          #30

                          @meddie Sure. Maybe by the end of that month I may begin in OTA process.
                          I hope I can find good documentation :)

                          M 1 Reply Last reply
                          1
                          • AnticimexA Anticimex

                            @ahmedadelhosni said:

                            Please bear with me. I just want to be sure I understand it well.
                            "For this reason, signing is not used for streams." Means that signing is not used when uploading a sketch. Does this lead to a hacker replacing my sketch ?

                            No, I stated that the sketch is checksummed and that checksum is signed. So no, a hacker won't (probably) be able to replace your sketch. Lest he is able to produce one that yields the exact same checksum AND manages to inject it so that the signed checksum is arrived in a timely manner for the receiver to take it into account.

                            Checksum will make sure that the sketch is transferred correctly so to avoid data corruption, correct ?

                            "Sure" in this aspect is a very relative term. But yes, that is it's purpose.

                            So you propose that a signature must be added with the checksum for security, correct ??

                            No, I say it is added if signing is enabled. But please be aware that the current version of MYSBootloader does not support signing. Future versions will do.

                            So in brief. OTA is not secured at the moment and the code can be replaced easily with an unsigned one, correct ?

                            No, as I said, dualoptiboot should be secure. But the use of CRC as checksum is not as secure as SHA256 would be, so the security is not as good as it can be.

                            M Offline
                            M Offline
                            meddie
                            wrote on last edited by
                            #31

                            @Anticimex

                            one more question: is it possble to run the atmega with dualoptiboot bootloader at 1MHz. For battery use. And use the the encryption and signing and OTA.

                            AnticimexA 1 Reply Last reply
                            0
                            • ahmedadelhosniA ahmedadelhosni

                              @meddie Sure. Maybe by the end of that month I may begin in OTA process.
                              I hope I can find good documentation :)

                              M Offline
                              M Offline
                              meddie
                              wrote on last edited by
                              #32

                              @ahmedadelhosni
                              fine, thank you in advanced

                              1 Reply Last reply
                              1
                              • M meddie

                                @Anticimex

                                one more question: is it possble to run the atmega with dualoptiboot bootloader at 1MHz. For battery use. And use the the encryption and signing and OTA.

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

                                @meddie Please direct OTA questions to @tekka He can better explain what is supported in which solution and when any unsupported features will be available if planned.
                                Generally, 1MHz offer little battery benefit over 8MHz.

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

                                1 Reply Last reply
                                1
                                • tbowmoT Offline
                                  tbowmoT Offline
                                  tbowmo
                                  Admin
                                  wrote on last edited by
                                  #34

                                  for a MCU that never enters sleep states, running at 1Mhz can save you some power, compared to running at 8Mhz. But if you plan to enter sleep state, and only wake up periodically, you won't gain that much. As sleepmode current is the same for both 1Mhz and 8Mhz.

                                  One can also argue that if you are using 1Mhz, then the program execution will be longer, compared to 8Mhz. So when it wakes up from sleep mode, it will stay awake for a longer time, if running at 1Mhz, compared to 8Mhz.

                                  ahmedadelhosniA 1 Reply Last reply
                                  1
                                  • tbowmoT tbowmo

                                    for a MCU that never enters sleep states, running at 1Mhz can save you some power, compared to running at 8Mhz. But if you plan to enter sleep state, and only wake up periodically, you won't gain that much. As sleepmode current is the same for both 1Mhz and 8Mhz.

                                    One can also argue that if you are using 1Mhz, then the program execution will be longer, compared to 8Mhz. So when it wakes up from sleep mode, it will stay awake for a longer time, if running at 1Mhz, compared to 8Mhz.

                                    ahmedadelhosniA Offline
                                    ahmedadelhosniA Offline
                                    ahmedadelhosni
                                    wrote on last edited by
                                    #35

                                    @tbowmo Good points. Neven thought about it as I flash 1Mhz always.
                                    I may try power consumption using 8Mhz in a new sensor node.
                                    Thanks for the info.

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      meddie
                                      wrote on last edited by meddie
                                      #36

                                      yes me too. i will try my test setup to burn the bootloader at 8 mhz. It would make much easier.

                                      1 Reply Last reply
                                      0
                                      • SoloamS Offline
                                        SoloamS Offline
                                        Soloam
                                        Hardware Contributor
                                        wrote on last edited by
                                        #37

                                        Any one tried to run a atmega with encryption and software signing? And with Hardware Signing?

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

                                          Yes.

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

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


                                          24

                                          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