## 3 The Proposed Scheme
### Task Allocating Phase  
After receiving the event trigger message, the \(SCC\)'s staff will search for the nearest \(SG\) to the client's house. Then, a task will be allocated to the selected \(SG\) by the \(SCC\)'s staff. Once the \(SG\) receives a task from the \(SCC\)'s staff, the \(SG\) will need to reply to the \(SCC\)'s staff that the job was accepted or rejected. If the job is accepted, the \(SG\) should go to the client's house rapidly and solve the incident scene immediately. The \(SG\) also needs to report to the \(SCC\)'s staff in the task accomplished phase. The flowchart of the allocating task phase is illustrated in Figure 8.  
Step 1. The \(SCC\) searches for an idle \(SG\) automatically by the nearest distance to the client's house and the \(SG\) gets allocated \(ID_{SG}\). Step 2. The \(SCC\) selects a random number \(r_{5}\), and computes the following parameter:  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]  
The allocated \(ID_{SG}\) will be appended to the event message with a timestamp \(T_{8}\):  
\[M_{Event_{3}}=(ID_{IMC}||ID_{IoT}||ID_{Event}||ID_{SCC}||ID_{SG}||T_{8}||Seq_{i}) \tag{33}\]  
The \(SCC\) uses the hash function to compute the parameter \(h_{SCC_{2}}\):  
\[h_{SCC_{3}}=H(R_{SCC_{3}}{}^{r_{5}}\cdot Puk_{SCC}(M_{Event_{3}}+Prk_{SCC}) ||H(M_{Event_{3}})) \tag{34}\]  
The \(SCC\) uses its private key \(Prk_{SCC}\) and \(M_{Event_{3}}\) to compute the signatures as follows:  
\[Sig_{SCC_{5}}=1-r_{5}{}^{-1}\cdot Prk_{SCC}\cdot H(M_{Event_{3}})\text{mod}p \tag{35}\]  
\[Sig_{SCC_{6}}=M_{Event_{3}}+Prk_{SCC}\text{mod}p \tag{36}\]  
Then, the \(SCC\) uses the \(SG\)'s public key \(Puk_{SG}\) to encrypt the message into a ciphertext \(C_{SCC_{2}}\):  
\[C_{SCC_{2}}=E_{Puk_{SG}}(T_{8}||R_{SCC_{3}}||h_{SCC_{3}}||Sig_{SCC_{5}}||Sig_{ SCC_{6}}||M_{Event_{3}}||H(M_{Event_{3}})) \tag{37}\]  
Then, the \(SCC\) sends and chains \((R_{SCC_{3}},h_{SCC_{3}},Sig_{SCC_{5}},Sig_{SCC_{6}},M_{Event_{3}})\) to the \(BCC\). Meanwhile, the \(SCC\) sends the cipher message to the allocated \(SG\). Step 3. Once the \(SG\) receives the \(SCC\)'s \(ID\), the \(IMC\)'s \(ID\), the \(SG\)'s \(ID\), and cipher message \(C_{SCC_{2}}\) at \(T_{9}\), the \(SG\) uses the private key \(Prk_{SG}\) to decrypt the message:  
\[(T_{8}||R_{SCC_{3}}||h_{SCC_{3}}||Sig_{SCC_{5}}||Sig_{SCC_{6}}||M_{Event_{3}} ||H(M_{Event_{3}}))=D_{Prk_{SG}}(C_{SCC_{2}}) \tag{38}\]  
Then, the \(SG\) checks the validity of the timestamp:  
\[(T_{9}-T_{8})\overset{?}{\leq}\tau \tag{39}\]  
If the timestamp interval is valid, then the \(SG\) needs to verify the \(SCC\)'s hash parameter:  
\[h_{SCC_{2}}\overset{?}{=}H(R_{SCC_{3}}{}^{Sig_{SCC_{5}}}\cdot Puk_{SCC}{}^{ H(M_{Event_{3}})+Sig_{SCC_{6}}}||H(M_{Event_{3}})) \tag{40}\]If Equation (40) holds, then the \(SG\) needs to reply to the \(SCC\) that they are accepting the task. If the \(SG\) does not accept the task, then they reply no, and otherwise reply yes. The \(SG\) selects a random number \(r_{6}\), and computes the following parameter:  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]0  
A timestamp \(T_{10}\) is appended to the event message:  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]1  
\(SG\) uses the hash function to compute the parameter \(h_{SG_{1}}\):  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]2  
\(SG\) uses the private key \({Prk_{SG}}\) and \({M_{Event_{4}}}\) to compute the signatures as follows:  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]3  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]4  
Then the \(SG\) uses the \(SCC\)'s public key \({Puk_{SCC}}\) to encrypt the message into cipher message \({C_{SG_{1}}}\):  
\[R_{SCC_{3}}=g^{r_{5}}\text{mod}p \tag{32}\]5  
Then, the \(SG\) responds to the cipher message to the SCC. In the message includes \(Y/N\), \"\(Y\)\" means to accept the task, and \"\(N\)\" means to reject the task. If the \(SG\) accepts the task, then the \(SG\) must go to the incident scene immediately and solve the security problem. Step 4.