# Implementation and Security Test of Zero-Knowledge Protocols on SSI Blockchain
## 5 Classes Architecture
### Verifier Classes  
The Verifier class has the parameters common to all protocols as attributes:  
* p.q: Prime numbers that define the module on which we will work. * server_socket: Communication socket with the Prover. * pub_key: Prover's public key that they are trying to authenticate. It contains the following methods:
* _init_ (self, port): Class constructor receives the port number where the connection will be established. \begin{table}
\begin{tabular}{l l} \hline \hline \multicolumn{2}{c}{**UC2—Guillou-Quisquater**} \\ \hline Name & Guillou-Quisquater Authentication \\ Description & Step-by-step visualization of the Guillou-Quisquater protocol \\  & 1. & User selects the “Authentication” option. \\  & 2. & User selects the Guillou-Quisquater protocol. \\  & 3. & User inserts the parameters: \\ Event stream & - & p.q: prime factors of \(n\) \\  & - & \(\varv\): exponent coprime to \(\phi(n)=(p-1)(q-1)\); \\  & - & \(\varv\) number of trials demanded by Verifier. \\  & 4. & User is assigned a private and public key accordingly. \\  & 5. & The program shows the steps followed during the authentication process. \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Use Case 2: Guillou-Quisquater. \begin{table}
\begin{tabular}{l l l} \hline \hline \multicolumn{2}{c}{**UC3—Schnor**} \\ \hline Name & \multicolumn{2}{c}{Schnorr Authentication} \\ Description & \multicolumn{2}{c}{Step-by-step visualization of the Schnorr protocol} \\  & 1. & User selects the “Authentication” option. \\  & 2. & User selects the Schnorr protocol. \\  & 3. & User inserts the parameters: \\  & - & p.q: prime numbers, such that q is a factor of \(\mathrm{p}-1\); \\ Event stream & - & \(\varv\): \(a\): \(a\
eq 1\), such that \(a^{q}=1\ mod\); \\  & - & \(\varv\): number of trials demanded by Verifier; \\  & - & \(\varv\): exponent which defined the range of values for e. \\  & 4. & User is assigned a private and public key accordingly. \\  & 5. & The program shows the steps followed during the authentication process. \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Use Case 3: Schnorr. \begin{table}
\begin{tabular}{l l} \hline \hline \multicolumn{2}{c}{**UC4—Brute-Force Attack**} \\ \hline Name & \multicolumn{2}{c}{Brute-Force Attack} \\ Description & \multicolumn{2}{c}{Step-by-step exposition of the operation and the efficiency of a brute-force attack when stealing an identity in an authentication protocol} \\  & 1. & User selects the “Brute-force attack” option. \\  & 2. & User chooses which protocol they want to work against. \\ Event stream & 3. & User inserts the authentication protocol parameters similarly to the authentication \\  & 4. & User is assigned private and public keys accordingly. \\  & 5. & The program shows the steps followed during the attack as well as time-taken statistics. \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Use Case 4: Brute-Force Attack. * listen (self, port): Initializes the socket, waits to accept a connection, and receives the port number where the socket should be established. * layout (0): Initializes the general screen for a generic Verifier. * main (self, protocol): Initializes the protocol requested by the interface. Classes FFS_Verifier, GQ_Verifier, Sch_Verifier  
These particular classes for each of the protocols are subclasses of the Verifier class and have the same structure, with the only difference being the specific parameters that each of them needs to function. Methods:
* _init_ (self, port, \(n,p,q,k,t\)): Constructor of the class. It receives the port where the connection will be established and the list of particular parameters of the specific protocol: \(n,p,q,k,t\) for Feige-Fiat-Shamir; \(n,p,q,t\) for Guillou-Quisquater; \(p,q,a,t\) for Schnorr. It makes a call to the parent constructor and executes the layout function to customize the screen to the specific protocol. * layout_ffs (self): Function that adds the graphical interface elements specific to the specific protocol (protocol name, parameter selection panel).