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. Troubleshooting
  3. Encryption with RFM69 and PI serial GW

Encryption with RFM69 and PI serial GW

Scheduled Pinned Locked Moved Troubleshooting
19 Posts 2 Posters 1.3k Views 3 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.
  • JerbyJ Offline
    JerbyJ Offline
    Jerby
    wrote on last edited by
    #1

    How does encryption with RFM69 work?
    The RFM69 has build in hardware encryption with a AES key of 16 bytes. But when builing the rPI GW a 32bytes AES key is required else it report "warning wrong AES key". For building the nodes it is also required to define a 32bytes MY_RFM69_ENCRYPTKEY to be able to communicate with the rPI GW.
    It seems that for encryption with the RFM69 only the first 16bytes are used and the personalised encryptkey in EEPROM of a node is not used. Is this correct?

    AnticimexA 1 Reply Last reply
    0
    • JerbyJ Jerby

      How does encryption with RFM69 work?
      The RFM69 has build in hardware encryption with a AES key of 16 bytes. But when builing the rPI GW a 32bytes AES key is required else it report "warning wrong AES key". For building the nodes it is also required to define a 32bytes MY_RFM69_ENCRYPTKEY to be able to communicate with the rPI GW.
      It seems that for encryption with the RFM69 only the first 16bytes are used and the personalised encryptkey in EEPROM of a node is not used. Is this correct?

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

      @jerby I am afraid I don't understand. All encryption variants uses 16 byte AES key. Signing (which is not encryption) uses a 32 byte MHAC key but that is something completely different.

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

      1 Reply Last reply
      0
      • JerbyJ Offline
        JerbyJ Offline
        Jerby
        wrote on last edited by
        #3

        Hi Anticimex, I'm puzzled, in the node I used the 16byte aes key from the personaliser. That value is a hex code of 32 characters and in the examples found on the forum there are 16 characters. Where is the translation made from bytes to characters? And is hardware encryption automatically used in case of RFM69 radio's?

        AnticimexA 1 Reply Last reply
        0
        • JerbyJ Jerby

          Hi Anticimex, I'm puzzled, in the node I used the 16byte aes key from the personaliser. That value is a hex code of 32 characters and in the examples found on the forum there are 16 characters. Where is the translation made from bytes to characters? And is hardware encryption automatically used in case of RFM69 radio's?

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

          @jerby one hex character can encode 16 values. So a single hex character represent 4 bit. So one byte is 2 hex characters. Therefore, in order to represent 128 bits (the AES key length), you need 32 hex characters which is 16 bytes of data.

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

          1 Reply Last reply
          0
          • JerbyJ Offline
            JerbyJ Offline
            Jerby
            wrote on last edited by
            #5

            @Anticimex I fully agree, but the examples give a 16bytes ascii encrypt key and 1 ascii character is 2 bytes. I did not specify that my entered key is in bytes so I would expect that the compiler converts it to 32hex characters but it dpoesn't do that else my communication wouldn't work!?

            AnticimexA 2 Replies Last reply
            0
            • JerbyJ Jerby

              @Anticimex I fully agree, but the examples give a 16bytes ascii encrypt key and 1 ascii character is 2 bytes. I did not specify that my entered key is in bytes so I would expect that the compiler converts it to 32hex characters but it dpoesn't do that else my communication wouldn't work!?

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

              @jerby one ascii character when used to represent a hex value represent a hex value which means that it can only express 0-9 and a-f which is 4 bits. The storage used to store the representation is larger yes, as one character takes 8 bits but that is irrelevant as the compiler will interpret 0x<value> as hex so when assigning something that value only 4 bits data is moved. You could try use 0x2G or similar as key but unless the compiler is fundamentally broken that will not compile.

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

              1 Reply Last reply
              0
              • JerbyJ Jerby

                @Anticimex I fully agree, but the examples give a 16bytes ascii encrypt key and 1 ascii character is 2 bytes. I did not specify that my entered key is in bytes so I would expect that the compiler converts it to 32hex characters but it dpoesn't do that else my communication wouldn't work!?

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

                @jerby and in the rPi case I believe the key is stored in a file in a somewhat compressed manner so python or whatever interpreter used knows that the string is a hex string, so if the example list a key in something like
                '3f7ba35290dc327b28a4f7b2c6a910db' it should also fail if you then try '3f7ba35290dc327b28a4f7b2c6a910gb'.

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

                1 Reply Last reply
                0
                • JerbyJ Offline
                  JerbyJ Offline
                  Jerby
                  wrote on last edited by
                  #8

                  @Anticimex, clear therefore I don't understand that my configuration as given below is working.

                  rPI mysensors.conf
                  aes_key=D35AB40FDE3DBF9EAB4DC9CDA48EDB55

                  promini node:
                  #define MY_RFM69_ENABLE_ENCRYPTION
                  #define MY_RFM69_ENCRYPTKEY "D35AB40FDE3DBF9EAB4DC9CDA48EDB55"

                  Thanxs for your quick replies.

                  AnticimexA 2 Replies Last reply
                  0
                  • JerbyJ Jerby

                    @Anticimex, clear therefore I don't understand that my configuration as given below is working.

                    rPI mysensors.conf
                    aes_key=D35AB40FDE3DBF9EAB4DC9CDA48EDB55

                    promini node:
                    #define MY_RFM69_ENABLE_ENCRYPTION
                    #define MY_RFM69_ENCRYPTKEY "D35AB40FDE3DBF9EAB4DC9CDA48EDB55"

                    Thanxs for your quick replies.

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

                    @jerby well, as far as I know, there is no such define available: MY_RFM69_ENCRYPTKEY
                    Arduinos are personalized with their keys using a personalizer sketch. If you don't want to do that there is the "simple" security flags.
                    Are you sure encryption is really activated at both ends?

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

                    1 Reply Last reply
                    0
                    • JerbyJ Jerby

                      @Anticimex, clear therefore I don't understand that my configuration as given below is working.

                      rPI mysensors.conf
                      aes_key=D35AB40FDE3DBF9EAB4DC9CDA48EDB55

                      promini node:
                      #define MY_RFM69_ENABLE_ENCRYPTION
                      #define MY_RFM69_ENCRYPTKEY "D35AB40FDE3DBF9EAB4DC9CDA48EDB55"

                      Thanxs for your quick replies.

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

                      @jerby if you run the personalizer sketch with proper flags, it will show you the data in eeprom. The radio uses the AES key in eeprom if you enable encryption on the node. And afaik, it is not supported to define any security keys as strings in the sketches, the only exception being the "simple" flags. The personalizer uses 0x hex byte syntax for its definition and I believe the personalizer also provide the keys in that form in the personalization flow for simple deployment purposes (copy+paste).

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

                      1 Reply Last reply
                      0
                      • JerbyJ Offline
                        JerbyJ Offline
                        Jerby
                        wrote on last edited by
                        #11

                        @Anticimex, great that could be the answer. I'll build the node without #define MY_RFM69_ENCRYPTKEY and see if they still communicate. Thxs.

                        1 Reply Last reply
                        0
                        • JerbyJ Offline
                          JerbyJ Offline
                          Jerby
                          wrote on last edited by
                          #12

                          @Anticimex, test failed. So #define MY_RFM69_ENCRYPTKEY is required for encryption with the RFM69 and encryption key from EEPROM is not used!
                          My question how does the compiler know that the entered MY_RFM69_ENCRYPTKEY is in hex and not acsii is still a mistory to me.
                          Regards, and thanks for your help.

                          AnticimexA 1 Reply Last reply
                          0
                          • JerbyJ Jerby

                            @Anticimex, test failed. So #define MY_RFM69_ENCRYPTKEY is required for encryption with the RFM69 and encryption key from EEPROM is not used!
                            My question how does the compiler know that the entered MY_RFM69_ENCRYPTKEY is in hex and not acsii is still a mistory to me.
                            Regards, and thanks for your help.

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

                            @jerby I need more details on your setup to be able to help you.
                            Your flag is unknown to me and non-existant in the MySensors repository as you can see here: https://github.com/mysensors/MySensors/search?utf8=✓&q=MY_RFM69_ENCRYPTKEY&type=

                            So you must be running some other code base for your things that I am unfamiliar with.

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

                            1 Reply Last reply
                            0
                            • JerbyJ Offline
                              JerbyJ Offline
                              Jerby
                              wrote on last edited by
                              #14

                              @Anticimex, this is the references that I found:

                              https://github.com/Oitzu/mysensors-Arduino-attiny/pull/2/commits/74a54267d2b76c1cd509ae4245d4d3837270670b?diff=unified

                              row 418.

                              AnticimexA 1 Reply Last reply
                              0
                              • JerbyJ Jerby

                                @Anticimex, this is the references that I found:

                                https://github.com/Oitzu/mysensors-Arduino-attiny/pull/2/commits/74a54267d2b76c1cd509ae4245d4d3837270670b?diff=unified

                                row 418.

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

                                @jerby from the readme of that fork, the library version is 1.4. That is practically ancient and probably before I even started on the security framework.
                                It is certainly not compatible with anything current in the MySensors environment. And with current I am talking about something from the last 3 years.

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

                                1 Reply Last reply
                                0
                                • JerbyJ Offline
                                  JerbyJ Offline
                                  Jerby
                                  wrote on last edited by
                                  #16

                                  @jerby said in Encryption with RFM69 and PI serial GW:

                                  @Anticimex,

                                  My configuration is as follows:
                                  I started with a rPI with Domoticz and NRF24 nano GW and nodes with soft signing and encryption. I've added a RFM69 nano GW with soft signing and encryption and converted one node from NRF24 to RFM69. That configuration worked but the serial GW's got mixed up. The RFM69 sensors showed up under NRF24 GW and working so I even could disable the RFM69 under Hardware while the RFM69 sensors still worked via the NRF24 GW. The sketch name of the RFM69 also showed up at the NRF24 GW. Therefore I removed the RFM69 nano GW and connected the RFM69 on the I/O pins of the rPI and configured the rPI as follows:

                                  *git clone https://github.com/mysensors/MySensors.git --branch master

                                  configured the keys from the personaliser in the file etc/mysensors.conf

                                  sudo ./configure --my-transport=rfm69 --my-rfm69-frequency=433 --my-is-rfm69hw --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyUSB020 --my-rfm69-irq-pin=22 --my-rfm69-cs-pin=24 --my-rfm69-encryption-enabled*

                                  sudo make install
                                  etc.

                                  And the promini node with:
                                  #define MY_IS_RFM69HW
                                  #define MY_RFM69_FREQUENCY (RFM69_433MHZ)
                                  #define MY_RFM69_NETWORKID 100 // Default network id. Use the same for all nodes that will talk to each other
                                  #define MY_RFM69_ENABLE_ENCRYPTION
                                  #define MY_RFM69_ENCRYPTKEY "D35AB40FDE3DBF9EAB4DC9CDA48EDB55"
                                  #define MY_RFM69_NEW_DRIVER

                                  When I remove the #define MY_RFM69_ENCRYPTKEY communication doesn't work any more.

                                  I use platformio as development platform.
                                  Hope this is sufficient info of my setup.

                                  AnticimexA 1 Reply Last reply
                                  0
                                  • JerbyJ Jerby

                                    @jerby said in Encryption with RFM69 and PI serial GW:

                                    @Anticimex,

                                    My configuration is as follows:
                                    I started with a rPI with Domoticz and NRF24 nano GW and nodes with soft signing and encryption. I've added a RFM69 nano GW with soft signing and encryption and converted one node from NRF24 to RFM69. That configuration worked but the serial GW's got mixed up. The RFM69 sensors showed up under NRF24 GW and working so I even could disable the RFM69 under Hardware while the RFM69 sensors still worked via the NRF24 GW. The sketch name of the RFM69 also showed up at the NRF24 GW. Therefore I removed the RFM69 nano GW and connected the RFM69 on the I/O pins of the rPI and configured the rPI as follows:

                                    *git clone https://github.com/mysensors/MySensors.git --branch master

                                    configured the keys from the personaliser in the file etc/mysensors.conf

                                    sudo ./configure --my-transport=rfm69 --my-rfm69-frequency=433 --my-is-rfm69hw --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyUSB020 --my-rfm69-irq-pin=22 --my-rfm69-cs-pin=24 --my-rfm69-encryption-enabled*

                                    sudo make install
                                    etc.

                                    And the promini node with:
                                    #define MY_IS_RFM69HW
                                    #define MY_RFM69_FREQUENCY (RFM69_433MHZ)
                                    #define MY_RFM69_NETWORKID 100 // Default network id. Use the same for all nodes that will talk to each other
                                    #define MY_RFM69_ENABLE_ENCRYPTION
                                    #define MY_RFM69_ENCRYPTKEY "D35AB40FDE3DBF9EAB4DC9CDA48EDB55"
                                    #define MY_RFM69_NEW_DRIVER

                                    When I remove the #define MY_RFM69_ENCRYPTKEY communication doesn't work any more.

                                    I use platformio as development platform.
                                    Hope this is sufficient info of my setup.

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

                                    @jerby can you confirm that you run with the same library version in both gateway and node?
                                    And that the encryptkey flag is not present in any code you use. Because it shouldn't if you run with a library from the ladt 4 years. And therefore the presence of that flag or not in your code should have no effect. So I suspect you run an outdated version of the library or a fork.

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

                                    1 Reply Last reply
                                    0
                                    • JerbyJ Offline
                                      JerbyJ Offline
                                      Jerby
                                      wrote on last edited by
                                      #18

                                      @Anticimex, I confirm that I'm have build pro mini and rPI on MySensors version 2.3.1 and didn't specify the encryptkey other than in given define and in EEPROM.

                                      So now I removed the define again and ... communication is still working:walking: , you :muscle: where absolutely right. Don't know what I did yesterday :man-shrugging:

                                      Tomorrow I'll start again with adding software signing and see if that will work too.

                                      Thanks again for your patience and help, great support :clap: .

                                      AnticimexA 1 Reply Last reply
                                      1
                                      • JerbyJ Jerby

                                        @Anticimex, I confirm that I'm have build pro mini and rPI on MySensors version 2.3.1 and didn't specify the encryptkey other than in given define and in EEPROM.

                                        So now I removed the define again and ... communication is still working:walking: , you :muscle: where absolutely right. Don't know what I did yesterday :man-shrugging:

                                        Tomorrow I'll start again with adding software signing and see if that will work too.

                                        Thanks again for your patience and help, great support :clap: .

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

                                        @jerby glad that things worked out for you 👍 always happy to give a helping hand with security :)

                                        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


                                        20

                                        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