# Evaluation and Improvement of Internet Printing Protocol Based on HCPN Model Detection Method
## 3 Establishment of HCPN Model for IPP Authentication Process
### Authentication Message Flow
After verifying the ticket, the server carried the pre_shared_key extension in the server-hello message to indicate that it agreed with the client to complete the handshake authentication in PSK mode. Then, it calculated the handshake message authentication code to ensure message integrity. Finally, it calculated the subsequent session key and encrypt the application data. 7. The client replied with a finished message. Here, the finished message had the same function as the server-side finished message. It was the last message in the authentication process, marking the completion of the authentication process, and the session was completely restored. 8. The client and the server encrypted (marked with square brackets) the application data through the subsequent session key for subsequent communication. Using mathematical expressions showed the whole process clearly. First, the client and the server sent basic parameters to each other: key exchange parameters \(g^{\alpha}\), \(g^{\beta}\); random numbers \(N_{C}\), \(N_{S}\); cryptographic parameters offer; and mode. We defined them as variables \(u\) and \(v\), as shown in Definitions (1) and (2).The variable offer indicated the multi-population, symmetric encryption, and hashing schemes supported by the client. The server chose one of the options provided by the offer and recorded it in the variable mode. \[u:=g^{\alpha},N_{c},offer \tag{1}\]  
\[vs.:=g^{\beta},N_{s},mode \tag{2}\]  
After the two parties exchanged basic parameters, according to the DHE key-exchange algorithm, the client and the server independently calculated and derived a set of temporary symmetric keys \((k_{sh},k_{sm},k_{ch},k_{cm})\), as shown in Definition (3). Variables \(k_{sh}\) and \(k_{sm}\) were server hash key and mac key, respectively, and \(k_{ch}\) and \(k_{cm}\) were client hash key and mac key, respectively. The above calculations were completed internally by both parties in communication and could not be exposed to the outside world. The derivation function used was an HMAC-based key-derivation function (HKDF). \[(k_{sh},k_{sm},k_{ch},k_{cm}):=H_{1}(g^{\alpha\beta},u,N_{c},offer,v,N_{s}, mode) \tag{3}\]  
After obtaining the temporary symmetric key, the system continued the subsequent authentication process. The server sent a certificate-request message to the client to request that the client should send a certificate for identity verification, sent a certificate message to provide a signature verification key, and sent a certificate-verify message to provide a signature. Finally, the SFinished message was obtained by calculating the message authentication code. The above messages were all hashed by the \(k_{sh}\) and sent to the external network space. The calculation process is shown in Definitions (4)-(7). \[c_{1}:=E(k_{sh},CertRequest) \tag{4}\]  
\[c_{2}:=E(k_{sh},Cert_{C}) \tag{5}\]  
\[c_{3}:=E(k_{sh},Sig_{S}(u,N_{C},offer,v,N_{S},mode,c_{1},c_{2}) \tag{6}\]  
\[c_{4}:=E(k_{sh},SFin(u,N_{C},offer,v,N_{S},mode,c_{1},c_{2},c_{3}) \tag{7}\]  
After receiving the server message, the client sent a certificate message to provide its own signature verification key, sent a certificate-verify message to provide a signature, and finally calculated the message authentication code with all previous handshake messages to obtain a CFinished message and sent it to the client. The above messages were all hashed by the \(k_{ch}\) key and sent to the external network space. The calculation process is shown in Definitions (8)-(10). \[c_{5}:=E(k_{ch},Cert_{C}) \tag{8}\]  
\[c_{6}:=E(k_{ch},Sig_{C}(u,N_{C},offer,v,N_{S},mode,c_{1},c_{2},\ldots,c_{5}) \tag{9}\]  
\[u:=g^{\alpha},N_{c},offer \tag{1}\]0  
After the server verified the identity of the client, it generated an initial session key and established a secure communication channel. The calculation method of the session key is shown in Definition (11). Then, the system calculated the PSK, generated a session ticket, and sent it to the client after encryption. At this point, the initial handshake phase was complete.