Identity-based and anonymous key agreement protocol for fog computing resistant in the Canetti–Krawczyk security model

Fog computing allows to connect the edge of the network, consisting of low cost Internet of Things devices, with high end cloud servers. Fog devices can perform data processing, which can significantly reduce the delay for the application. Moreover, data aggregation can be carried out by fog devices which decrease the bandwidth needed being very important for the wireless part of the communication with the cloud servers. The edge-fog-cloud architecture is currently being rolled out for several applications in the field of connected cars, health care monitoring, etc. In this paper, we propose an identity-based, mutual authenticated key agreement protocol for this fog architecture, in which end device and fog are able to establish a secure communication without leakage of their identities. Only the cloud server is able to control the identities of device and fog. We formally prove that the session keys are also protected in the Canetti–Krawczyk security model, in which adversaries are considered to have access to session state specific information, previous session keys, or long-term private keys. The scheme is very efficient as it only utilises elliptic curve operations and basic symmetric key operations.


Introduction
Fog computing extends the traditional cloud computing features, such as for instance computation, communication, controlling, and storage, to the edge of the network. To this end, a so called fog layer is placed between the end devices and the cloud. The fog layer typically consists of gateways, base stations, routers, etc. Fog devices can be either fixed (e.g. at train terminals, libraries, etc) or mobile if they are put on a moving object. Compared to a cloud server, the fog devices are much closer to the end devices, leading to low bandwidth costs and low energy consumption. Therefore, fog computation enhances the performance of applications which require low latency [1]. A popular application is in the domain of vehicular networks, which is the essential building block to realise intelligent transport systems [2]. In [3], the so called vehicular fog computing (VFC) paradigm is presented. Instead of using the existing solutions such as cellular networks and roadside units, the authors propose to utilise vehicles as infrastructure nodes for communication and computation, enabling aggregation of resources of individual vehicles in order to increase the quality of services and applications. Another popular application domain is in the health sector, where a large number of embedded and wearable devices, monitoring user's health, are used to derive a diagnosis or treatment. These devices are connected to a nearby fog, where the data is further processed, stored and forwarded [4]. In both use cases anonymity of the device to the fog is a very important feature to guarantee privacy. Authors in [5] analyzed privacy issues during data collection, aggregation and mining in fog devices. To guarantee privacy of identity information during data aggregation, they propose to use an anonymous mechanism based on k-anonymity and traffic detection techniques. Differential privacy when using machine learning for data processing is achieved adding Laplacian random noise to the output. In [6], the problem of false data injection from compromised IoT devices has been studied. The injection of fake data makes the aggregation results useless with the consequence of considerable waste of network resources in the fog device. The authors propose a hierarchical Bayesian space-time model to predict future sensor data and detect false aggregated data. A strategy based on anti-honeypot attacks in forensics analysis module is proposed in [7] to counteract Distributed Denial of Service (DDoS) attacks. These detection and forensics modules could be included in fog devices and cloud servers to enhance their security features. A recently proposed authentication scheme [8] includes device anonymity by establishing a common shared key between end device, fog and cloud server, where only the cloud server is aware of the identity of the device and responsible for the access control. Schemes in literature where a common key is shared among three users are also called tripartite schemes. As mentioned in [8], there are only a limited number of schemes that fit to this fog architecture, especially when privacy is required. This follows from the fact that in most of the tripartite schemes, the device in the middle is performing the first validity check on the identity. In the case of the fog architecture, the fog represents the device in the middle and thus when privacy is required, these schemes cannot be applied. Besides privacy, the protection against the Canetti-Krawczyk (CK) adversary model is another important security feature that is gaining more and more interest from the scientific community [9,10]. The CK adversary model was designed to analyze key exchange protocols and the adequacy of the generated session keys. A key exchange protocol is considered secure if, under the allowed adversary actions, the attacker cannot distinguish the value of the key generated by the protocol from a random number. A scheme is said to offer protection of the session keys in the CK security model [11], if it is resistant against an adversary who is able to reveal session state specific information, previously used session keys, or long-term private keys. For instance, it can be caused by bad implementation of the pseudo random number generator [12][13][14] or by real leakage attacks exploiting power consumption patterns or timing side channels. Moreover, as the operations are running on end devices and fog devices, which are present in publicly available environments and often vulnerable to active attacks, this is a relevant assumption [10]. In the context of secure identity-based tripartite schemes, the CK security model is recently introduced in the scheme of [15], which is designed for mobile distributed computing environments. In this setting, the end device first communicates to the authentication server, which provides the access control and further forwards it to the application server. Consequently, there is no anonymity provided in the scheme. To the best of our knowledge, an identity-based tripartite scheme, that offers at the same time anonymity and protection against a CK adversary do not yet exist. Due to the importance of privacy in current society and the presence of very strong cyber attack threats, it is very important to combine both features. Therefore, we will present in this paper a scheme solving this issue. The scheme will be proposed as an application in the context of a fog architecture. Applying minimal changes, the proposed scheme can be easily transformed to a solution viable for mobile distributed computing environments, comparable to the one in [15]. What is more, our proposed scheme does not need computationally-intensive pairing operations like [8,15]. Instead, it utilises only elliptic curve multiplications and additions, hash functions, and symmetric cryptographic operations. Thanks to the construction of the key material, it also becomes possible to construct pairwise secure keys among each of the two involved parties without additional communication. In particular, a common secret key between the end device and the fog device enables protection against an honest but curious cloud server. Similarly, a common secret key between the end device and the central server ensures protection against an honest and curious fog device. In the setting of an honest and curious entity, we assume that this entity is honest in the sense that it will execute all the required actions, but it might be curious and collect the data for other purposes like for instance selling to third parties. The scenario of an honest and curious central server is often considered in smart grid communication [16]. To summarize, the contributions of the paper are the following.
-We present the first identity-based and anonymous key agreement protocol, applicable in a fog computing setting, which offers session key protection in the Canetti-Krawczyk security model. -We provide a formal proof in the random oracle model to show the security strength of the scheme. -We compare the efficiency of the scheme with other related tripartite schemes in literature estimating the type and number of operations that the corresponding security algorithms need to perform.
The paper is organised as follows. First, we give an overview of the related work and we deal with preliminaries. Second, the proposed scheme is described and a formal proof of the security in the CK model is given, together with an analysis of several attacks. Then, we analyse the computational complexity and the communication cost of the security algorithm and we conclude the paper.

Related work
Many mutual identity-based authentication schemes have been proposed in literature. The main focus has been on client server-based authentication in which the client represents the end device that is more resource-restricted than the server. When the client device requires user interaction, many 2-factor and 3-factor authentication schemes exist in literature. An example of a scheme offering mutual authentication with anonymity and untraceability using solely symmetric key-based operations can be found in [17]. Also, the consideration of an honest but curious Trusted Third Party (TTP) has been taken into account in [18,19]. In [18], the public key operations are based on the elliptic curve theory, whereas in [19] chaos-based operations are used. For client server authentication schemes with a client representing an autonomous device, there are only a limited number of mutual identity-based authentication schemes [9,10,[20][21][22]. These schemes differ in several points. For instance, regarding the proposed architecture, in [21,22], an active TTP is required during the key agreement phase, which is not the case in the other proposals. Only a limited number of these schemes allow the anonymity of the client [9,10,20] and even less schemes are resistant in the CK security model [9,10]. Moreover, this additional security restriction has only been recently introduced. In the context of the so-called tripartite schemes, where three entities need to agree on a common key, we can also distinguish several identity-based mutual authentication schemes. Some of the schemes are based on symmetric key mechanisms, using a pre-shared common key [23][24][25][26]. In particular, [23,24] study the minimum amount of communication rounds and messages needed to establish mutual authentication among three different parties, taking into account different assumptions. The disadvantage in these schemes is that the session key is only constructed by the authentication server and the other two entities do not participate in its construction, making these schemes vulnerable for key control resilience attacks [27]. In order to establish anonymity, as noticed in [28], public key-based operations need to be used. In [8], an example of a key agreement scheme for a fog-driven healthcare application is proposed in which anonymity of the end device is obtained. The scheme is an improvement of [29] in which the derived key was static and thus not able to establish past forward security. However, we see several shortcomings in [8]. First, the scheme is limited to devices possessing a smart card-based entry and the registration phase requires the presence of a secure channel between the user and the trusted cloud service provider. Second, CK security for the session keys has not been considered. Third, the scheme is not offering protection against an honest but curious central server. Finally, computationallyintensive pairing operations are involved in the scheme. On the other hand, in [15], a secure identity-based tripartite scheme resistant in the CK security model is given, which is designed for mobile distributed computing environments. However, this scheme does not provide anonymity to outsiders and also consists of a pairing operation at device side. In addition, it is also not able to compute pairwise keys using the available key material at the end of the protocol.

Preliminaries
We first provide some background on Elliptic Curve Cryptography (ECC). Next, the CK security model is further elaborated. We also describe in detail the Elliptic Curve Qu-Vanstone (ECQV) certificate scheme as it is an important building block in the registration phase of our proposed scheme.

Elliptic curve cryptography
Elliptic Curve Cryptography (ECC) [30] offers lightweight public key cryptography (PKC) solutions. For instance, corresponding with an 80-bit security parameter, a field size of 160 bits for ECC is sufficient, whereas RSA-based solutions require 1024 bits. ECC is based on the algebraic structure of elliptic curves (ECs) over finite fields. The curve in the finite field F p is denoted by E pða;bÞ , whereas the base point generator of prime order q is denoted by G. All points on E pða;bÞ , together with the infinite point form an additive group. In [31,32] standardised curve parameters are described. The product R ¼ rG ¼ ðR x ; R y Þ with r 2 F q and R x ; R y 2 F p results in a point of the EC and represents an EC multiplication. When we send an EC point, it suffices to send its x coordinate, together with one sign bit, cf. the SEC1-based encoding [33]. The scheme relies on two computational hard problems.
-The Elliptic Curve Discrete Logarithm Problem (ECDLP). This problem states that given two points R and Q of an additive group N, generated by an elliptic curve (EC) of order q, it is computationally hard for any polynomial-time bounded algorithm to determine a parameter x 2 Z Ã q , such that Q ¼ xR.

-The Elliptic Curve Diffie Hellman Problem (ECDHP).
Given two points R ¼ xG, Q ¼ yG of an additive group N, generated by an EC of order q with two unknown parameters x; y 2 Z Ã q , it is computationally hard for any polynomial-time bounded algorithm to determine the EC point xyG.

Threat model
We consider as in [9] the CK-adversary model, as proposed in [11]. In this security model, the adversary can not only eavesdrop on the channel or actively manipulate (insert, change, reply) the transmitted messages, but can also reveal session state-specific information, session keys, or long-term private keys. The session state-specific information is defined as the local state of the session and its subroutines, excluding the ones where direct access to the long term secret information is performed.

Elliptic curve Qu-Vanstone certificates
The Elliptic Curve Qu-Vanstone (ECQV) certificate scheme [34,35] is a very efficient mechanism to construct a key pair (private and public keys) together with a certificate for an entity in the scheme without the need of a secure channel between the TTP and the entity to share material for the generation of its secret private key. Consequently, the TTP is also not able to derive the private key of the entity and so there are no key escrow problems. Its security has been formally proven in [36]. The ECQV scheme, which is shown in Fig. 1, works as follows for an entity A requesting the generation of its secret key pair and corresponding certificate with the TTP. Consider the curve E pða;bÞ in Z p with generator point G of order q. Denote the private and public key of the TTP by ðk; P TTP Þ with P TTP ¼ kG. Define the hash function H 0 : f0; 1g Ã ! Z Ã p and the concatenation operation between two parameters p 1 and p 2 as p 1 kp 2 . First the entity A with identity ID A chooses a random value r A 2 Z Ã p and computes R A ¼ r A G. The message ID A , R A is sent to the TTP. Here, the TTP also selects a random value r T 2 R Z Ã p and computes R T ¼ r T G. Next, it computes The values ðcert A ; rÞ are sent to A over a public channel. Using these values, A now computes its private key It accepts the registration if its public key P A ¼ d A G satisfies the following equality Consequently, given ID A , cert A and, of course, the public key of the TTP denoted P TTP , any other entity is able to construct the corresponding public key of A by means of Eq. 1. Thanks to the certificate, the other entity is assured of the relation between identity and public key.

Proposed solution
The proposed scheme consists of three main phases, which allow the construction of a common shared key between all the entities. Besides this key, each entity has security material in common with just another entity of the system that can be used to build a secure channel between these entities.

Setup phase
In this phase, the TTP selects the EC E pða;bÞ in Z p with generator point G of order q. It determines seven hash functions Fig. 1 The ECQV registration phase Also, a symmetric key encryption algorithm is chosen to encrypt a message M into the ciphertext C using the to-be-settled secret shared key SK, C ¼ E SK ðMÞ, together with the corresponding decryption algorithm, M ¼ D SK ðCÞ. A random value k is set as the private key of the TTP. The corresponding public key P TTP is computed by P TTP ¼ kG. This public key P TTP , together with the public parameters fE pða;bÞ , G, H 0 ,

Registration phase
The registration phase for sensor devices (SD), fog devices (FD) and central servers (CS) are similar and follow the ECQV certificate scheme, as explained above. As a result, each entity U is storing the public parameters {E pða;bÞ , G, H 0 , H 1 , H 2 , H 3 , H 4 , H 5 , H 6 , E SK ðÞ, D SK ðÞ, P TTP }, its public key P u , certificate cert u and identity ID u , together with its private key d u . Note that only the private key needs to be stored in the tamper-resistant part of the memory. As in the other papers ( [8,15]), we assume that the SD and FD have stored the public key P c of the CS. If not, they need to request the identity and certificate of the CS to compute the corresponding public key, cf. Eq. 1, before the key agreement phase.

Key agreement phase
In the key agreement phase, the actual symmetric secret key SK shared between SD, FD, and CS is established. We denote the SD by the entity with identity ID s , key pair ðd s ; P s Þ and certificate cert s . Similar, the FD is denoted by the entity with identity ID f , key pair ðd f ; P f Þ and certificate cert f . Finally, the CS has identity ID c , key pair ðd c ; P c Þ and certificate cert c . There are four communication passes in the scheme, leading to five different steps. The main interaction between the SD and FD is shown in Fig. 2. In this figure we also describe the function of each computed parameter.
(1) Sensor device initialization: The SD first chooses a random variable r 1 and computes R 1 ¼ ðr 1 þ d s ÞG.
Next, it computes a common key K 1 ¼ H 4 ððr 1 þ d s ÞP c Þ with the C in order to derive the ciphertext represents a masked version of the public key of the SD for anonymity reasons. Finally, the hash value A 1 ¼ H 1 ðR 1 kC 1 kQ 1 Þ is computed. The message M 1 ¼ fR 1 ; C 1 ; Q 1 ; A 1 g is sent to the FD.
(2) Fog device to central server: Upon arrival of M 1 , the hash value A 1 is checked to ensure the message integrity. If positive, the process continues. The following steps are similar as with the SD. A new random value r 2 is derived in order to compute with the CS, and the ciphertext C 2 ¼ E K 2 ðID f kcert f kH 2 4 ðP 12 ÞÞ. The point P 12 is computed using h 11 ¼ H 5 ðR 1 kQ 1 kR 2 kQ 2 Þ, h 12 ¼ H 5 ðR 2 kQ 2 kR 1 kQ 1 Þ and equals to P 12 ¼ ðr 2 þ d f þ h 11 ðr 2 þ d f Þd f ÞðR 1 þ h 12 Q 1 Þ. Note that we send H 2 4 ðP 12 Þ ¼ H 4 ðH 4 ðP 12 ÞÞ in C 2 as H 4 ðP 12 Þ corresponds with a unique shared key between FD and SD. Finally, the hash value A 2 ¼ H 2 ðR 1 kC 1 kR 2 kC 2 Þ is computed and the message M 2 ¼ fR 1 ; C 1 ; R 2 ; C 2 ; A 2 g is sent to the CS.
(3) Central server to fog device: First the hash value A 2 is checked in order to guarantee the integrity of the message M 2 . Next, the keys Þ are derived in order to decrypt C 1 , C 2 and to derive the required information to find the public keys P s , P f of the SD and the FD respectively using the ECQV mechanism. In addition, H 2 4 ðP 12 Þ is found, which will be later used for the construction of the session key SK. Next, a new random value r 3 is derived to compute The described steps are represented in Fig. 3, where the reader can find all the details of the proposed key agreement algorithm.

Security analysis
First, we provide a formal proof of the security strength of our protocol. Then, we analyze some of the most used attacks and show that our key agreement scheme offers protection against such attacks.

Formal proof of security
We now show that our key agreement scheme is secure under the CK adversary model [11] in the random oracle model, following the method of [9,37]. We focus on the actual key agreement and not on the registration phase, as we consider the TTP to be honest but curious entity. Note that this assumption is strong enough since the TTP is not able to derive the secret keys due to the usage of the ECQV security mechanism. The participants U in our scheme are the SD, FD, CS and a random oracle O, i.e. U ¼ fSD; FD; CS; Og. Taking into account the CK adversary model, we assume that the attacker can run the following queries.
-Hash queries H i ðmÞ with i 2 f0; 1; 2; 3; 4; 5; 6g. If m already exists in the list L H i , the value H i ðmÞ will be returned. Otherwise, a random value will be generated, added to the list L H i , and returned. -Send queries. These queries simulate active attacks, in which the adversary is able to modify the transmitted messages. The random oracle O, which simulates a device of the system, replies to the attacker with the corresponding message of the key agreement protocol. Since there are four communication passes, five different send queries need to be defined.
-Send(START,SD). Upon receiving this query, the random oracle chooses a random variable r 1 and computes Then, Q 1 ¼ H 4 ððr 1 þ d s ÞP s Þ is computed. Finally, the hash value A 1 ¼ H 1 ðR 1 kC 1 kQ 1 Þ is found. The output message M 1 ¼ fR 1 ; C 1 ; Q 1 ; A 1 g is sent to the adversary. ðR 1 þ h 12 Q 1 Þ. Next, using K 2 , the ciphertext C 2 ¼ E K 2 ðID f kcert f kH 2 4 ðP 12 ÞÞ is constructed. Finally, the random oracle computes the hash value A 2 ¼ H 2 ðR 1 kC 1 kR 2 kC 2 Þ and the message M 2 ¼ fR 1 ; C 1 ; R 2 ; C 2 ; A 2 g is the output of the query, which is received by the adversary. -Send ðM 2 ; CSÞ. First, A 2 is checked and if positive Þ are constructed in order to decrypt C 1 , C 2 and to derive ID s kcert s and ID f kcert f kH 2 4 ðP 12 Þ respectively. Second, P s ¼ H 0 ðID s k cert s Þcert s þ P TTP and P f ¼ H 0 ðID f kcert f Þ cert f þ P TTP are found. Third, a random value r 3 is chosen to compute -Execute queries. These queries simulate the passive attacks, in which the adversary can only eavesdrop onto the channel and is able to collect the transmitted messages. We can distinguish four different execute queries resulting from the first four send queries defined above, where a message has been transmitted over the public channel. -Session specific state reveal queries (SSReveal).
According to the CK adversary model, the attacker is able to retrieve session specific state information, derived by the SD, FD and CS respectively. Note that no values in which long term private keys are involved, can be revealed in this query.
-SSReveal(SD). The output of this query results in r 1 , . The output of this query results in . The output of this query results in -Corrupt queries. These queries give the private key of the entity as result. Note that only Corrupt(SD), Corrupt(FD) and Corrupt(CS) exist and no corrupt queries with regards to the TTP. They are included to prove the perfect forward security of the scheme. -Session key reveal query (SKReveal). In this query, the established symmetric SK between SD, FD, CS is returned in case it has been successfully generated. -Test query. In this query, the random oracle returns to the adversary either the established SK or a random value having the same length, dependent on the output c ¼ 1 or c ¼ 0 respectively of a flipped coin c. The adversary can use this query only once. Note that the test query cannot be issued when SKReveal or corrupt queries have been executed.
In order to prove the semantic security of the scheme, we consider the following two definitions.
-The SD, FD and CS are partners if they are able to successfully derive an authenticated common shared key SK. The common shared key SK cannot be computed by other entities. -The established shared secret key is said to be fresh if the SK has been established without exposure to SKReveal queries by the adversary or Corrupt queries of SD, FD and CS.
The final goal of the adversary A is to distinguish the difference between a real secret session key or a random value, i.e., to predict successfully the output of the test query. If Pr(succ) denotes the probability that the adversary succeeds in its mission, the advantage of the adversary in breaking the semantic security of the proposed scheme equals to AdvðAÞ ¼ j2Pr½succ À 1j. Consequently, our scheme offers semantic security under the CK adversary and random oracle model if the advantage for A winning the game satisfies AdvðAÞ , for any sufficiently small ! 0. The difference lemma [38] is used to prove the statement.
Lemma 1 (Difference Lemma) Let E 1 ; E 2 be the events of winning game 1 and game 2. Denote an error event by E, such that E 1 j:E occurs if and only if E 2 j:E. Then, jPr½E 1 À Pr½E 2 j Pr½E.
Theorem 1 Let A be a polynomial time adversary against the semantic security, which makes a maximum of q s Send queries, q e Execute queries and q h Hash queries. The advantage of A is bounded by AdvðAÞ Oðq s þq e Þ 2 2q þ Oðq h Þ 2 2q þ Oðq s Þ 2 2 l þ Oðq h TÞ, with T the time to solve the ECDH problem.
Proof We proof the theorem by means of game hopping [38]. An attacker's success probability only increases by a negligible amount when moving between the games, as a consequence of Lemma 1. There are five games fGM 0 ; GM 1 ; GM 2 ; GM 3 ; GM 4 g to be defined. Denote by succ i the event that A wins the game GM i , with 0 i 4.
-Game GM 0 . This is the real game, as defined in the semantic security framework. From the definition, we have that -Game GM 1 . In this game, the oracles for the different queries are simulated and the resulting outputs of the queries are stored in the lists. In the random oracle model, it holds that -Game GM 2 . In GM 2 , all oracles are simulated, avoiding collisions in the output of the hash functions and the selection of random values r 1 , r 2 , r 3 among the different sessions. The probabilities of collisions between the outputs of the hash functions (E 1 ) and between the random values (E 2 ) are respectively Consequently, due to the difference lemma, it holds that -Game GM 3 . In this game, the adversary A is able to find the hash value A 3 without input of the random oracle Send queries. In this case, the scheme is simply stopped. Consequently, GM 2 and GM 3 are indistinguishable, except when FD or SD rejects A 3 . Thus, following the Difference Lemma, it holds that -Game GM 4 . In this game, we consider the CK adversary model and assume that either the session state variables or the long term secret variables are revealed at each of the involved participants. The goal of the adversary is to find the SK by performing Execute and Hash queries, with eight possible combinations of SSReveal and Corrupt queries. The session key is constructed by means of three EC points, P 12 , P 13 , P 23 . Due to the definition of these points, P ij (with i 6 ¼ j and i; j 2 f1; 2; 3g) can only be constructed by means of the knowledge of both the session information (random variable) and the private key of the involved entity i as both are independently involved in the definition. The knowledge of both these secrets is in contradiction with the CK security model. Only in the case of a Corrupt(CS) query, the key K 2 can be revealed and thus also H 2 4 ðP 12 Þ. As this is only a part of the SK, it is still insufficient to reveal the complete SK as P 13 , P 23 can still not be revealed with only the knowledge of d c . Moreover, in the same setting, an impersonation attack on SD or FD is not possible, due to the usage of ECQV certificates. Consequently, the difference between GM 2 and GM 3 is negligible as long as the probabilities to solve the ECDH problem and to perform a successful hash query are small. Denote T as the time to solve the ECDH problem, then Consequently, applying Lemma 1 on the games GM 0 , GM 1 , GM 2 , GM 3 and GM 4 , taking into account equations 2,3,5,6, results in the final proof of the theorem.

Attack analysis
We demonstrate that our authenticated key agreement protocol is secure against several attacks which can endanger the privacy of users and the confidentiality of the exchanged data.
-User anonymity and untraceability An adversary, which can be a malicious sensor device or fog device, cannot retrieve the identities of the other devices in the system even if it intercepts all the messages that are exchanged during the key agreement phase. Indeed, the identities are encrypted with the keys K 1 , K 2 and only the central server is able to compute them using its private key d c . Moreover, these keys change at each session because they depend on the random numbers r 1 , r 2 , r 3 . -Perfect forward privacy Even if the attacker is able to steal the long term private keys of the entities of the system, the previously generated common secret keys are not compromised. Indeed, the generation of these session keys also require the random values r 1 , r 2 , r 3 which change at each session. -Man-in-the-middle attack In this type of attack, the attacker is able to intercept and forge the four exchanged messages in the key exchange protocol. The resistance against this attack follows from the ECQV certificate scheme used in the registration phase. Indeed, the certificate of each entity is created by using the secret random numbers of both entity and TTP. Moreover, the private key of the TTP is used for the construction of the entity's private key. Therefore, the attacker will not be able to compute the private key correspondent to the entity's public key computed by the central server in step 19 of the key agreement phase. Consequently, the attacker cannot compute the same secret key SK calculated by the central server. -Session key leakage. The session secrets are generated using both the random numbers and the private keys, hence they change at each session. The leakage of one session key does not compromise the security of the other session keys. -Key-compromised impersonation attack. In this scenario, the attacker corrupts the private key of the sensor device to impersonate the central server and to cheat the sensor device and fog device. Although the attacker can compute the sensor device's public key, it is still not able to derive H 2 4 ðP 12 Þ because it needs the central server's private key to decrypt the cipher text C 2 . Therefore, the attacker will not be able to compute the common secret SK.
-Key control attack In the proposed scheme, the common secret SK is computed by using all entities' private keys and random numbers. Consequently, if the attacker corrupts one of the entities, it will still not be able to determine the SK.

Performance analysis
The performance analysis is split into the computation and communication costs. We compare our scheme with the schemes of [8,15]. Recall that the scheme of [8] does not offer session key security in the CK security model and the scheme of [15] does not provide entity anonymity.

Computation costs
The computation costs are measured by counting the number of most computationally-intensive operations and taking their corresponding computational time into account. We denote the timing for the bilinear pairing as T b , the point multiplication T mp , point addition T ap , a symmetric encryption/decryption T s , a map to point T H and hash operation T h . To measure the timings of these operations for the fog device and the central server, we refer to [16]. The authors used a personal computer with a 2.5 GHz CPU and an 8 GB RAM, running Windows 7 for an 80-bit security level. This corresponds to a hash function resulting in a 160 bit output and an EC of order 160, i.e. q ¼ 160.
According to the NIST reccomendations, an EC of order 256 should be chosen resulting to 128-bit security level. However, we decided to maintain 80-bit security level to perform a fair comparison with [8,15]. These timings, expressed in microseconds (ls) result in T b  [39]. Therefore, the RE-mote cannot be used in [8,15] to act as a sensor device. These security schemes need a more powerful device. The computed timings for the Zolertia RE-mote expressed in milliseconds (ms) are T mp ¼ 342:39, T ap ¼ 5:25, T s ¼ 0:12, T h ¼ 0:03. In Table 1, the number of most computationally-intensive operations and the corresponding timing according to the above defined measurements have been determined for our scheme and the schemes of [8,15]. As can be concluded from this table, our scheme considerably outperforms the other schemes for all three entities involved. This follows from the fact that our scheme does not involve the computationally-intensive pairing operations.

Communication costs
For the communication costs, we determine the number of transmitted bits in each of the four messages sent between the different entities of the scheme. Note that we consider, similar to the other schemes in the literature, the 80-bit security level. This corresponds with hash functions giving outputs of length 160 bit, an EC with generator of order 160, and a pairing operation e : G 1 Â G 1 ! G 2 with jG 1 j ¼ 512, jG 2 j ¼ 160. For the symmetric key encryption, we consider the 128-bit and 192-bit AES variants. In addition, we assume that the length of identities and timestamps equals 32 bits. The Zolertia RE-mote, which acts as SD, runs the Contiki 3.0 operating system. To communicate with the FD, we use the default Contiki protocol stack that consists of IEEE 802.15.4 standard [40] for the physical layer, ContikiMAC as Radio Duty Cycle (RDC) protocol and the Carrier-Sense Multiple Access (CSMA) protocol as Medium Access Control (MAC) protocol. Since the maximum packet size defined by this standard is 127 bytes, considering the protocol headers, we only need two fragments for messages M 1 and M 4 during the key agreement phase. As can be concluded from Table 2, our scheme requires the smallest number of bits to be sent over the channel among the schemes consisting of 3 passes. More specifically, for the message M 1 sent by the most constrained device, our scheme is approximately 20% faster than [8] and 70% faster than [15].

Conclusions
In this paper, we proposed an identity-based mutual authentication scheme to be applied in a fog architecture. The innovation of the paper is that we add to this type of scheme two very important features: the protection of session key security in the CK model and the anonymity of the sensor device with respect to the fog device and outsiders. Only the central server is responsible for the control of the identities of the sensor device and fog device. As an interesting side effect, after the execution of the scheme, every participating entity pair also possesses a unique common secret shared key. In particular, the shared key between the sensor device and the fog device enables the communication between both, which cannot be traced by the central server. It is also important to mention that no pairing operations are used in the scheme, leading to very low computation and communication overhead.
Note that in [15], the fog device and the central server are replaced by an authentication server and an application server, respectively. The time costs are measured on a personal computer with a 2.  creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.