5optOut - CourseReps/ECEN489-Fall2015 GitHub Wiki

Standardized Protocol

As UDP is connectionless, the client has to be authenticated at the server during broadcasting and server has to be authenticated at the client while Acknowledging.

One way to do is to have device key and server key pair at each sensing device and server. The device uses device key for authentication at server and server uses server key corresponding to the device while acknowledging.

Note: The device key must be encrypted when broadcasting.

Clients BroadCast JSON Message

{  
	"DeviceId":   "XXXX"   
    "DeviceKey":  "encrypted Device Specific Key"   // Key is used for authentication of client
 	"timestamp":  "123456789"   
    "ClientIP":  "123456789"                
     
}    

Server Acknowledge JSON Message

{  
	"Authentication":   "Denied/Accepted"   
    "ServerKey":  "server Key corresponding to device ID"   // used for authentication of server at client
    "ServerIP":  "123456789"                        
}  

Tasks

Lets say there are 4 clients and one server. Clients will be using UDP to broadcast

  1. What is the content and format of the client's broadcast message? (if JSON, then the attribute name and value have to be standardized)

    • The content should help the server to identify the client
    • For the server to reply back, the content should contain current IP of the client
  2. As it is UDP, the server has to reply back to make sure the client message has received the server. So,the format of the reply message ?

    • A JSON object with attributes Success (true/false), client IP, and Error(if there is one). This could be encrypted as well.
  3. How to ensure secure communication?

    • The message can be encrypted
    • Client can authenticate itself to server before sending the relevant information
      • Send a secret encrypted with the server's public key
      • If server has a public key, then any client can act as a server. So, I suggest we have a server-client key pair
  4. How to determine the size of the buffer for receiving message at the server? [Resolved]

    • We can use some large constant buffer size, but if message size exceeds the buffer size, it will be truncated

Comments:

  • Please enter the comments here

  • We can use SSH for the authentication of client (have to see whether it is feasible in C++)

  • Since most of us have the framework, I don't see much reason to stray from sending a JSON object as a string or byte array over UDP to identify the clients. (Travis)

  • I am unfamiliar with the issue in #4, regarding determining message size. In my program, the receiving function tells how many bytes it read. Is this an issue when not using boost? (Travis)

    • (Reframed Issue#4) In boost, to determine the buffer size. In your case, we have to use a large buffer in case we try to send files instead of JSON messages in the later phase. (pranay)
  • What type of messages are we trying to communicate? I know we will be using JSON objects during the initial phase but after that. (pranay)

    • I believe the scenario he mentioned was for "sensing units" to be relaying data to a centralized database using this framework. So, I believe it would just be sensor data.
    • Thanks, then we can estimate the maximum size of buffer and use that for receiving JSON messages (I thought, if we send the database files, then estimating the max buffer size will be difficult )
  • GPG is a good tool for encryption/decryption. https://gpgtools.org/