# Analysis of Cryptographic Algorithms to Improve Cybersecurity in the Industrial Electrical Sector
## 4 Digital Security Methodologies outside Those Proposed by IEC62351
### Experiment Results  
To observe the performance of these algorithms, concerning the GOOSE frame, the beginning of the APDU field until its end has been used, and for R-GOOSE from the beginning of the session identifier field to the end of the APDU field has been considered. This is to compare the results with those obtained by the authors of [30; 31], who carried out tests with AES and HMAC-SHA algorithms. Figure 10 shows the GOOSE APDU in plain text and encrypted, the Poly1305 MAC TAG of the 16-byte GOOSE APDU and the calculation times of both algorithms are also seen. The encryption time for the GOOSE APDU was 0.0033 ms and the TAG generation time was 0.0066 ms. Figure 11 shows the sending of the GOOSE frame only with authenticity and integrity security measures to be within the stipulations of IEC62351. Figure 10: Encryption and TAG of the GOOSE APDU with ChaCha20 and Poly1305. Figure 12, in red, shows the \(MAC\_Tag\) field with a hexadecimal value of 0x85 and the \(MAC\_length\) field with a value of 0x10, so the length of the MAC is 16 bytes. Then, in blue, the MAC generated with Poly1305 is seen. When comparing this frame with that of [5], it is observed that the MAC generated with Poly1305 is smaller. It can be noted that the APDU is in plain text since no measures are being used to ensure confidentiality. To observe and compare the calculation times of Poly1305 with HMAC-SHA256, the calculation of HMAC-SHA256 is performed with the same virtual machine that generated the Poly1305 MAC and the calculation time of the authors of [31] is also added. Figure 13 shows the APDU MAC calculated with HMAC-SHA256. It can see that the calculation time of the algorithm is 0.018 ms. Table 3 displays the timings obtained solely through digital security measures intended for verifying the authenticity and integrity of GOOSE messages. It includes a comparison between the results obtained using HMAC-SHA256 in this study and those reported in [31] (third row of the table). Figure 11: Sending secure GOOSE frame with MAC Poly1305 in the extension field. Figure 12: Secure GOOSE frame with Poly1305 received seen via Wireshark. Figure 13: HMAC-SHA256 algorithm and calculation time applied to the GOOSE APDU. Subsequently, the GOOSE frame is tested with security measures for authenticity, but now also with respect to confidentiality. Figure 14 shows the sending of the GOOSE frame with assurance of authenticity and confidentiality, encrypting the GOOSE APDU and generating its MAC (APDU in plain text) through ChaCha20 and Poly1305. Figure 15 shows the GOOSE frame received on the network with its APDU encrypted using ChaCha20 and the Poly1305 MAC TAG of the GOOSE APDU. It can be seen that the content of the APDU is completely unreadable due to the encryption of the APDU, achieving the confidentiality of the GOOSE message. The MAC TAG of the GOOSE APDU can also be seen in a blue box. To compare ChaCha20 with AES128, the time it takes AES128 to perform the encryption is calculated, using the same virtual machine that was used to encrypt the APDU with the ChaCha20 algorithm. Figure 16 shows the result obtained. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**MAC Algorithm** & **MAC Size (bytes)** & **Reference** & **MAC Generation Time (ms)** & **Network Sending Delay (ms)** \\ \hline Poly1305 & 16 & Virtual machine, 1 \(\mathrm{\SIUnitSymbolMicro CPU}\) AMD & 0.0066 & 0.069 \\ HMAC-SHA256-256 & 32 & Virtual machine, 1 \(\mathrm{\SIUnitSymbolMicro CPU}\) AMD & 0.018 & 0.1 \\ HMAC-SHA256-256 & 32 & Intel Celeron, 4 GB RAM & 0.0127 & 0.0757 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: MAC Poly1305 and HMAC-SHA256 computational times. Figure 14: Sending secure GOOSE frame, APDU encrypted with ChaCha20 and Poly1305 MAC embedded in the extension field. Figure 15: GOOSE frame received with APDU encrypted with ChaCha20 and Poly1305 TAG viewed through Wireshark software.