# Analysis of Cryptographic Algorithms to Improve Cybersecurity in the Industrial Electrical Sector
## 4 Digital Security Methodologies outside Those Proposed by IEC62351
### Experiment Results
Figure 17 shows the APDU decrypted with ChaCha20, to decrypt the APDU the same ChaCha20 algorithm is performed but instead of performing XOR with the plaintext, it is performed with the ciphertext. Table 4 shows the calculation times of each algorithm to guarantee the confidentiality of the APDU of the GOOSE message and it compares it with what was obtained in [31] (third row of the table). The sending of the GOOSE message is encrypted and also authenticated with a MAC algorithm embedded in the extension field. With respect to R-GOOSE, there are \"security algorithm\" and \"encryption algorithm\" fields that identify the algorithms that are being used to provide digital security. To use the ChaCha20 and Poly1305 algorithms, the two bytes of the \"security algorithm\" field, \"encryption algorithm\" could be specified to a value of 0X04 and \"MAC algorithm\" to 0X06 to specify ChaCha20 and Poly1305, respectively. To use the ChaCha20/Poly1305 algorithm it could specify \"encryption algorithm\" and \"MAC algorithm\" to 0X05 and 0X06. Table 5 shows what was just stated. \begin{table}
\begin{tabular}{l l l l l} \hline
**Encryption Algorithm** & **Reference** & **Encryption** & **Decryption** & **Network Sending** \\ \hline ChaCha20 & Virtual machine, 1 vCPU AMD Ryzen 5 5600X, 512 MB RAM & 0.0033 & 0.0088 & 0.12 \\ AES128-GCM & Virtual machine, 1 vCPU AMD Ryzen 5 5600X, 512 MB RAM & 0.017 & 0.021 & 0.10 \\ AES128-GCM & Intel Celeron, 4 GB RAM & 0.00797 & 0.0932 & 0.079 \\ \hline \end{tabular}
\end{table} 
Table 4: GOOSE APDU encryption and decryption time. Figure 16: Encryption and calculation time of the AES128 algorithm applied to the GOOSE APDU. Figure 17: GOOSE APDU decrypted with ChaCha20 and calculation time. The images of the analysis carried out with S-GosV and Wireshark for the R-GOOSE frames can be obtained from the repository available at [32]. Table 6 presents the generation times of the MAC algorithms applied to the R-GOOSE frame and it compares it with what was obtained in [31] (third row of the table). Although the encryption and decryption times of AES-256-GCM are very good, ChaCha20 shows low and very stable values. The images of the analysis carried out with S-GosV and Wireshark for the AEAD algorithm applied to GOOSE and R-GOOSE frames can be obtained from the repository available at [32]. Table 8 shows the generation and verification times of the AEAD algorithm of the GOOSE message plus the communication delay time and the total delay that considers the processing of the algorithms and the communication delay. In the third row, the times obtained in [30] are shown. Finally, Table 9 shows a summary of the generation and verification time of the AEAD algorithm applied in the R-GOOSE message. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**MAC Algorithm** & **MAC Size (bytes)** & **Reference** & **Generation Time (ms)** \\ \hline Poly1305 & 16 & Virtual machine, 1 vCPU AMD Ryzen 5600X, 512 MB RAM & 0.0083 \\ HMAC-SHA256-256 & 32 & Virtual machine, 1 vCPU AMD Ryzen 5600X, 512 MB RAM & 0.035 \\ HMAC-SHA256-256 & 32 & Intel Celeron, 4 GB RAM & 0.008 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Calculation times MAC algorithms applied from session identifier until the end of the R-GOOSE APDU. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Encryption Algorithm** & **Reference** & \begin{tabular}{l} **R-GOOSE Encryption** \\ **Time (ms)** \\ \end{tabular} & \begin{tabular}{l} **R-GOOSE Decryption** \\ **Time (ms)** \\ \end{tabular} & \begin{tabular}{l} **Network Sending** \\ **Delay (ms)** \\ \end{tabular} \\ \hline ChaCha20 & \begin{tabular}{l} Virtual machine, 1 vCPU \\ AMD Ryzen 5 5600X, 512 MB RAM \\ Virtual machine, 1 vCPU \\ AMD Ryzen 5 5600X, 512 MB RAM \\ \end{tabular} & 0.0030 & 0.0035 & 0.117 \\ AES256-GCM & \
\begin{tabular}{l} Virtual machine, 1 vCPU \\ AMD Ryzen 5 5600X, 512 MB RAM \\ \end{tabular} & 0.054 & 0.002 & 0.114 \\ AES256-GCM &
\begin{tabular}{l} Intel Celeron, 4 GB RAM \\ \end{tabular} & 0.286 & 0.221 & [-] \\ \hline \hline \end{tabular}
\end{table}