# Vehicular Alarm System Using mHealth Data and Lightweight Security Algorithms
## Security Algorithms with Lightweight Security
### Algorithm Development for the Authentication Procedure  
The RSA algorithm employs a key pair consisting of a public key and a private key to generate the asymmetric keys for the authentication process that was described in Section 5.3. All messages will be encrypted using the public key and all encrypted messages will be decrypted using the associated private key. The algorithms will use the java security, _java.security_. Additional functions such as _java.security.Key_, _java.security.KeyPair_, _java.security.KeyPairGenerator_, and _java.security.Security_ contain the methods to generate keys and key pairs (Algorithm 1), to encrypt (Algorithm 2), and to decrypt the data by the generated key pair (Algorithm 3). ```
functiongenerateKeyPair() //The following sets the RSA KeyPairGenerator instance. It initializes with a bit size of 256 bits. SecureRandom random = new SecureRandom( )  KeyPairGenerator generator = KeyPairGenerator.getInstance(\"RSA\")  KeyPair pair = generator. generateKeyPair( ) generator.initialize(256, random)  return pair endfunction
```  
**Algorithm 2**. Encrypt message  
```
functionencryptMessage(KeyPair


```
functiondecryptMessage(KeyprivKey,byte[]demessage) //Itdecryptstheciphertextandreturnstheoriginalmessage  CipherdeCipher=Cipher.getInstance(\"RSA\")  deCipher.init(Cipher.DECRYPT_MODE,privKey)  byte[]originalMessage=cipher.doFinal(demessage)  returnnewString(originalMessage) endfunction
```
**Algorithm 3** Decrypt message

The public-private key pair is also used to generate and verify the digital signature (Algorithm 4). The data is signed by using the private key, which can be verified by the public key for data integrity and authenticity. _java.security.Signature_ contains the methods to sign the data and verify the signature of the received data. ```
functionverifySignature(byte[]dataText,KeypubKey,byte[]signature) //thefollowingverifiesthedigital certificatebyusingRSAandreturnsatrueorfalseresult  Signaturesig=Signature.getInstance(\"SHA256 withRSA\");  sig.initVerify(pubKey);  sig.update(dataText);  booleanresult=sig.verify(signature);  returnresult endfunction
```

**Algorithm 4** Verify digital certificate

Figure 9 illustrates the process of authentication for a specific secondary node with unique identity of \(SUli\) in \(m\) numbers of SUs in the mHealth network. ## 6 Simulation Results

The proposed scheme was simulated using a network simulator (ns-2). Two networks (primary network and secondary network) were set up in the mHealth network to transmit a short message. Figure 9: Authentication process. The first test involved transmitting the message without any authentication process, while the second test involved transmitting the same message using an authentication process. The message was transmitted between two entities in the mHealth network known as PUBS and SUBS. Trust value was not considered to reduce complexity. The snapshots of the ns-2 environment in Figure 10 presents the required time against the packet size of the transmitted message without an authentication process and with the authentication process from SUBS to PUBS in the mHealth network. It is observed that message transmission with authentication requires a longer duration of time in comparison to transmitting without the authentication process. However, it is more secure. Therefore, it increases the difficulty for adversaries to obtain the private key from a known public key and to slow down the network performance. ## 7 Conclusions

This paper contributed an idea of an integrated mHealth and VIS to predict and notify alarms for long-distance drivers based on real-time parameters of the driver's health condition as well as the road circumstances. We proposed a trust-based security framework to sense and securely transmit the driver's health data as well as change vehicular and road conditions via a centralized monitoring center using a novel integration model.