Device Protocol Design for Security on Internet of Things based Smart Home

— One of the major challenges that arise in the internet of things (IoT) based smart home systems is security issue. It is still relatively low in which the exchange of data between devices can easily be stolen by outsiders since it is connected to the internet. In this work, we present the details of the protocol messages in smart home appliances that are encrypted by RSA algorithm and AES in which the RSA key was regenerated in every turnover of the day (exactly at 00:00:00 or 1 x 24 hours) since the last key generation by mobile. The performance test is done by sending an error command and a correct command to the RGB lamp device. The results show that the designed protocol works well as expected. Given the security mechanism in the designed protocol, data exchange between devices in the smart home will be hard to break by outsiders. Thus, the users can enjoy their smart home privacy without worrying the intruders (hacker).


Introduction
The applications of an IoT at smart home systems are based on the convenience to access home appliances everywhere and anytime, not only limited to whether users are inside or outside of their home. The main problem that emerges in the smart home system is network security where all devices connected to the internet are very vulnerable to hacker attacks [1]. Hackers can break (illegitimately snoops) into the server and retrieve important information (e.g. home address, information about home devices, and damage the intelligent home system). A good security aspect and adequate comfort of an IoT based smart home are certainly important and extremely needed [2], it is legitimate to be implemented in order to allow a fully "privacy control" to the users [3][4]. In the other hand, an efficient mechanism for securing the home appliances connected to the internet is also concerned [5].
H. Suo et al summarize the security requirement in each layer that consists: application layer, support layer, network layer, and perceptual layer [6]. The application layer is related to the client's privacy protection that includes access control (password management and key agreement) and data authentication to resilience against the attackers. In this work, we concentrate in an application layer, exactly in a secure data payload protocol design on the internet of things (IoT) based smart home devices for verifying the data communication in the home intelligent indoor system. It is employed as the only communication path among devices.
Compared to existing protocol for IoT which are Message Queuing Telemetry Transport (MQTT) and Constrained Application Protocol (CoAP), our proposed protocol has several advantages over those two protocols with several similar properties. In terms of advantage gathered from [7], several parameters are considered: • Layer Security (DTLS). Our protocol is fully flexible, with a double-verification as a foundation. In MQTT, the problems will arise in open networks because of there will be no information about how it is encoded. [8]. • Quality of Service (QoS): Similar as MQTT, our protocol ensure three types of the QoS, which are: 1) At most once; 2) At least once; 3) Exactly once [9].
In Section II, we described briefly the smart home system that used in this work. The detailed scenarios of secure protocol message will be explained in Section III. Our smart home system allows anyone intercepting the messages cannot open as well as find the structure of the message with hard effort. The result and analysis is brought to Section IV.

Previous Research
In this work, we used the smart home full-system in which the block diagram is illustrated in Fig. 1 (the illustration is reproduced from T. Adiono, et al. [17]). The system consists of four elements: i) users, ii) cloud server and iii) access point as a home gateway, the last part is iii) home devices (nodes) that are coordinated by a host [10][11]. These devices communicate to each other via ZigBee® protocol and controlled by a Raspberry® host. There are three types of the developed devices that represent the common home appliances: mechanical-based (horizontal curtain, fan, and door lock), electronic-based (Red-Green-Blue lamp, generic switches, lamp switches, and temperature sensor monitoring) [12][13] and Infra-red based (television, air conditioner, LCD projectors) [14]. The users grant access to the home appliances through an Android application, namely MINDS-app, in which this app is installed on the user's mobile phone [15][16]. It is the main tool that connects the users to the whole system. Whereas to control the IR-based devices, we incorporated the IR remote.
Our smart home system offers the benefit to the users, because we have equipped a dynamic key validation system which will be discussed detail in this paper. The security scenario consists of RSA algorithm, advanced encryption standard (AES), and also self-made protocol messages. This protocol can only be accessed after successful connection with the server, which is encrypted with RSA and AES method. The public key will change daily at every 00:00:00 or 1 x 24 hours. This complicated technique can realize the secure data exchange among devices that cannot be stolen easily by the outsiders. However, in this paper, we only study on designing a secure communication protocol between the devices in which the detailed scheme is presented in Section II. To ensure the designed protocol is working properly, we used our smart home miniature, namely meshed-internet networked system (MINDS®) as tester device (Fig. 2). Every nodes contained: XBee module, Microcontroller STM32L100 minimum kit, electronic drivers, power supply circuit, and LED or actuator (in form DC motor for fan, stepper motor for curtain, solenoid for door lock, relay for lamp switch) as a final part.

Methods
The security scenario of the communication is depicted in Fig. 3 Before connecting access to the home appliances that located in the indoor environment, the first step is the user should verify it by sending a message to the server in which the key is shifted periodically using RSA algorithm and AES. In other words, before the user sends a protocol messages, the communication between user and server have to pass the security verification. Thus, to control the smart home devices shouldn't be breached its procedures (e.g. bypassed directly from the host). The server as the only way that links the user to the host.
All communication processes are encrypted with AES standards, except when the user wants to "login" to the system in which the security of communication employing the combination of AES and RSA as appropriate with the efficient mechanism depicted in Fig. 3. In short description, the combination between RSA and AES are performed merely for the login (sign-in) process. When the user has successfully signed-in, the RSA is no longer needed and it will be processed straightforward using AES only. But on the next day, the RSA keys will be activated automatically and so the user should request again in which the procedure is similar as the previous day. In this work, the RSA key will be updated once in a day (1 x 24 hours) and continuously consistent throughout the year.
The mechanism of communication encryption using RSA and AES has already been discussed in [18]. The technical chronology of the process as follows: 1) the server generates RSA public and private keys; 2) the client generates AES key when intending to sign-in and sends requests; 3) the server sends public key; 4) the client forms sign-in message (containing AES key) encrypted using RSA; 5) the client sends sign-in message; 6) the server decrypts the message using private key; 7) the server send sign-in reply encrypted using AES; 8) the client receives the reply and the subsequent communications are encrypted using AES.

Fig. 3. Encrypted communication mechanism of sign-in process using RSA and AES
As an overview, the RSA itself is run by following step [19]: a) Select two different prime numbers randomly, p and q, preferably is (p ! q) because if p = q then the value of n will be squared. b) Calculate n = p * q c) Calculate " = (p-1)*(q-1). d) Select a public key e, where 1 < e < " (n), gcd (e, " (n)) = 1 e) Generate a private key by using the equation d = ! !! mod " (n). f) The results of the calculation are: public key = [e, n], private key = [d, n] g) For "encryption" use the equation below: ! ! ! ! ! ! !!"#!! , where ! ! is a transmitted message and e is the key of the received message. h) For "decryption" use the equation below:! ! ! ! ! ! !!"#!!, where ! ! is a received message and d is the key of the sent message.
As stated in Section II, we focus on the protocol design. They indicated in fourth step process of Fig. 3. We refer to the research on paper [20] where the data exchange protocol among devices used in our smart home system are shown in Table 1. In this work, we discuss on the Data Payload section due to its infinite capacity so that it can be applied as additional security system for smart home system. The Data Payload protocol proposed in this paper is shown in Table 2. In this protocol, two verifications are required that a combination of HomeID and Device Address data before controlling the device. HomeID is a 6-bytes information which is a combination of numbers from 0-9 and is highly confidential and is known only to home owner. The selection of 6 bytes is due to fulfill great capacity for smart home users, covering up to 10 48 houses. The Device Address is the 8 bytes information printed on the device in the form of QR code that has been encrypted using RSA algorithm and AES. These 8 bytes are selected because the production code for each item is 8 combinations of letters and numbers printed on Xbee module. These 14 bytes will then be merged and implemented as a verification system to perform device control. After the messages sent in accordance with this verification, the device will be ready to receive Command of n bytes (depending on device) which is the information in the form of control device desired by user.
Suppose a home has HomeID = XXXXXX, and Device Address RGB lamp = YYYYYYYY, whereas the main verification to be sent by the host will be XXXXXXYYYYYYYY. Afterward, the RGB lamp is ready to accept the control command and the host will send a color command which is the value of R, G and B. The Delivery Command with format of (0, 0, 255) sequentially, will produce a bright blue color on RGB lamp.

Results and Analysis
This protocol testing is done to the RGB lamp device in our smart home system and the flowchart is shown in Fig. 4. In the flowchart shown, it is to be noted that the conditional blocks of Statereceive == 6 and Statereceive == 14 is not implemented in the real code. Those blocks are put to help explain better of the flowchart system, which Statereceive == 6 means it is done reading and verifying HomeID; Statereceive == 14 means it is done reading and verifying Device Address, and is ready to read RGB values. The sending of data is done by Raspberry® host and data is sent to each device for control on two scenarios. If the data sent does not confirm to the designed protocol, then the device will not perform the desired command as shown in Fig 5(a). If the correct command is sent, thus the RGB lamp device will respond as visualized in Fig.  5(b). In case of this functional test, we bypassed directly from the host to the nodes via designed protocol. It means, the security mechanism is not involved. In this implementation, the simply protocol used is sequence number, that is 123456 for HomeID and then plus 40A88BB2 and plus the value of Red color (0-255) + value of Green color (0-255) + value of Blue color (0-255).

Conclusion
We have carried out a security implementation on Data Payload protocol that includes initial verification of combination from the HomeID and Device Address data in which they are encrypted with RSA algorithm and AES. It is very important to ensure a secure communication among devices in smart home system, so it can serve the privacy control to the users. With this scheme, each device in the smart home has a different process and verification. Certainly, it will be able to make hard for outsiders to find out the data packets or even grabbing/breaking the transmitted information.
In the case of protocol security, it is expected to be more optimized again thus the number of bits employed is not too much. Certainly, it will take high power consumption of the system if the designed protocol has very long of bits. In addition, the payload data is recommended to be encrypted for a more secure smart home system. Furthermore, the updated simultaneously of RSA key in every hours of the day is also considered to be realized.