A client authentication method, apparatus, device, and storage medium

By verifying the multi-certificate chain on the client and comparing the encrypted hash value, the problem of easy forgery of client certificates is solved, thereby achieving enhanced authentication of client identity and security protection of the server.

CN114329426BActive Publication Date: 2025-12-12HUBEI TIANRONGXIN NETWORK SECURITY TECH CO LTD +3
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111629669.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-12-12
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

Client certificates are easily forged, making it difficult for servers to accurately identify client identities and increasing the risk of server intrusion by hackers.

Method used

By obtaining the client's multi-certificate chain from the client Certificate message sent by the client, the multi-certificate chain is verified, including verifying the certificate's validity period, number, public key consistency, and domain name matching. Combined with the decryption comparison of the encrypted hash value, the authenticity of the client's identity is ensured.

Benefits of technology

This enhances the reliability of client authentication, reduces the possibility of hackers forging client certificates, and improves server security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114329426B_ABST
    Figure CN114329426B_ABST
Patent Text Reader

Abstract

The application provides a client authentication method and device, equipment and a storage medium. The client authentication method comprises the following steps: obtaining a client multi-certificate chain from a client certificate message sent by a client, wherein the client multi-certificate chain comprises a plurality of client certificate chains, and each client certificate chain comprises a plurality of certificates; checking the client multi-certificate chain to obtain a checking result; if the checking result is that the checking is passed, obtaining an authentication result according to a certificate public key corresponding to the client multi-certificate chain, an encrypted hash value sent by the client and a hash value calculated locally, wherein the encrypted hash value is obtained by encrypting a private key by the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of security authentication technology, and more specifically, to a client authentication method, apparatus, device, and storage medium. Background Technology

[0002] With the continuous development of internet technology, digital certificates have emerged, providing a safeguard for network security. Digital certificates are issued by e-commerce certification centers and are used to verify identity, thereby ensuring the security of network communications.

[0003] In existing technologies, although digital certificates exist, client certificates are easily forged, which may prevent the server from accurately identifying the client's identity, leading to server intrusion by hackers. Summary of the Invention

[0004] Based on this, a client authentication method, device, equipment, and storage medium are proposed.

[0005] Firstly, a client authentication method is provided, including:

[0006] Obtain the client multi-certificate chain from the client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and each client certificate chain includes multiple certificates.

[0007] The client's multi-certificate chain is verified to obtain the verification result;

[0008] If the verification result is successful, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally. The encrypted hash value is obtained by the client through encryption using its private key.

[0009] The aforementioned client authentication method obtains the client's multi-certificate chain from the client's Certificate message. This multi-certificate chain comprises multiple client certificate chains, each containing multiple certificates. The server then verifies the client's multi-certificate chain to obtain the verification result. Therefore, this client authentication method verifies multiple client certificate chains, which significantly increases the verification strength compared to verifying individual certificates or certificate chains. This makes it difficult for hackers to forge so many certificates, thus ensuring the client is not easily counterfeited and reducing the possibility of server intrusion. Furthermore, upon successful verification, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the locally calculated hash value. It's understandable that since the encrypted hash value is obtained using the client's private key, the client is considered to possess the private key corresponding to the certificate public key only if the encrypted hash value can be decrypted using the public key of the client's multi-certificate chain, and the decrypted hash value matches the locally calculated hash value. Only then is the authentication considered successful.

[0010] In one embodiment, obtaining the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the locally calculated hash value includes: decrypting the encrypted hash value using the public key of the certificate corresponding to the client's multi-certificate chain to obtain a decrypted hash value; if the decrypted hash value is the same as the locally calculated hash value, the authentication result is successful; if the decrypted hash value is different from the locally calculated hash value, the authentication result is unsuccessful.

[0011] The above embodiment illustrates the specific authentication process, which involves first decrypting to obtain a decryption hash value, then comparing the decryption hash value with the hash value calculated locally. If they are the same, the authentication is successful.

[0012] In one embodiment, verifying the client multi-certificate chain to obtain a verification result includes: determining whether the certificates in the client multi-certificate chain are valid; determining whether the certificates in the client multi-certificate chain are pairwise different; determining whether the number of client certificate chains included in the client multi-certificate chain is accurate; determining whether the public keys in the client certificates in the client multi-certificate chain are all the same; if all the certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are pairwise different, the number of client certificate chains included in the client multi-certificate chain is accurate, and the public keys in the client certificates in the client multi-certificate chain are all the same, then the verification result is a successful verification.

[0013] In the above embodiments, the server's verification of multiple certificate chains on the client not only needs to confirm whether the certificate is valid, but also whether it contains duplicate certificates, whether the number of certificate chains is accurate, and whether all public keys in the client certificates are the same. This achieves enhanced verification of the certificates and thus enhanced authentication of the client.

[0014] In one embodiment, verifying the client multi-certificate chain to obtain a verification result includes: determining whether the certificates in the client multi-certificate chain are valid; determining whether the certificates in the client multi-certificate chain are pairwise different; determining whether the number of client certificate chains included in the client multi-certificate chain is accurate; determining whether all public keys in the client certificates in the client multi-certificate chain are identical; determining whether the signature of the certificate in the client multi-certificate chain can be decrypted; determining whether all domain names in the client certificates in the client multi-certificate chain are identical; and when all domain names in the client certificates in the client multi-certificate chain are identical, determining that the client... The verification result is considered passed if the domain name in the client certificate of the multi-certificate chain is the same as the domain name used by the client when accessing the server; if all certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are different from each other, the number of client certificate chains included in the client multi-certificate chain is accurate, the public keys in the client certificates of the client multi-certificate chain are all the same, the signatures of the certificates in the client multi-certificate chain can be decrypted, the domain names in the client certificates of the client multi-certificate chain are all the same, and the domain name in the client certificate of the client multi-certificate chain is the same as the domain name used by the client when accessing the server.

[0015] In addition to verifying the validity period, whether the certificate is duplicated, whether the number of certificate chains is accurate, and whether all public keys are the same, the above embodiments also verify the certificate signature and the certificate domain name, thereby further strengthening verification and authentication.

[0016] In one embodiment, before obtaining the client's multi-certificate chain from the certificate chain message sent by the client, the method further includes: obtaining a ClientHello message sent by the client, the ClientHello message including multiple versions of a security protocol, a first random number, and multiple cipher suites; sending a ServerHello message to the client based on the ClientHello message sent by the client, the ServerHello message including a target version selected from the multiple versions of the security protocol, a target cipher suite selected from the multiple cipher suites, and a second random number; sending a ServerCertificate message, a ServerKeyExchange message, a Certificate Request message, and a ServerHelloDone message to the client, the ServerCertificate message including a server certificate chain, the ServerKeyExchange message including a signature method and a hash algorithm, the signature method and hash algorithm being used to obtain the cryptographic hash value, and the Certificate... The Request message is used to instruct the client to send a client multi-certificate chain to the server. The ServerHelloDone message indicates that the server has finished sending messages and is waiting for the client to send messages. The system retrieves the client Certificate message sent by the client; retrieves the client ClientKeyExchange message sent by the client, which includes an encrypted pre-master key obtained by encrypting the pre-master key using the server's public key, which is obtained through the server certificate chain; and retrieves the CertificateVerify message sent by the client, which includes the encrypted hash value.

[0017] The above embodiments illustrate how to obtain the encrypted hash value and how the client verifies the server, thereby ensuring secure interaction between the client and the server.

[0018] In one embodiment, after obtaining the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally if the verification result is successful, the method further includes: if the authentication result is successful, decrypting the encrypted pre-master key using the server's private key to obtain the pre-master key; and obtaining the master key based on the first random number, the second random number, and the pre-master key.

[0019] In the above embodiment, after successful authentication, the server uses the pre-master key to obtain the master key, and then obtains the session key. Subsequently, the server and the client send data to each other through the session key to achieve secure interaction.

[0020] Secondly, a client authentication device is provided, comprising:

[0021] The acquisition module is used to acquire a client multi-certificate chain from a client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and each client certificate chain includes multiple certificates.

[0022] The verification module is used to verify the client's multi-certificate chain and obtain the verification result;

[0023] The authentication module is used to obtain the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally if the verification result is successful. The encrypted hash value is obtained by the client through encryption using its private key.

[0024] In one embodiment, the authentication module is specifically configured to: decrypt the encrypted hash value using the public key of the certificate corresponding to the client's multi-certificate chain to obtain a decrypted hash value; if the decrypted hash value is the same as the hash value calculated locally, the authentication result is successful; if the decrypted hash value is different from the hash value calculated locally, the authentication result is unsuccessful.

[0025] In one embodiment, the verification module is specifically used to: determine whether the certificates in the client multi-certificate chain are valid; determine whether the certificates in the client multi-certificate chain are all different; determine whether the number of client certificate chains included in the client multi-certificate chain is accurate; determine whether the public keys in the client certificates in the client multi-certificate chain are all the same; if all the certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are all different, the number of client certificate chains included in the client multi-certificate chain is accurate, and the public keys in the client certificates in the client multi-certificate chain are all the same, then the verification result is verification passed.

[0026] In one embodiment, the verification module is specifically configured to: determine whether the certificates in the client multi-certificate chain are valid; determine whether the certificates in the client multi-certificate chain are pairwise distinct; determine whether the number of client certificate chains included in the client multi-certificate chain is accurate; determine whether all public keys in the client certificates in the client multi-certificate chain are identical; determine whether the signature of the certificate in the client multi-certificate chain can be decrypted; determine whether all domain names in the client certificates in the client multi-certificate chain are identical; if all domain names in the client certificates in the client multi-certificate chain are identical, determine whether the domain names in the client certificates in the client multi-certificate chain are the same as the domain name used by the client when accessing the server; if all certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are pairwise distinct, the number of client certificate chains included in the client multi-certificate chain is accurate, the public keys in the client certificates in the client multi-certificate chain are identical, the signature of the certificate in the client multi-certificate chain can be decrypted, the domain names in the client certificates in the client multi-certificate chain are identical, and the domain names in the client certificates in the client multi-certificate chain are the same as the domain name used by the client when accessing the server, then the verification result is a successful verification.

[0027] In one embodiment, the client authentication device further includes: a message module, configured to: acquire a ClientHello message sent by a client, the ClientHello message including multiple versions of a security protocol, a first random number, and multiple cipher suites; based on the ClientHello message sent by the client, send a ServerHello message to the client, the ServerHello message including a target version selected from the multiple versions of the security protocol, a target cipher suite selected from the multiple cipher suites, and a second random number; and send a ServerCertificate message, a ServerServerKeyExchange message, and a Certificate message to the client. The system retrieves a Request message and a ServerHelloDone message. The Server Certificate message includes a server certificate chain, and the ServerKeyExchange message includes a signature method and a hash algorithm used to obtain the encrypted hash value. The CertificateRequest message instructs the client to send a client multi-certificate chain to the server, and the ServerHelloDone message indicates that the server has finished sending messages and is waiting for the client to send messages. The system also retrieves the Client Certificate message sent by the client; the ClientKeyExchange message sent by the client includes an encrypted pre-master key, which is obtained by encrypting the pre-master key using the server's public key, which is obtained through the server certificate chain; and the CertificateVerify message sent by the client includes the encrypted hash value.

[0028] In one embodiment, the client authentication device further includes: a master key module, configured to: if the authentication result is successful, decrypt the encrypted pre-master key using the server's private key to obtain a pre-master key; and obtain the master key based on the first random number, the second random number, and the pre-master key.

[0029] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the client authentication method described above.

[0030] Fourthly, a computer-readable storage medium is provided, wherein computer program instructions are stored in the computer-readable storage medium, and the computer program instructions are read and executed by a processor to perform the steps of the client authentication method described above. Attached Figure Description

[0031] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram illustrating the implementation process of the client authentication method in this application embodiment;

[0033] Figure 2 A schematic diagram illustrating client-server interaction provided in an embodiment of this application;

[0034] Figure 3 This is a schematic diagram of the composition structure of the client authentication device in the embodiments of this application;

[0035] Figure 4 This is a block diagram of the internal structure of the computer device in the embodiments of this application. Detailed Implementation

[0036] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0037] In one embodiment, a client authentication method is provided. The executing entity of the client authentication method described in this embodiment is a computer device capable of implementing the client authentication method described in this embodiment. This computer device may include, but is not limited to, terminals and servers. Terminals include desktop terminals and mobile terminals. Desktop terminals include, but are not limited to, desktop computers and in-vehicle computers; mobile terminals include, but are not limited to, mobile phones, tablets, laptops, and smartwatches. Servers include high-performance computers and high-performance computer clusters. For better understanding, the following description uses a server as the executing entity.

[0038] like Figure 1 As shown, a client authentication method is provided, including:

[0039] Step 100: Obtain the client multi-certificate chain from the client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and the client certificate chain includes multiple certificates.

[0040] A client-side multi-certificate chain includes multiple client-side certificate chains, each containing multiple certificates, including client-side certificates.

[0041] A client-side multiple certificate chain refers to multiple client certificate chains held by a client. "Multiple" includes two or more certificates. Each client certificate chain must contain at least two certificates issued by an e-commerce certification authority. Since each client certificate chain contains at least two certificates, a client-side multiple certificate chain must contain at least four certificates. The number of client certificates included in a client-side multiple certificate chain is the same as the number of client certificate chains. For example, if a client-side multiple certificate chain includes two client certificate chains, then the number of client certificates is two, meaning the client has requested certificates from two e-commerce certification authorities. The process of an e-commerce certification authority issuing a certificate to a client includes: the client generating a key pair, which includes a private key and a public key; the client combining its own domain name, client information, and the public key generated by the client to obtain a certificate signing request, for example, the client information could be the client's taxpayer identification number; the client sending the certificate signing request to the e-commerce certification authority; the e-commerce certification authority verifying the domain name, client information, and public key contained in the certificate signing request; after successful verification, the e-commerce certification authority performs a hash calculation using the domain name, client information, and public key to obtain a hash value, and then encrypts the hash value using its own private key; the generated ciphertext is the e-commerce certification authority's signature; the e-commerce certification authority combines this signature with the client's domain name, client information, and client's public key to obtain the certificate, and returns the certificate to the client.

[0042] Step 200: Verify the client's multi-certificate chain to obtain the verification result.

[0043] For example, a client multi-certificate chain includes two client certificate chains, each containing two certificates. The server verifies whether the certificates in the client multi-certificate chain are valid. Specifically, if certificates 1 to 4 in the client multi-certificate chain are all valid, the verification result is "verification passed"; otherwise, the verification result is "verification failed," and the server considers the certificates to be expired and untrustworthy.

[0044] Step 300: If the verification result is successful, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally. The encrypted hash value is obtained by the client through encryption using its private key.

[0045] If the verification result is successful, the server accepts the public key of the certificate corresponding to the client's multi-certificate chain. It should be noted that the public key here is the public key that the client sent to the e-commerce certification center during the certificate issuance process. After the server accepts the public key of the certificate corresponding to the client's multi-certificate chain, the server will perform authentication processing based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally, to obtain the final authentication result. The authentication result includes authentication success and authentication failure. If the authentication result is successful, the server believes that the client does indeed have the private key corresponding to the certificate public key, the client has not been impersonated by a hacker, and the client is a trusted client. If the authentication result is unsuccessful, the server believes that the client does not have the private key corresponding to the certificate public key, the client may have been impersonated by a hacker, and the client is an untrusted client.

[0046] The aforementioned client authentication method obtains the client's multi-certificate chain from the client's Certificate message. This multi-certificate chain comprises multiple client certificate chains, each containing multiple certificates. The server then verifies the client's multi-certificate chain to obtain the verification result. Therefore, this client authentication method verifies multiple client certificate chains, which significantly increases the verification strength compared to verifying individual certificates or certificate chains. This makes it difficult for hackers to forge so many certificates, thus ensuring the client is not easily counterfeited and reducing the possibility of server intrusion. Furthermore, upon successful verification, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the locally calculated hash value. It's understandable that since the encrypted hash value is obtained using the client's private key, the client is considered to possess the private key corresponding to the certificate public key only if the encrypted hash value can be decrypted using the public key of the client's multi-certificate chain, and the decrypted hash value matches the locally calculated hash value. Only then is the authentication considered successful.

[0047] In one embodiment, step 300, obtaining the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the locally calculated hash value, includes:

[0048] Step 300A: Decrypt the encrypted hash value using the public key of the certificate corresponding to the client's multi-certificate chain to obtain the decrypted hash value.

[0049] The server uses the client's certificate public key to decrypt the encrypted hash value sent by the client. If the decryption is successful, the server will obtain the decrypted hash value.

[0050] Step 300B: If the decryption hash value is the same as the hash value calculated locally, the authentication result is successful.

[0051] The server compares the decrypted hash value with the locally calculated hash value. If the decrypted hash value is the same as the locally calculated hash value, the authentication result is successful; if the decrypted hash value is different from the locally calculated hash value, the authentication result is unsuccessful.

[0052] Step 300C: If the decryption hash value is different from the hash value calculated locally, the authentication result is authentication failure.

[0053] The above embodiment illustrates the specific authentication process, which involves first decrypting to obtain a decryption hash value, then comparing the decryption hash value with the hash value calculated locally. If they are the same, the authentication is successful.

[0054] In one embodiment, step 200, which verifies the client multi-certificate chain to obtain a verification result, includes:

[0055] Step 200A: Determine whether the certificates in the client's multi-certificate chain are within their validity period.

[0056] The e-commerce certification center also records the certificate's validity period in the certificate it returns to the client, ensuring that the certificate is only valid for the specified period.

[0057] For each certificate in the client's multi-certificate chain, the server needs to determine whether it is within its validity period. Specifically, if the current time is within the certificate's validity period, the certificate is confirmed to be valid. If the current time is after the upper limit of the certificate's validity period, the certificate is confirmed to be invalid. For example, if the certificate's validity period is from January 1, 1999 to January 1, 2000, then January 1, 2000 is the upper limit.

[0058] Step 200B: Determine whether the certificates in the client multi-certificate chain are different from each other.

[0059] Determining whether certificates in a client-side multi-certificate chain are pairwise distinct involves checking whether all certificates in the chain were issued by different e-commerce certification authorities (ECAs). For example, if a client-side multi-certificate chain includes two chains, each containing two certificates, and these certificates were issued by E-commerce Certification Authority (ECA) 1 through 4 respectively, then the certificates in the chain are considered pairwise distinct. However, if certificates 1 and 3 are issued by E-commerce Certification Authority (ECA) 1, while certificates 2 and 4 are both issued by E-commerce Certification Authority (ECA) 2, then the certificates in the chain are not pairwise distinct, and duplicate certificates exist within the chain.

[0060] Step 200C: Determine whether the number of client certificate chains included in the client multi-certificate chain is accurate.

[0061] First, the number of certificate chains is preset. For example, if the preset number of certificate chains is 3, and the number of client certificate chains included in the client multi-certificate chain is 2, then the number of client certificate chains included in the client multi-certificate chain is considered inaccurate. If the number of client certificate chains included in the client multi-certificate chain is 3, then the number of client certificate chains included in the client multi-certificate chain is considered accurate.

[0062] Step 200D: Determine whether all public keys in the client certificates of the client multi-certificate chain are identical.

[0063] A client can only contain one public key (certificate public key) and one private key. Therefore, the server needs to verify whether all the public keys in the client certificates within the client's multi-certificate chain are identical. If they are all identical, the server assumes the client has not been impersonated; otherwise, the server believes the client is highly likely to have been impersonated. The server compares the public keys in the client certificates within the multi-certificate chain to confirm whether all the public keys are identical.

[0064] Step 200E: If all certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are different from each other, the number of client certificate chains included in the client multi-certificate chain is accurate, and the public keys in the client certificates in the client multi-certificate chain are all the same, then the verification result is that the verification is successful.

[0065] In the above embodiments, the server's verification of multiple certificate chains on the client not only needs to confirm whether the certificate is valid, but also whether it contains duplicate certificates, whether the number of certificate chains is accurate, and whether all public keys in the client certificates are the same. This achieves enhanced verification of the certificates and thus enhanced authentication of the client.

[0066] In one embodiment, step 200, which verifies the client multi-certificate chain to obtain a verification result, includes:

[0067] Step 200a: Determine whether the certificates in the client multi-certificate chain are within their validity period.

[0068] Step 200b: Determine whether the certificates in the client's multi-certificate chain are different from each other.

[0069] Step 200c: Determine whether the number of client certificate chains included in the client multi-certificate chain is accurate.

[0070] Step 200d: Determine whether all public keys in the client certificates in the client multi-certificate chain are identical.

[0071] Steps 200a to 200d are the same as steps 200A to 200D, and will not be described in detail here.

[0072] Step 200e: Determine whether the signature of the certificate in the client multi-certificate chain can be decrypted.

[0073] Determine whether it is possible to decrypt the signatures of all certificates in the client's multi-certificate chain. For example, if the client's multi-certificate chain includes a total of 4 certificates, the server uses the public key of e-commerce certification authority 1 to decrypt the signature of certificate 1. If the decryption is successful, it is determined that the signature of certificate 1 can be decrypted. The server uses the public key of e-commerce certification authority 2 to decrypt the signature of certificate 2. If the decryption is successful, it is determined that the signature of certificate 2 can be decrypted. The server uses the public key of e-commerce certification authority 3 to decrypt the signature of certificate 3. If the decryption is successful, it is determined that the signature of certificate 3 can be decrypted. The server uses the public key of e-commerce certification authority 4 to decrypt the signature of certificate 4. If the decryption is successful, it is determined that the signature of certificate 4 can be decrypted.

[0074] Step 200f: Determine whether all the domain names in the client certificates in the client multi-certificate chain are the same.

[0075] The client certificate also includes the client's domain name. The domain names of the client certificates in each client certificate chain are compared to confirm whether all the domain names in the client certificates in the client multi-certificate chain are the same. If they are all the same, it is considered that all the client certificates in the client multi-certificate chain correspond to one client. If they are not the same, it is considered that all the client certificates in the client multi-certificate chain do not correspond to one client, and the client currently requesting authentication may be impersonated by a hacker.

[0076] Step 200g: When all the domain names in the client certificates in the client multi-certificate chain are the same, determine whether the domain names in the client certificates in the client multi-certificate chain are the same as the domain names used by the client when accessing the server.

[0077] When all the domain names in the client certificates within a multi-certificate chain are identical, it is determined whether the domain names in the client certificates within the multi-certificate chain are the same as the domain names used by the client when accessing the server. This is to prevent impersonation by hackers. It is understandable that if a hacker impersonates a client to access the server, the domain name they use will definitely be different from that of the real client. Therefore, by comparing domain names, impersonation by hackers can be prevented. When all the domain names in the client certificates within the multi-certificate chain are identical, and the domain names in the client certificates within the multi-certificate chain are the same as the domain names used by the client when accessing the server, it is considered that the client has not been impersonated by a hacker. Otherwise, it is considered that the client may have been impersonated by a hacker.

[0078] Step 200h: If all certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are different from each other, the number of client certificate chains included in the client multi-certificate chain is accurate, the public keys in the client certificates in the client multi-certificate chain are all the same, the signatures of the certificates in the client multi-certificate chain can be decrypted, the domain names in the client certificates in the client multi-certificate chain are all the same, and the domain names in the client certificates in the client multi-certificate chain are the same as the domain name used by the client when accessing the server, then the verification result is verification passed.

[0079] In addition to verifying the validity period, whether the certificate is duplicated, whether the number of certificate chains is accurate, and whether all public keys are the same, the above embodiments also verify the certificate signature and the certificate domain name, thereby further strengthening verification and authentication.

[0080] In one embodiment, such as Figure 2 As shown, before obtaining the client multi-certificate chain from the client Certificate message sent by the client in step 100, the method further includes:

[0081] Step 400: Obtain the ClientHello message sent by the client, wherein the ClientHello message includes multiple versions of the security protocol, a first random number, and multiple cipher suites.

[0082] Security protocols may include, but are not limited to, SSL and TLS protocols, and multiple versions of the security protocols, such as SSL3, TLS1.0, TLS1.1, TLS1.2, and TLS1.3; the first random number is a random number sent by the client to the server, which the client needs to generate first; each of the multiple cipher suites defines an algorithm for encrypting data, an authentication algorithm, a data MAC algorithm, a key exchange algorithm, etc., and multiple cipher suites include two or more.

[0083] Step 500: Based on the ClientHello message sent by the client, send a ServerHello message to the client. The ServerHello message includes a target version selected from multiple versions of the security protocol, a target cipher suite selected from multiple cipher suites, and a second random number.

[0084] For example, the target version is SSL3, the target cipher suite is cipher suite 3, and the second random number is a random number generated by the server and sent to the client.

[0085] Step 600: Send a Server Certificate message, a Server KeyExchange message, a Certificate Request message, and a ServerHelloDone message to the client. The Server Certificate message includes a server certificate chain. The Server KeyExchange message includes a signature method and a hash algorithm, which are used to obtain the encrypted hash value. The Certificate Request message instructs the client to send a client multi-certificate chain to the server. The ServerHelloDone message indicates that the server has finished sending messages and is waiting for the client to send messages.

[0086] A server certificate chain includes at least one certificate, meaning it must contain at least a server certificate. Similarly, the server certificate in the chain is also issued to the server by an e-commerce certification authority. The process by which an e-commerce certification authority issues certificates to servers is similar to the process by which it issues certificates to clients, and will not be detailed here. The server sends the server certificate chain to the client so that the client can verify it, thus achieving two-way verification and enabling secure interaction between the server and the client. For example, after receiving the server certificate chain, the client determines whether the certificates in the chain are valid and / or whether it can decrypt the signatures of the certificates in the chain. If all certificates in the chain are valid and / or the client can decrypt the signatures of each certificate in the chain, the client verifies the server certificate chain. After successful verification, the client accepts the public key from the server certificate in the chain.

[0087] A hash algorithm, used to obtain a hash value, such as SHA-1, is used. It's important to note that the server and client need to use the same hash algorithm to process the same input so that the server obtains the "locally calculated hash value" in step 300, and the client obtains the hash value of the "encrypted hash value" in step 300 before encryption. For example, both the server and client use the following messages as input to the SHA-1 algorithm: ClientHello message, ServerHello message, server Certificate message, Certificate Request message, server ServerKeyExchange message, client Certificate message, and client ClientKeyExchange message, to obtain the same hash value. A signature method is used to encrypt the hash value obtained through the hash algorithm, resulting in an encrypted hash value. The client's private key is used during the encryption process. If the client is a genuine client and not an imposter, then the client's private key used in the encryption process is the same as the private key corresponding to the public key of the certificate (corresponding to the client's multi-certificate chain).

[0088] Step 700: Obtain the client Certificate message sent by the client.

[0089] After the client sends the client certificate message to the server, the server will verify the client's multi-certificate chain and obtain the verification result.

[0090] Step 800: Obtain the ClientKeyExchange message sent by the client. The ClientKeyExchange message includes an encrypted pre-master key, which is obtained by encrypting the pre-master key using the server's public key. The server's public key is obtained through the server's certificate chain.

[0091] The pre-master key is generated on the client side. After generating the pre-master key, the client needs to encrypt the generated pre-master key using the server's public key to obtain the encrypted pre-master key. Then, the client sends the encrypted pre-master key to the server through a ClientKeyExchange message for re-verification of the server. Understandably, if the server has not been impersonated by a hacker and the server does indeed possess the private key corresponding to the server certificate chain, then the server can use the private key corresponding to the server certificate chain to decrypt the encrypted pre-master key. If the server can decrypt the encrypted pre-master key, the client's re-verification of the server is successful; if the server cannot decrypt the encrypted pre-master key, the client's re-verification of the server fails.

[0092] Step 900: Obtain the CertificateVerify message sent by the client, wherein the CertificateVerify message includes the cryptographic hash value.

[0093] The client sends a cryptographic hash value to the server via a CertificateVerify message, so that the server can verify whether the client holds the private key corresponding to the certificate's public key using the cryptographic hash value.

[0094] The client authentication method also includes: obtaining the Finished message sent by the client and sending a Finished message to the client. The Finished message indicates that the handshake is complete, and subsequent messages will be encrypted using the session key.

[0095] The above embodiments illustrate how to obtain the encrypted hash value and how the client verifies the server, thereby ensuring secure interaction between the client and the server.

[0096] In one embodiment, after obtaining the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the locally calculated hash value in step 300, the method further includes:

[0097] Step 1000: If the authentication result is successful, the encrypted pre-master key is decrypted using the server's private key to obtain the pre-master key.

[0098] It should be noted that since the encrypted pre-master key is encrypted by the client using the public key of the server's certificate chain, if the server is an imposter, the hacker will not be able to decrypt it even if they obtain the encrypted pre-master key, as they do not possess the real server's private key. Therefore, the client's re-verification of the server will fail. Conversely, if the server is the real server, it will successfully decrypt the encrypted pre-master key using its private key, obtaining the pre-master key sent by the client. Since the server has successfully authenticated the client, it will then generate the master key based on the pre-master key.

[0099] Step 1100: Obtain the master key based on the first random number, the second random number, and the pre-master key.

[0100] Specifically, both the server and the client will obtain the master key based on the first random number, the second random number, and the pre-master key. After obtaining the master key, the server and the client will also obtain the session key based on the master key. Therefore, when the client and the server send data to each other, they will use the session key to encrypt the data. For example, based on the session key, the AES algorithm will be used to encrypt the data to ensure secure data transmission in the future.

[0101] In the above embodiment, after successful authentication, the server uses the pre-master key to obtain the master key, and then obtains the session key. Subsequently, the server and the client send data to each other through the session key to achieve secure interaction.

[0102] In one embodiment, such as Figure 3 As shown, a client authentication device 300 is provided, comprising:

[0103] The acquisition module 301 is used to acquire a client multi-certificate chain from a client Certificate message sent by the client, wherein the client multi-certificate chain includes multiple client certificate chains and the client certificate chain includes multiple certificates;

[0104] Verification module 302 is used to verify the client's multi-certificate chain and obtain the verification result;

[0105] The authentication module 303 is used to obtain an authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally if the verification result is successful. The encrypted hash value is obtained by the client through encryption using its private key.

[0106] In one embodiment, the authentication module 303 is specifically configured to: decrypt the encrypted hash value using the public key of the certificate corresponding to the client's multi-certificate chain to obtain a decrypted hash value; if the decrypted hash value is the same as the hash value calculated locally, the authentication result is successful; if the decrypted hash value is different from the hash value calculated locally, the authentication result is unsuccessful.

[0107] In one embodiment, the verification module 302 is specifically used to: determine whether the certificates in the client multi-certificate chain are valid; determine whether the certificates in the client multi-certificate chain are all different; determine whether the number of client certificate chains included in the client multi-certificate chain is accurate; determine whether the public keys in the client certificates in the client multi-certificate chain are all the same; if all the certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are all different, the number of client certificate chains included in the client multi-certificate chain is accurate, and the public keys in the client certificates in the client multi-certificate chain are all the same, then the verification result is that the verification passes.

[0108] In one embodiment, the verification module 302 is specifically configured to: determine whether the certificates in the client multi-certificate chain are valid; determine whether the certificates in the client multi-certificate chain are pairwise different; determine whether the number of client certificate chains included in the client multi-certificate chain is accurate; determine whether all the public keys in the client certificates in the client multi-certificate chain are the same; determine whether the signature of the certificate in the client multi-certificate chain can be decrypted; determine whether all the domain names in the client certificates in the client multi-certificate chain are the same; if all the domain names in the client certificates in the client multi-certificate chain are the same, determine whether the domain names in the client certificates in the client multi-certificate chain are the same as the domain name used by the client when accessing the server; if all the certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are pairwise different, the number of client certificate chains included in the client multi-certificate chain is accurate, the public keys in the client certificates in the client multi-certificate chain are all the same, the signature of the certificate in the client multi-certificate chain can be decrypted, the domain names in the client certificates in the client multi-certificate chain are all the same, and the domain names in the client certificates in the client multi-certificate chain are the same as the domain name used by the client when accessing the server, then the verification result is a successful verification.

[0109] In one embodiment, the client authentication device 300 further includes: a message module, configured to: acquire a ClientHello message sent by a client, the ClientHello message including multiple versions of a security protocol, a first random number, and multiple cipher suites; based on the ClientHello message sent by the client, send a ServerHello message to the client, the ServerHello message including a target version selected from the multiple versions of the security protocol, a target cipher suite selected from the multiple cipher suites, and a second random number; and send a ServerCertificate message, a ServerServerKeyExchange message, and a Certificate message to the client. The system retrieves a Request message and a ServerHelloDone message. The Server Certificate message includes a server certificate chain, and the ServerKeyExchange message includes a signature method and a hash algorithm used to obtain the encrypted hash value. The CertificateRequest message instructs the client to send a client multi-certificate chain to the server, and the ServerHelloDone message indicates that the server has finished sending messages and is waiting for the client to send messages. The system also retrieves the Client Certificate message sent by the client; the ClientKeyExchange message sent by the client includes an encrypted pre-master key, which is obtained by encrypting the pre-master key using the server's public key, which is obtained through the server certificate chain; and the CertificateVerify message sent by the client includes the encrypted hash value.

[0110] In one embodiment, the client authentication device 300 further includes: a master key module, configured to: if the authentication result is successful, decrypt the encrypted pre-master key using the server's private key to obtain a pre-master key; and obtain a master key that is pairwise distinct based on the first random number, the second random number, and the pre-master key.

[0111] In one embodiment, such as Figure 4As shown, a computer device is provided, which may specifically be a terminal or a server. The computer device includes a processor, memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, the computer program enables the processor to implement a client authentication method. The non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. The volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc. The internal memory may also store a computer program that, when executed by the processor, causes the processor to perform a client authentication method. Those skilled in the art will understand that... Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0112] The client authentication method provided in this application can be implemented as a computer program, and the computer program can be implemented in, for example... Figure 4 The computer device shown runs on this device. The computer device's memory can store the various program templates that make up the client authentication device. For example, the acquisition module 301, the verification module 302, and the authentication module 303.

[0113] A computer device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:

[0114] Obtain the client multi-certificate chain from the client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and each client certificate chain includes multiple certificates.

[0115] The client's multi-certificate chain is verified to obtain the verification result;

[0116] If the verification result is successful, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally. The encrypted hash value is obtained by the client through encryption using its private key.

[0117] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the following steps:

[0118] Obtain the client multi-certificate chain from the client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and each client certificate chain includes multiple certificates.

[0119] The client's multi-certificate chain is verified to obtain the verification result;

[0120] If the verification result is successful, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally. The encrypted hash value is obtained by the client through encryption using its private key.

[0121] It should be noted that the above-mentioned client authentication method, client authentication device, computer equipment, and computer-readable storage medium belong to the same general inventive concept, and the contents of the embodiments of the client authentication method, client authentication device, computer equipment, and computer-readable storage medium are applicable to each other.

[0122] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0123] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0124] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0125] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0126] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A client authentication method, characterized in that, include: Obtain the ClientHello message sent by the client, wherein the ClientHello message includes multiple versions of the security protocol, a first random number, and multiple cipher suites; Based on the ClientHello message sent by the client, a ServerHello message is sent to the client. The ServerHello message includes a target version selected from multiple versions of the security protocol, a target cipher suite selected from multiple cipher suites, and a second random number. The server sends a Server Certificate message, a Server Key Exchange message, a Certificate Request message, and a Server HelloDone message to the client. The Server Certificate message includes a server certificate chain. The Server Key Exchange message includes a signature method and a hash algorithm, which are used to obtain a cryptographic hash value. The Certificate Request message instructs the client to send a client multi-certificate chain to the server. The Server HelloDone message indicates that the server has finished sending messages and is waiting for the client to send messages. Retrieve the client Certificate message sent by the client; Obtain a ClientKeyExchange message sent by the client, wherein the ClientKeyExchange message includes an encrypted pre-master key, which is obtained by encrypting the pre-master key using the server's public key, and the server's public key is obtained through the server's certificate chain; Obtain the CertificateVerify message sent by the client, wherein the CertificateVerify message includes the cryptographic hash value; The client multi-certificate chain is obtained from the client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and each client certificate chain includes multiple certificates. The client requests multiple e-commerce certification centers to issue certificates for it, thereby obtaining multiple client certificate chains. The client multi-certificate chain is verified to obtain a verification result, including: determining whether the certificates in the client multi-certificate chain are valid; determining whether the certificates in the client multi-certificate chain are all different; determining whether the number of client certificate chains contained in the client multi-certificate chain is accurate; determining whether the public keys in the client certificates in the client multi-certificate chain are all the same; if all the certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are all different, the number of client certificate chains contained in the client multi-certificate chain is accurate, and the public keys in the client certificates in the client multi-certificate chain are all the same, then the verification result is a successful verification. If the verification result is successful, the authentication result is obtained based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally. The encrypted hash value is obtained by the client through encryption using its private key.

2. The client authentication method according to claim 1, characterized in that, The step of obtaining the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally includes: The encrypted hash value is decrypted using the public key of the certificate corresponding to the client's multi-certificate chain to obtain the decrypted hash value. If the decryption hash value is the same as the hash value calculated locally, the authentication result is successful. If the decryption hash value is different from the hash value calculated locally, the authentication result is authentication failure.

3. The client authentication method according to claim 1, characterized in that, The step of verifying the client's multi-certificate chain to obtain the verification result includes: Determine whether the certificates in the client's multi-certificate chain are within their validity period; Determine whether the certificates in the client's multi-certificate chain are pairwise distinct; Determine whether the number of client certificate chains included in the client multi-certificate chain is accurate; Determine whether all public keys in the client certificates of the client multi-certificate chain are identical; Determine whether the signature of the certificate in the client's multi-certificate chain can be decrypted; Determine whether all the domain names in the client certificates in the client multi-certificate chain are the same; When all the domain names in the client certificates in the client multi-certificate chain are the same, determine whether the domain names in the client certificates in the client multi-certificate chain are the same as the domain name used by the client when accessing the server; If all certificates in the client multi-certificate chain are valid, each certificate in the client multi-certificate chain is different from the others, the number of client certificate chains included in the client multi-certificate chain is accurate, the public keys in the client certificates in the client multi-certificate chain are all the same, the signatures of the certificates in the client multi-certificate chain can be decrypted, and the domain names in the client certificates in the client multi-certificate chain are all the same and the domain names in the client certificates in the client multi-certificate chain are the same as the domain names used by the client when accessing the server, then the verification result is a successful verification.

4. The client authentication method according to claim 1, characterized in that, If the verification result is successful, after obtaining the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the locally calculated hash value, the process further includes: If the authentication result is successful, the encrypted pre-master key is decrypted using the server's private key to obtain the pre-master key; The master key is obtained based on the first random number, the second random number, and the pre-master key.

5. A client authentication device, characterized in that, include: The acquisition module is used to obtain a client multi-certificate chain from the client Certificate message sent by the client. The client multi-certificate chain includes multiple client certificate chains, and each client certificate chain includes multiple certificates. The client requests multiple e-commerce certification centers to issue certificates for it, thereby obtaining multiple client certificate chains. The verification module is used to verify the client's multi-certificate chain and obtain the verification result; The authentication module is used to obtain the authentication result based on the public key of the certificate corresponding to the client's multi-certificate chain, the encrypted hash value sent by the client, and the hash value calculated locally if the verification result is successful. The encrypted hash value is obtained by the client through encryption using its private key. The verification module is further configured to determine whether the certificates in the client multi-certificate chain are valid; whether the certificates in the client multi-certificate chain are all different; whether the number of client certificate chains contained in the client multi-certificate chain is accurate; and whether the public keys in the client certificates in the client multi-certificate chain are all the same. If all the certificates in the client multi-certificate chain are valid, the certificates in the client multi-certificate chain are all different, the number of client certificate chains contained in the client multi-certificate chain is accurate, and the public keys in the client certificates in the client multi-certificate chain are all the same, then the verification result is that the verification passes. It also includes: a message module, used for: acquiring a ClientHello message sent by a client, the ClientHello message including multiple versions of a security protocol, a first random number, and multiple cipher suites; based on the ClientHello message sent by the client, sending a ServerHello message to the client, the ServerHello message including a target version selected from multiple versions of the security protocol, a target cipher suite selected from multiple cipher suites, and a second random number; sending a Server Certificate message, a Server KeyExchange message, a CertificateRequest message, and a ServerHelloDone message to the client, the Server Certificate message including a server certificate chain, the Server KeyExchange message including a signature method and a hash algorithm, the signature method and hash algorithm being used to obtain the encrypted hash value, the Certificate... The Request message is used to instruct the client to send a client multi-certificate chain to the server. The ServerHelloDone message indicates that the server has finished sending messages and is waiting for the client to send messages. The system retrieves the client Certificate message sent by the client; retrieves the client ClientKeyExchange message sent by the client, which includes an encrypted pre-master key obtained by encrypting the pre-master key using the server's public key, which is obtained through the server certificate chain; and retrieves the CertificateVerify message sent by the client, which includes the encrypted hash value.

6. The client authentication device according to claim 5, characterized in that, The authentication module is specifically used to: decrypt the encrypted hash value using the public key of the certificate corresponding to the client's multi-certificate chain to obtain a decrypted hash value; if the decrypted hash value is the same as the hash value calculated locally, the authentication result is successful. If the decryption hash value is different from the hash value calculated locally, the authentication result is authentication failure.

7. A computer device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the client authentication method according to any one of claims 1 to 4.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which are read and executed by a processor to perform the steps of the client authentication method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Information transmission method based on HTTPS, client and server

    CN113472790A

  • Server authentication using multiple authentication chains

    US20170289137A1

  • Counterfeit app identification method and apparatus

    WO2020177116A1