An anti-quantum user authentication method and system for an SSH protocol
By introducing a quantum-resistant KEM mechanism to replace traditional signatures, the problem of quantum attacks in the SSH protocol is solved, achieving seamless migration with quantum-resistant security and reducing computational overhead, adapting to existing network environments.
Patent Information
- Application Number
- CN202610776983.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-01
- Publication Date
- 2026-08-25
AI Technical Summary
The existing SSH protocol's public key authentication method relies on traditional public key algorithms, which cannot resist quantum attacks, leading to a failure in the identity authentication process. Furthermore, the increased size and computation time of quantum-resistant signatures make them difficult to deploy in real-world applications.
A quantum-resistant KEM mechanism is adopted to replace the traditional digital signature. Identity verification is achieved through key encapsulation and decapsulation operations. The interaction logic and protocol flow of the native SSH public key authentication are retained, and only the internal protocol data and calculation content are adjusted.
It reduces computational overhead and transmission load, alleviates handshake latency and resource consumption, and enables seamless migration of quantum security capabilities, adapting to existing network environments and device architectures.
Smart Images

Figure CN122640113A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to a quantum-resistant user authentication method and system for the SSH protocol. Background Technology
[0002] The SSH (Secure Shell) protocol, with its secure features of encrypted transmission, authentication, and data integrity verification, is widely used in scenarios such as remote server operation and maintenance management, and remote login to cloud computing and data center equipment. After SSH completes version negotiation, algorithm negotiation, and session key exchange, the server and client establish a secure encrypted channel, subsequently entering the user authentication phase. Common methods include password authentication and public key authentication, with public key authentication being the mainstream security method. The client uses its local private key to generate an identity signature and sends the user information, public key, and signature to the server. The server stores the corresponding user's valid public key and verifies the signature's validity using the public key. If the verification passes, the user's identity is confirmed as valid, and login access is granted; otherwise, access is denied. Currently, digital signatures in public key authentication methods mostly use traditional public key algorithms such as RSA and ECDSA. Their security relies on mathematical problems such as large number factorization and discrete logarithms, making them vulnerable to quantum attacks. If the authentication process fails, it will directly lead to serious risks such as abuse of privileges, data leakage, and system control, necessitating quantum-resistant transformations. Because quantum-resistant signatures are significantly larger than traditional signatures, the time required for signature generation and verification is also significantly increased. This makes it difficult to directly deploy and scale up the modification method of simply replacing the original signature algorithm with a quantum-resistant algorithm in practical application scenarios. Summary of the Invention
[0003] To address the problems existing in the prior art, the present invention aims to provide a quantum-resistant user authentication method and system for the SSH protocol, which can maximize compatibility with the existing SSH protocol ecosystem and various operation and maintenance business scenarios, realize smooth iteration and seamless migration of cryptographic algorithms, and significantly reduce the implementation costs of protocol modification, device adaptation and large-scale deployment while ensuring quantum-resistant security capabilities.
[0004] To achieve the above objectives, the technical solution of the present invention includes the following:
[0005] A quantum-resistant user authentication method for the SSH protocol, applied to a server that completes a transport layer handshake with a client, the method comprising: Based on the user authentication request, a quantum-resistant cryptographic key encapsulated ciphertext and a first client authentication certificate are generated; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user's quantum-resistant public key; The key is encapsulated in ciphertext, along with the authentication algorithm and the user's quantum-resistant public key, and sent to the client so that the client can generate and return a second client authentication certificate. The user identity of the client is authenticated by comparing the consistency between the first client authentication certificate and the second client authentication certificate.
[0006] Furthermore, based on the username and user's quantum-resistant public key contained in the user authentication request, a quantum-resistant cryptographic key-encapsulated ciphertext and a first client authentication certificate are generated, including: If the user's quantum-resistant public key exists in the list of legitimate public keys corresponding to the username, then the KEM algorithm specified by the client is used to encapsulate the quantum-resistant cryptographic key, generating the quantum-resistant cryptographic key-encapsulated ciphertext and shared key. Based on the authentication algorithm declared by the client, a first client authentication certificate is generated using a shared key.
[0007] Furthermore, the method also includes: If the user's public key does not exist in the list of valid public keys corresponding to that username, the protocol connection will be interrupted.
[0008] Furthermore, based on the authentication algorithm declared by the client, and utilizing the shared key, a first client authentication certificate is generated, including: Based on shared key Key derivation to obtain the client authentication key ; Use client authentication key The first client authentication certificate is obtained by performing an HMAC operation on the concatenation result of the session identifier, context information starting from user authentication, and the second string constant.
[0009] Furthermore, based on shared keys Key derivation yields the client authentication key, including: A shared key encapsulated with a quantum-resistant cryptographic key and a random salt value are used as inputs to the HKDF-Extract key derivation and extraction algorithm to generate a cryptographically uniform pseudo-random key. Using a pseudo-random key and a first string constant as input to the HKDF-Extract key derivation extension algorithm, a client authentication key of length 1 is generated. Wherein, the first length is the sum of the lengths of the pseudo-random key and the first string constant.
[0010] Furthermore, the client generates and returns a second client authentication certificate, including: Obtain the user's quantum-resistant private key corresponding to the user's quantum-resistant private key; Based on this authentication algorithm, and by using the user's quantum-resistant private key to encapsulate and decapsulate the key, a quantum-resistant cryptographic shared key is obtained. Based on shared key Key derivation yields the client authentication key; Using the client authentication key, perform an HMAC operation on the concatenation result of the session identifier, context information starting from user authentication, and the second string constant to obtain the second client authentication certificate.
[0011] Furthermore, user authentication of the client is completed by comparing the consistency of the first client authentication certificate and the second client authentication certificate, including: If the authentication credentials of the first client and the second client are consistent, the user is determined to be a legitimate user. If the authentication credentials of the first client and the second client are inconsistent, the user is determined to be an illegitimate user.
[0012] A quantum-resistant user authentication method for the SSH protocol, applied to a client completing a transport layer handshake with the server, the method comprising: A user authentication request is sent to the server, which generates a quantum-resistant key-encapsulated ciphertext and a first client authentication certificate, and returns the key-encapsulated ciphertext, authentication algorithm, and user quantum-resistant public key to the client; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user quantum-resistant public key; A second client authentication certificate is generated based on key-encapsulated ciphertext, authentication algorithm, and user quantum-resistant public key. The second client authentication certificate is sent to the server so that the server can authenticate the client's identity by comparing the consistency of the first and second client authentication certificates.
[0013] A quantum-resistant user authentication system for the SSH protocol includes a client and a server that complete a transport layer handshake, wherein the server is used for: Based on the user authentication request, a quantum-resistant cryptographic key encapsulated ciphertext and a first client authentication certificate are generated; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user's quantum-resistant public key; The key is encapsulated in ciphertext, along with the authentication algorithm and the user's quantum-resistant public key, and sent to the client so that the client can generate and return a second client authentication certificate. The user identity of the client is authenticated by comparing the consistency between the first client authentication certificate and the second client authentication certificate.
[0014] An electronic device includes: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the quantum-resistant user authentication method for the SSH protocol as described above.
[0015] Compared with the prior art, the present invention has the following beneficial effects: This invention overcomes the drawbacks of quantum-resistant signature algorithms, such as large key size, excessive computation time, and low verification efficiency. It replaces the complex signing and verification process with key encapsulation and decapsulation operations, effectively reducing computational overhead and transmission load, and alleviating problems such as handshake latency and excessive resource consumption. Simultaneously, it fully utilizes the interaction process and communication architecture of SSH native public key authentication, without altering the protocol handshake sequence, interaction logic, or operating mode; only the internal protocol data fields and computational content are adjusted to adapt to existing network environments and device architectures. Attached Figure Description
[0016] Figure 1 This is a flowchart of a quantum-resistant user authentication method for the SSH protocol. Detailed Implementation
[0017] The present invention will now be described in further detail with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0018] This invention introduces a quantum-resistant KEM mechanism to replace traditional digital signatures for identity verification, abandoning the inherent mode of relying on message signatures for identity authentication. The solution fully retains the interaction logic and protocol flow architecture of SSH native public key authentication, without the need to reconstruct the handshake sequence and communication interaction paradigm, only specifically optimizing the content and operation logic of the protocol interaction data.
[0019] Specifically, such as Figure 1 The quantum-resistant user authentication method for the SSH protocol of the present invention includes the following steps. Before user authentication begins, the client and server have completed a transport layer handshake, that is, completed key negotiation and client authentication of the server.
[0020] Step S1: Based on the user authentication request, generate a quantum-resistant key-encapsulated ciphertext and a first client authentication certificate; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user's quantum-resistant public key.
[0021] The client sends an SSH_MSG_USERAUTH_REQUEST request (user authentication request) to the server, the message content of which includes the username. The type of SSH service requested by the client. ssh-connectionThe client declares the authentication algorithm used. publickey-kem The client-specified KEM algorithm name alg "and user-resistant quantum public key" .
[0022] The server checks if the user's quantum-resistant public key exists in the list of valid public keys corresponding to the current username. If it is not in the list, the connection is terminated; otherwise, it performs a quantum-resistant KEM key encapsulation process based on the KEM algorithm specified by the client. The server then utilizes the user's quantum-resistant public key. Perform quantum-resistant cryptographic key encapsulation to generate quantum-resistant cryptographic key encapsulated ciphertext. With shared keys ,in The public key is encapsulated with an algorithm, such as CRYSTALS-Kyber. Then, the server calculates the client's authentication credentials based on the authentication algorithm declared by the client. The calculation process is as follows: ,in The function is the first step in deriving the key function. Encapsulate the shared key for quantum-resistant cryptography. This is a random salt value. This step addresses the uneven distribution of the shared key. It became a cryptographically uniform pseudo-random key. This can prevent it from being collected and analyzed by adversaries in the middle during transmission; ,in The second step in deriving the function key is to derive the client authentication key. The first string constant, for Length; Calculate the client authentication certificate. Among them, () is a hash function. Indicates a join operation. This is the session identifier, which is the key shared by the client and server when the handshake connection is first established. For contextual information starting from user authentication, For the second string constant, This indicates the first client authentication verification. This step uses the client authentication key. for sid||ctx The value generates an HMAC tag, which serves as authentication proof for the client. The client verifies the authenticity of this proof to achieve identity authentication.
[0023] Step S2: Encapsulate the key in ciphertext, the authentication algorithm, and the user's quantum-resistant public key and send them to the client so that the client can generate and return a second client authentication certificate.
[0024] The server sends an SSH_MSG_USERAUTH_KEMCHALLENGE request to the client, the message content of which includes a quantum-resistant cryptographic key encapsulating ciphertext. The server declares the authentication algorithm used. publickey-kem "and user-resistant quantum public key" .
[0025] The client verifies the authentication algorithm sent by the server. publickey-kem "Whether it matches the one sent to the client or not. If they don't match, the protocol connection is terminated; if they match, the user's quantum-resistant public key is obtained." Corresponding user quantum-resistant private key And through the user's quantum-resistant private key Perform quantum key descrambling resistance. Finally, the second client authentication certificate is calculated in the same way as the server. .
[0026] Finally, the client will calculate Send a request message to the server via SSH_MSG_USERAUTH_KEM_REQUEST.
[0027] Step S3: Complete the user authentication of the client by comparing the consistency of the first client authentication certificate and the second client authentication certificate.
[0028] The server determines the authentication certificate of the first client. Second client authentication certificate If they match, then the server-side authentication of the client's user identity is complete (only legitimate users can authenticate). Only then can the correct calculation be obtained. It then sends an SSH_MSG_USERAUTH_SUCCESS message to the client, notifying the client that user authentication was successful.
[0029] Although specific embodiments of the invention have been disclosed for illustrative purposes to aid in understanding and implementing the invention, those skilled in the art will understand that various substitutions, variations, and modifications are possible without departing from the spirit and scope of the invention and the appended claims. Therefore, the invention should not be limited to the content disclosed in the preferred embodiments, and the scope of protection claimed by the invention is defined by the claims.
Claims
1. A quantum-resistant user authentication method for the SSH protocol, applied to a server that completes a transport layer handshake with a client, characterized in that... The method includes: Based on the user authentication request, a quantum-resistant cryptographic key encapsulated ciphertext and a first client authentication certificate are generated; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user's quantum-resistant public key; The key is encapsulated in ciphertext, along with the authentication algorithm and the user's quantum-resistant public key, and sent to the client so that the client can generate and return a second client authentication certificate. The user identity of the client is authenticated by comparing the consistency between the first client authentication certificate and the second client authentication certificate.
2. The method according to claim 1, characterized in that, Based on the username and user's quantum-resistant public key contained in the user authentication request, a quantum-resistant cryptographic key-encapsulated ciphertext and a first client authentication certificate are generated, including: If the user's quantum-resistant public key exists in the list of legitimate public keys corresponding to the username, then the KEM algorithm specified by the client is used to encapsulate the quantum-resistant cryptographic key, generating the quantum-resistant cryptographic key-encapsulated ciphertext and shared key. Based on the authentication algorithm declared by the client, a first client authentication certificate is generated using a shared key.
3. The method according to claim 2, characterized in that, The method further includes: If the user's public key does not exist in the list of valid public keys corresponding to that username, the protocol connection will be interrupted.
4. The method according to claim 2, characterized in that, Based on the authentication algorithm declared by the client, and using the shared key to generate the first client authentication certificate, including: Based on shared key Key derivation to obtain the client authentication key ; Use client authentication key The first client authentication certificate is obtained by performing an HMAC operation on the concatenation result of the session identifier, context information starting from user authentication, and the second string constant.
5. The method according to claim 3, characterized in that, Based on shared key Key derivation yields the client authentication key, including: A shared key encapsulated with a quantum-resistant cryptographic key and a random salt value are used as inputs to the HKDF-Extract key derivation and extraction algorithm to generate a cryptographically uniform pseudo-random key. Using a pseudo-random key and a first string constant as input to the HKDF-Extract key derivation extension algorithm, a client authentication key of length 1 is generated. Wherein, the first length is the sum of the lengths of the pseudo-random key and the first string constant.
6. The method according to claim 1, characterized in that, The client generates and returns a second client authentication certificate, including: Obtain the user's quantum-resistant private key corresponding to the user's quantum-resistant private key; Based on this authentication algorithm, and by using the user's quantum-resistant private key to encapsulate and decapsulate the key, a quantum-resistant cryptographic shared key is obtained. Based on shared key Key derivation yields the client authentication key; Using the client authentication key, perform an HMAC operation on the concatenation result of the session identifier, context information starting from user authentication, and the second string constant to obtain the second client authentication certificate.
7. The method according to any one of claims 1 to 7, characterized in that, The user authentication of the client is completed by comparing the consistency of the first client authentication certificate and the second client authentication certificate, including: If the authentication credentials of the first client and the second client are consistent, the user is determined to be a legitimate user. If the authentication credentials of the first client and the second client are inconsistent, the user is determined to be an illegitimate user.
8. A quantum-resistant user authentication method for the SSH protocol, applied to a client completing a transport layer handshake with the server, characterized in that, The method includes: A user authentication request is sent to the server, which generates a quantum-resistant key-encapsulated ciphertext and a first client authentication certificate, and returns the key-encapsulated ciphertext, authentication algorithm, and user quantum-resistant public key to the client; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user quantum-resistant public key; A second client authentication certificate is generated based on key-encapsulated ciphertext, authentication algorithm, and user quantum-resistant public key. The second client authentication certificate is sent to the server so that the server can authenticate the client's identity by comparing the consistency of the first and second client authentication certificates.
9. A quantum-resistant user authentication system for the SSH protocol, comprising a client and a server that complete a transport layer handshake, characterized in that, The server is used for: Based on the user authentication request, a quantum-resistant cryptographic key encapsulated ciphertext and a first client authentication certificate are generated; wherein, the user authentication request includes the username, the authentication algorithm declared by the client, the KEM algorithm name specified by the client, and the user's quantum-resistant public key; The key is encapsulated in ciphertext, along with the authentication algorithm and the user's quantum-resistant public key, and sent to the client so that the client can generate and return a second client authentication certificate. The user identity of the client is authenticated by comparing the consistency between the first client authentication certificate and the second client authentication certificate.
10. An electronic device, characterized in that, The electronic device includes: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the quantum-resistant user authentication method for the SSH protocol as described in any one of claims 1-8.