Design and Evaluation of Identity-based Cryptography Algorithm for The Smart-home Solution Hung Quang Nguyen VSB-TUO, Ostrava, Czech Republic hung.quang.nguyen.st@vsb.cz Abstract. Smart homes meet all the needs of people with their "intelligence." However, to reduce costs, providers currently only use existing encryption tech- niques of wireless networks. In fact, these encryption techniques are beneficial for data transmission in a wireless environment. But Smart-home is built on wire- less sensor networks (WSN) with the energy-saving requirements. Encryption based on the Elliptic curve uses fewer strings than any other encryption technique with the same level of safety, and using Elliptic curve cryptography (ECC) is optimal for energy for the Smart-home deployment. Currently, Smart-homes only use one server (Home server) to manage and implement the user's requests. Therefore, if it uses ECC for communication between the user and the Home server, the first thing required is the agreement between two sides to select the Elliptic curve. To alleviate this stage, the proposed solution is to use another server (Key server). Its main task is sending keys and parameters of the Elliptic curve for the users and the Home Server. The key servers can be shared among multiple Smart- homes, which helps to increase the links between suppliers and customers. Using the Elliptic curve for encryption and decryption, information should be converted into points on the curve, and ASCII is the current solution. But with a higher security level, using conversion tables to change the values for each curve is a better solution. Moreover, this solution also offers certification as one more se- curity layer for device authentication. Finally, it makes Smart-home safer as it prevents forgery cases. Keywords: Smart-home, security, ECC.  Copyright © by the paper’s authors. Use permitted under Creative Commons License Attribu- tion 4.0 International (CC BY 4.0). In: N. D. Vo, O.-J. Lee, K.-H. N. Bui, H. G. Lim, H.-J. Jeon, P.-M. Nguyen, B. Q. Tuyen, J.-T. Kim, J. J. Jung, T. A. Vo (eds.): Proceedings of the 2nd International Conference on Human-centered Artificial Intelligence (Computing4Human 2021), Da Nang, Viet Nam, 28-October-2021, published at http://ceur-ws.org Design and Evaluation of Identity-based Cryptography Algorithm 143 1 Introduction 1.1 Identity-based encryption (IBE) IBE is an important primitive of ID-based cryptography, a type of public-key cryp- tography, in which a publicly known string representing an individual or organization is used as a public key. The public string could include an email address, domain name, or a physical IP address. As such it is a type of public-key encryption in which the public key of a user is some unique information about the identity of the user. Agrawal [1] proposed a secure IBE model on the basis of hard problems. IBE is an efficient public-key encryption mechanism for secure communication between any pair of enti- ties without identity ID disclosure. The steps involved are described in the below figure: Fig. 1. ID Based Encryption: offline and online Steps [2] IBE was first referred to in 1984 by Adi Shamir [3], when he described the profile of the properties and how to use such a system. Although he failed to establish a safe technology with operational feasibility, but he described the workflow of IBE as fol- lows: While the traditional public key contains all the necessary parameters, in the IBE system, users need to get a set of parameters from a third party. Along with these pa- rameters, users can also calculate IBE public key of any other user to encrypt the infor- mation sent to them. The recipients of the encrypted information then validate it in with a private key generator (PKG), the IBE private key corresponding to a specific IBE public key generated by a trusted third party calculate. The master private key is gen- erated by PKG from a trusted third party using confidential information and the identity of the user. The private key is then delivered securely to the authorized users. On the other hand, an IBE scheme has four algorithms used to create and use a pair of private key - public key: setup algorithms, extraction algorithms, encryption algo- rithm and decryption algorithm. "Setup" is the algorithm to initialize the parameters 144 Hung Quang Nguyen needed for calculating of IBE, including the master private key that PKG used to create the IBE private keys. "Extraction" is the algorithm for calculating an IBE private key from the parameters created using the identity of the user and the master private key of PKG. "Encryption" is performed by IBE public key calculated. "Decryption" was per- formed by IBE private key. 1.2 Elliptic Curve Cryptography With the increasing popularity of cloud services and social networks, personal infor- mation in the Internet faces the risk of leakage. Thus, requirements for data security receive increasing concerns. An effective and most widely used method is data encryp- tion. Among many existing ciphers, Elliptic Curve Cryptography (ECC) is one of the strongest encryption algorithms, and also the most complex. Modern encryption is es- tablished based on the idea that the key used to encrypt the data can be released while the key for decrypting the data must be kept confidential. These systems are therefore known as public key encryption system. In 1985, public key encryption algorithm pro- posed new declaration based on an elliptic curve. Elliptic curves are a set of points correspond to a particular mathematical equation. The equation for an elliptic curve looks like: y2 = x3 + ax + b (1) It indicates that if there are any two points, provided a performance of "present itself n times”, then finding out n when only the beginning and the end points are known is very difficult. Applied to the example of billiard games, a player is in the room alone for a period of time, hitting the ball to follow the described rules. If someone else came into the room then and saw where marbles are, even if they know all the rules of the game and the start position, they cannot determine how many times balls are hit without play through the entire game again. Easy to implement, difficult to reverse action, this is a good TF. An ECC system can be defined by selecting a limited number of elements, making a curve equation and a point on that curve. A private key is a privy number and a public key as a result of the plus first point with itself privy times. Calculating the private key from the public key encryption system is called Elliptic Curve Discrete Logarithm Problem (ECDLP). It is the TF that researchers are looking for. In the current era of information and communications technology, the need to ensure information security is indispensable. With the increasing length of encryption key, ECC is a suitable candidate to replace RSA in creating the shorter code lock while safety is still ensured. It can be deployed on multiple platform devices from simple electronic circuits to the mainframe to create a reliable network to serve society better. The addition of points on elliptic curves over the real numbers is a good approach to see the underlying steps in performing the operation. However, calculations prove to be slow and inaccurate due to rounding errors, and the implementation of these calcu- lations into cryptographic schemes requires fast and precise arithmetic. Therefore el- liptic curve groups over finite fields such as ZP, when p > 3 is prime, are used in prac- tice. An elliptic curve with ZP as its underlying field can be formed by choosing a and Design and Evaluation of Identity-based Cryptography Algorithm 145 b within the field ZP. Similar to the real case, the curve includes all points (x, y) in Z P * ZP that satisfy the elliptic curve equation. y2 ≡ x3 + ax + b mod p (2) where x and y are numbers in ZP. Note that there are only finitely many points on this type of curve. As in the real case, if 4a3 + 27b2 ≠ 0 mod p, then the corresponding elliptic curve forms a group [4]. This group consists of the points on the curve, along with ∞, the point at infinity. Again, we define the negative of the point at infinity to be -∞ = ∞ and the negative of a point P = (xp , yp ) to be -P = (xp, -yp mod p). The arithmetic in an elliptic curve group over ZP is very similar to that done algebraically with elliptic curve groups over the real numbers, the only difference is that all calculations are per- formed modulo p [5]. Suppose P = (xp,yp) and Q = (xq,yq) and that P ≠ -Q. Let s be given by s ≡ (yp - yq) / (xp - xq) mod p. Then P + Q = R, where xr ≡ (s2 - xp - xq) mod p yr ≡ -yp + s * (xp - xr) mod p. As before, we define P + (-P) = ∞. If the y-coordinate of P is 0, modulo p, then P = -P, to double the point P = (xp,yp) with yp ≠ 0 mod p, let s be given by: s ≡ (3x2p + a) * (2yp)-1 mod p. We define 2P = P + P = R where: xr ≡ s2 - 2xp mod p, yr ≡ -yp + s * (xp - xr) mod p. 2 System design As mentioned above, IBE and ECC are very strong for encryption, thus combining them is a great solution to integrate the advantages of both method. Additionally, this combination also adds authentication by ID-device to increase the safety for the system. For maximum security, Smart-homes can only be controlled by the devices which were registered with the Home server. Key server is placed at the service provider to create and allocate private keys, public keys for users and Home server. The processes in this model include the below steps: ID authentication, create and send keys and information of Elliptic, encrypt and send the request, decrypt and exe- cute the request, decrypt and execute the feedback. Step 1/ User use a registered device (smartphone, tablet, laptop...) to connect to Home server Step 2/ If the device is genuine, Home server will notify Key server Step 3/ Key server requires User login Step 4/ User inputs username and password Step 5/ If the information is true, Key server will: Choose a curve Elliptic and 36 points in the curve with a selected base point P E. Using the agreed code table, 36 points are mapped to 26 characters of Alphabet (A,B,C ... X,Y,Z) and ten numbers from 0 to 9. Each character or number is corre- sponding to each point of Elliptic. 146 Hung Quang Nguyen Select a random number, it is a master private key (MPK) Create the private key (PR), the public key (PU) for User (U) and Home server (H) by calculate: H (IDU): hash value to the identity of User (IDU) PRU = MPK * H (IDU): a private key of User PUU = PRU * PE, PUU: a public key of User Choose a random number, it is the private key of Home server (PRH) PUH = PRH * PE: the public key of Home server Send keys and information of curve to User and Home server User uses PUH to encrypt and send the request (RQ) to the Home server by: Choose a random number K1 RQ1 = K1 * PE RQ2 = RQ + K1 * PUH Send {RQ1, RQ2} to Home server Step 7/ Home server uses PRH to decrypt request and execute it using the equation: RQ2 - PRH * RQ1 = (RQ + K1 * PUH) - PRH * (K1 * PE) = RQ + (K1 * PRH * PE) - (PRH * K1 * PE) = RQ Step 8/ Home server uses PUU to encrypt and send the feedback (FB) to User by: Choose a random number K2 FB1 = K2 * PE FB2 = FB + K2 * PUU Send {FB1, FB2} to User Step 9/ User uses PRU to decrypt feedback using the equation: FB2 - PRU * FB1 = (FB + K2 * PUU) - PRU * (K2 * PE) = FB + (K2 * PRU * PE) - (PRU * K2 * PE) = FB The devices used to control Smart-homes must have a specific license, without with the attempt to access or control the system will be denied. The users are created for all members of Smart-homes, and they will be able to log in from any device provided the license. According to the theory, if each user can use only on one device, it will be more secure. But in reality, it can cause some troubles. For example, one device is lost or its battery is dead, the owner of that device must use other people's device, along with the information to control Smart-home. Such situations are not feasible. Also, the majority of users are using many devices (smartphones, tablets, laptops...), so we have to create several users only for a person, which is wasteful and difficult to remember all creden- tials. Elliptic is calculated based on the numbers, so related information must be con- verted to numbers. That is the reason the identities of users need to use hash function to get corresponding numbers in the database. Also, when the encryption and decryp- tion requests are made by users, they must be converted into points on the curve. If a user wants to open the door and send a request message “DOOR”, all the points on the elliptic curve can be directly mapped to an ASCII value. Select a curve and we will get a minimum of 128 points so that we fix each point on this curve to an ASCII value. For example, “DOOR” can be written as a sequence of ASCII as “68-79-79-82”, we can map these values to fixed points on the curve. The steps for encoding and decoding are given in the flowchart. Each character is mapped to a corresponding number in ASCII Design and Evaluation of Identity-based Cryptography Algorithm 147 table, and this number is converted to a point on the curve. Because all requests for Smart-homes are not the custom chain of commands and they are based on available scenarios. Every request can be assigned to a particular number. Hash function is used to make a number compatible with a request. The two mentioned methods have some disadvantages: if a hacker knows how to get the numbers, they can calculate from the given numbers and find the corresponding command, the system will not be safe any- more. For example, if they know the periods when the door open, they will penetrate before when nobody is home. Another method using the change in the process of cre- ating Elliptic curve to build many rules to convert numbers. We will choose 36 points in each curve and calculate as follows: Choose x = 0, calculate y give us 2 points in the curve. Plus x with 1 and continue calculating, until we find 36 points in the curve. Assign 36 points with 26 characters of the alphabet and 10 numbers from 0 to 9. This method has different mapping rules for each command, so hackers cannot rely on them to find out the requests of the user. 3 Simulation scenario We use Sagemath 7.0 to simulator the scenario, this tool runs in CentOS system. The hardware of the used computer: Intel Core i5-4200M CPU, 16GB RAM and 1TB HDD. Create the private key (PR), the public key (PU) and Elliptic curve Choose a Elliptic curve and a base point P in curve: y2 = x3 + ax + b mod p If a = 2, b = 9 and p = 37; we have: E37 (2,9) = (y2 = x3 + 2x + 9) mod 37 Selects a random number, it is a master private key (MPK): we choose number 4 H (IDU): hash value to the identity of the user (IDU), assumption it is 5 PRU = MPK * H (IDU) = 4 * 5 = 20 And PUU = PRU * PE = 20 * (10,20) = (26,32) Choose a random number, it is a private key of Home server (PRH), assumption it is 6 PUH = PRH * PE = 6 * (10,20) = (15,26) Assign 36 points with 26 characters of the alphabet and 10 numbers from 0 to 9, we have: Fig. 2. Mapping of E37 (2,9) 148 Hung Quang Nguyen Suppose a user wants to open the system 1 in Smart-home and send the request: OPEN1, corresponding to points on the E37: O = (10,17) and we select number 7 is K1, Encryption:{RQ1, RQ2} = {N, Y} P = (10,20) and we select number 8 is K1, Encryption:{RQ1, RQ2} = {F, V} E = (2,13) and we select number 9 is K1, Encryption:{RQ1, RQ2} = {X, S} N = (9,33) and we select number 10 is K1, Encryption:{RQ1, RQ2} = {Q, A} 1 = (23,30) and we select number 11 is K1, Encryption:{RQ1, RQ2} = {3, G The request was sent: {N,Y; F,V; X,S; Q,A; 3,G} The request was received: {O,P,E,N,1} Fig. 3. Encryption {N,Y;F,V;X,S;Q,A;3,} and Decryption {O,P,E,N,1} Design and Evaluation of Identity-based Cryptography Algorithm 149 4 Discussion Compared with using IBE method, this method has two steps less. They agree on points of the Elliptic curve and send the keys together between User and Home server. Thus, information of Elliptic curve and the keys will be safer. Compared with using ECC method, this method converts 36 points on Elliptic curve to the alphabet and the 10 digits to make the attackers impossible to guess the encoding rule because 36 points are not fixed, they change depending on the parameters of Elliptic curve. In fact, the existing encryption techniques still meet demands of coding and decoding information as trust of the suppliers. But it is not the most optimal solution, and encryp- tion based on Elliptic curve has proven to be especially excellent for wireless sensor networks in general and Smart-home in particular, given the energy savings benefit. However, it depends on the users’ understandings to choose whether they should use the Home server to manage keys and parameters of Elliptic curve or not. Many users think having a complex password is secure enough. They can set a complicated pass- word without paying attention to the password management system, which only consist of defaut login parameters. The majority of users are not thinking of having additional securities. Also, there are still problems in information channels between Home servers and Smart-home devices (lights, gates, cameras, etc.), that will need to be solved in the future. If hackers succeed in attacking this information channel, they are capable of occupying the devices. In case there is no person in the house, the device will serve the attackers with malicious intent. One possible solution for this situation is to statistically consider and compare between control commands from users and the number of times the device operate. If the information does not match, there are possibilities to believe the system was damaged or hacked. However, this solution needs further research and thorough assessment. References 1. Slamanig, D.: More privacy for cloud users: Privacy-preserving resource usage in the cloud. In: 4th Hot Topics in Privacy Enhancing Technologies, HotPETs (2011) 2. https://en.wikipedia.org/wiki/IDbasedencryption 3. Stallings, W.: Cryptography and network security. Prentice Hall, Boston (2011) 4. Koblitz, N.: Algebraic Aspects of Cryptography. Springer-Verlag, Location (1998) 5. https://www.certicom.com/content/certicom/en/ecc-tutorial.html