# A Secure Blockchain-Based Authentication and Key Agreement Scheme for 3 GPP 5G Networks
## 4 The Proposed 5 GSBA Scheme
### Details of the 5 GSBA  
This section presents the Secure Blockchain-based Authentication and Key Agreement Protocol (5 GSBA) in detail, which is a two-step protocol designed to mutually authenticate between UEs and gNBs in the 5G network. To satisfy all aforementioned security requirements, the 5 GSBA combines the one-time hash function, Elliptic Curve Diffie-Hellman (ECDH), the Elliptic Curve Integrated Encryption Scheme (ECIES), and the keyed-hash message authentication code (HMAC) at different steps of the protocol. The 5 GSBA uses a private blockchain network across all gNBs as a distributed subscriber data repository. Therefore, all gNBs connected to the 5 GC may approve authentication requests from UE autonomously without taxing the AUSF and UDM. The 5 GSBA has four phases: the system initialization phase, the USIM registration phase, the gNB broadcast phase, and the mutual authentication phase. All notations used in this paper are listed in Table 3, and Figure 2 shows a sequence diagram explaining different phases in 5 GSBA. \begin{table}
\begin{tabular}{c c} \hline \hline
**Notation** & **Description** \\ \hline SUPI & Subscription Permanent Identifier of the UE \\ \hline ID\({}_{\text{gNB}}\) & Permanent Identifier of gNB \\ \hline P & Generator of the Elliptic Curve \\ \hline Y/Y\({}_{2}\) & One-Time Hash Secret \\ \hline H (msg) & Cryptographic Hash Function \\ \hline HMAC (msg, K) & Keyed-hash Message Authentication Code \\ \hline \(\sigma\) & Generated HMAC code \\ \hline PK\({}_{\text{core}}\) & Public Key of 5G Core \\ \hline SK\({}_{\text{core}}\) & Private Key of 5G Core \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Notations. **Phase 1--System Initialization:** Let \(p\) be the modulus, \(E\big{(}\mathbb{F}_{p}\big{)}\) be the elliptic curve over a finite field \(\mathbb{F}_{p}\), \(P\) be the generator point on \(E\big{(}\mathbb{F}_{p}\big{)}\) with an order \(n\), and \(\mathbb{G}\) be the generated subgroup which multiplies the generator point \(P\). Additionally, we let the cryptographic hash function be \(H\subseteq\mathbb{Z}_{n}^{*}\). Having the assumptions above, gNBs and AUSF run the following procedures:  
1. AUSF generates a new ECIES private key \(SK_{core}\) representing the 5 GC by choosing a random input \(k\). Then, the ECIES public key \(PK_{core}=k\cdot P\) is stored at UDM. 2. When there is a new gNB joining the 5 GC, they should mutually authenticate with any existing approach such as IPSec tunnels. After that, AUSF installs the ECIES private key \(SK_{core}\) from UDM into the secure enclave of the newly joined gNB. 3. Finally, the authenticated gNB downloads the latest private blockchain from the 5 GC. gNB may also index the transactions in the blockchain locally for faster access. 4. Whenever the blockchain has any updates, the gNB will download and index the new blocks accordingly. Regarding the private blockchain administered by AUSF, Figure 3 illustrates the structure of a block in the whole blockchain. Every block should contain the following elements:  
* **Block Header:** It contains the block version for future maintenance and upgrades. * **Previous Block Hash:** It is the hash of the previous block. It guarantees the immutability of the blockchain. \begin{table}
\begin{tabular}{c c} \hline \hline
\begin{tabular}{c} _SUPI, Public Key \(PK_{core}\)_ \\ \hline Update { SUPI, H(Y) } to Private Blockchain \\ \hline \hline \end{tabular}
\end{table} 
Table 3: _Cont._  
Figure 2: Sequence Diagram of 5 GSBA. * **Timestamp:** It is the block creation time for tracking purposes. All transaction timestamps within the block should never be larger than this timestamp. * **Transactions:** Each transaction is a subscription record for one device. To reduce the storage overhead of the blockchain, each block contains multiple transaction records. This size should be adjustable according to the preference of network operators. By default, we follow the block size of bitcoin as 1 MB.