Can't create MySigningAtsha204Soft signer



  • I'm trying to introduce signing to my projects, but can't create the MySigningAtsha204Soft object. What did I miss here:

    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    #include <MySigningAtsha204Soft.h>
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    MyTransportNRF24 radio; // NRFRF24L01 radio driver 
    MyHwATMega328 hw; // Select AtMega328 hardware profile 
    // Change the soft_serial value to an arbitrary value for proper security 
    uint8_t soft_serial[SHA204_SERIAL_SZ] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
    MySigningAtsha204Soft signer(true, 0, NULL, soft_serial); // Select SW ATSHA signing backend
    MySensor gw(radio, hw, signer);
    

    Compiler returns error: no matching function for call to 'MySigningAtsha204Soft::MySigningAtsha204Soft(bool, int, NULL, uint8_t [9])'


  • Mod

    Which version of the MySensors library are you using? Looks like the example for 1.5.x, but I think it has changed for the development version.

    Either use the example with MySensors 1.5.x or use the development version and follow the instructions embedded in the source files (they are available online somewhere I think but I don't know where).



  • @mfalkvidd I'm using 1.5.1 version of MySensors.


  • Mod

    Strange. The code looks fine to me. Maybe @Anticimex has a clue?


  • Contest Winner

    You try to instantiate an object with arguments that indicate you want whitelisting. Are you sure you have set MY_SECURE_NODE_WHITELISTING? If you have not, you have an incorrect number of arguments.


  • Contest Winner

    This is the constructor:

    MySigningAtsha204Soft(bool requestSignatures=true,
    #ifdef MY_SECURE_NODE_WHITELISTING
    		uint8_t nof_whitelist_entries=0, const whitelist_entry_t* the_whitelist=NULL,
    		const uint8_t* the_serial=NULL, //SHA204_SERIAL_SZ sized buffer expected if provided
    #endif
    		uint8_t randomseedPin=MY_RANDOMSEED_PIN);
    


  • Thank you, I managed to compile the program, by enabling whitelisting.
    But I don't understand, since I copied the sketch above from [security] Introducing signing support to MySensors, from example without whitelisting.
    And how can I tell if everything works fine (messages are properly signed). I receive messages on the Gateway, in debuuging i see:
    send: 28-28-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
    send: 28-28-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.1
    send: 28-28-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    no sign
    sensor started, id=28, parent=0, distance=1
    send: 28-28-0-0 s=255,c=3,t=11,pt=0,l=8,sg=0,st=ok:Humidity
    send: 28-28-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 28-28-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,st=ok:
    send: 28-28-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    send: 28-28-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:21.0
    T: 21.00
    send: 28-28-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:45.0
    H: 45.00
    send: 28-28-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:44.0
    H: 44.00
    send: 28-28-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:45.0
    H: 45.00


  • Contest Winner

    @bogdan there are no signed messages in that log (sg=0). If you want signed messages, you need to tell your node to require signed messages. What settings have you enabled in your sketch in addition to enabling signing and whitelisting? Enabling signing just tells your sketch that it can sign messages, it does not mean that the node will require others to sign messages sent to it.


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 24
  • 2
  • 15
  • 1

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts