## 1 Introduction  
Device-to-Device communication (D2D) is one of the major technologies that 5G will present. It is based on LTE-B, also referred to as LTE REL-12. D2D is a novel and promising technology that allows communication between two or more devices in proximity with no need to go to the leading network. Thus, it will be a relief technology for areas that have very weak or no coverage. It has a high data rate and low latency, and thus it is amenable to low computation devices. IoT devices can communicate with each other and also with other devices such as smartphones. These smartphones can provide connectivity to nearby devices and can work as a small base station. This has led to new concepts such as Device-to-Device (D2D) communication where devices can provide connectivity to nearby devices, allowing higher bandwidth and extended coverage at no cost. As D2D is an integral part of 5G, it inherits the properties of 5G, such as high data rates and low latency. There are two forms of communication, as shown in Figure 1[1]: (a) Inband and (b) Outband. No cost indicates that installation of a new base station is not required and that it can be used between near-proximity devices. D2D is becoming the choice of all network operators as it allows higher bandwidth, more users, increased coverage and high data rates, particularly in sparse environments [2; 3]. D2D comes in two settings: (a) With existing cellular infrastructure also referred as network assisted [4] (b) standalone settings where there is local connectivity in terms of time or geographic interests [4; 5]. D2D offers several data sharing techniques that allow multiple technologies to provide connectivity. Some examples are Relay-By-Smartphone [5] and Data Spotting [6], and FlashlineQ [5] can provide connectivity up to 1 KM [6]. These devices can act as semi relays in a D2D network and can perform channel selection for underlying devices [1]. In D2D, these relays can act as transparent relays (TR) (where they just amplify and forward) or non-transparent relays (NTR) (i.e., decode and forward). A problem arises when one of the NTR become rouge, compromising the whole communication. Rouge Nontransparent relay NTR, as identified by the 3 GPP security workgroup, can compromise credentials and launch user data attacks [7]. Attacks can occur on user privacy and resource availability as well as data integrity, authentication, and confidentiality [8]. Rouge NTR can result in interleaving attacks, one of the most successful types of attack that inflicts damage in cases of both success and failure. If an interleaving attack is successful, it is a Man in the Middle Attack (M-I-T-M). If it is a failure, it is a Denial of Service, aka DoS, attack [9]. Rouge NTR can result in other attacks such as replay attacks and authentication attacks, where an adversary can act as a legitimate user. To address these attacks, a security and authentication scheme is required that can handle M-I-T-M, Replay and Impersonation attacks. These devices have minimal computational and storage power and thus require the security algorithm to be computationally less expensive while exceeding the capabilities of existing algorithms. Stallings [10] required all security algorithms to handle important types of attacks, particularly the denial of service (DOS), eavesdropping, interleaving, masquerading, Man-in-the-Middle (M-I-T-M) Impersonation, Malware attacks, and trust manipulation attacks. Elliptic curve cryptography (ECC) is a public key cryptography technique [11]. It is based on the algebraic structure that uses finite keys. It was firstly proposed in 1985 but has gained importance in current years due to its security strength and key size comparison to other public key security algorithms [12]. ElGamal is a public key cryptography technique proposed by [PERSON] and is based on Deffie Hellman Key Exchange (DHKE). There is a possibility of using ElGamal with ECC, several researches have successfully conducted, and results are promising in terms of security analysis.