Token-based authentication method, device, equipment and storage medium
Through the token-based authentication method, the biometric hash value is used to decrypt and encrypt the token, and the communication is encrypted by combining public and private keys, the contradiction between security and convenience of the login authentication method in the prior art is solved, and the login authentication method is realized. Efficient user authentication and information security protection.
Patent Information
- Application Number
- CN202211199515.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-29
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2042-09-29
AI Technical Summary
While ensuring the security of user information, the existing login authentication method is difficult to maintain user convenience experience and take into account the problem of performance overhead.
Token-based authentication method is adopted to obtain user's biometric information through the terminal to generate biometric hash values, decrypt the encryption token sent by the server, and send it to the service with the token and biometric hash values encrypted by the public key. Verify and realize authentication.
It simplifies the authentication process, reduces the risk of information leakage, improves the reliability of verification results, and ensures user privacy without storing sensitive information.
Smart Images

Figure CN115529591B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a token-based authentication method, apparatus, device and storage medium. Background Art
[0002] With the popularization of smart phones and the development of Internet finance, financial mobile applications have developed rapidly. However, due to the characteristics of the application areas of financial mobile applications, their security assurance has become critical.
[0003] Compared with non-financial applications, financial applications have higher security requirements because their functions involve high-risk transactions such as user information and transfers. Among the many functions provided by financial applications, login and authentication are at the core of user information protection and application security in mobile applications. Currently, the security issues of login and authentication are solved by combining automatic login and secondary authentication. That is, after a user logs in once, he does not need to log in again, and can automatically log in through certain business logic in subsequent operations. When conducting certain high-risk transactions, the user's identity is verified through secondary authentication of biometric data.
[0004] The current login authentication method cannot maintain user convenience and performance overhead while ensuring user information security. Summary of the invention
[0005] The present application provides a token-based authentication method, apparatus, device and storage medium to solve the problem that the current login authentication method cannot simultaneously maintain user convenience experience and take into account performance overhead while ensuring user information security.
[0006] On the one hand, the present application provides a token-based authentication method, applied to a terminal, comprising:
[0007] After receiving the user's authentication request, prompt the user to enter biometric information, and generate a biometric hash value based on the biometric information entered by the user;
[0008] Decrypting a pre-stored encrypted token according to the biometric hash value to obtain a decrypted token, wherein the token is sent by the server to the terminal;
[0009] Sending authentication information to the server, the authentication information including the token and the biometric hash value encrypted by the public key, so that the server verifies the biometric hash value in the authentication information by generating the biometric hash value of the token after decryption by the private key;
[0010] After the verification is passed, the authentication response sent by the server is obtained, and the authentication response is used to indicate that the authentication is successful.
[0011] Optionally, decrypting a pre-stored encrypted token according to the biometric hash value to obtain the decrypted token includes:
[0012] Obtaining a decryption key through an SM4 encryption algorithm according to the biometric hash value and the terminal identification;
[0013] The pre-stored encrypted token is decrypted using the decryption key to obtain the decrypted token.
[0014] Optionally, after obtaining the user's authentication request, prompting the user to input biometric information, and before generating a biometric hash value based on the biometric information input by the user, the method further includes:
[0015] After the user successfully logs in for the first time, prompt the user to perform biometric identification to obtain the user's biometric information, and generate a biometric hash value based on the SM3 algorithm according to the biometric information;
[0016] Encrypting the biometric hash value by using the public key and sending it to the server, so that the server decrypts the biometric hash value by using the private key and generates a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm, and the public key is obtained by the terminal from the server in advance;
[0017] Receive a token encrypted by the server using a private key, and decrypt the token using the public key;
[0018] According to the biometric hash value and the terminal identification, an encryption key is obtained through the SM4 encryption algorithm, and the token is encrypted and stored through the encryption key.
[0019] Optionally, after the user successfully logs in automatically, or after obtaining an authentication response sent by the server, the method further includes:
[0020] Receive a new token encrypted by the server using the private key;
[0021] Decrypting the new token using the public key;
[0022] The new token is encrypted by the encryption key and stored.
[0023] On the other hand, the present application provides a token-based authentication method, applied to a server, comprising:
[0024] Obtaining authentication information sent by the terminal, the authentication information including a token encrypted with a public key and a biometric hash value;
[0025] Decrypting the encrypted token and biometric hash value using a private key to obtain a decrypted token and biometric hash value;
[0026] Verifying the biometric hash value in the authentication information according to the biometric hash value of the token generated by the server;
[0027] After the verification is passed, an authentication response is sent to the terminal, where the authentication response is used to indicate that the authentication is successful.
[0028] Optionally, before obtaining the authentication information sent by the client, the method further includes:
[0029] After the user successfully logs in for the first time, receiving the biometric hash value encrypted by the public key and sent by the terminal;
[0030] Decrypting the biometric hash value by using the private key, and generating a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm;
[0031] The token is encrypted by the private key and sent to the terminal.
[0032] Optionally, after the user automatically logs in successfully, or after sending an authentication response to the terminal, the method further includes:
[0033] generating a new token based on the biometric hash value;
[0034] Encrypting the new token using the private key;
[0035] The encrypted new token is sent to the terminal.
[0036] In a third aspect, the present application provides a token-based authentication device, applied to a terminal, comprising:
[0037] The acquisition module is used to prompt the user to input biometric information after obtaining the user's authentication request, and generate a biometric hash value based on the biometric information input by the user;
[0038] A decryption module, used to decrypt a pre-stored encrypted token according to the biometric hash value to obtain a decrypted token, wherein the token is sent by the server to the terminal;
[0039] A sending module, configured to send authentication information to the server, the authentication information including a token and a biometric hash value encrypted by a public key, so that the server verifies the biometric hash value in the authentication information by generating a biometric hash value of the token after decryption by a private key;
[0040] The acquisition module is also used to obtain the authentication response sent by the server after the verification is passed, and the authentication response is used to indicate that the authentication is successful.
[0041] Optionally, the decryption module is specifically used for:
[0042] Obtaining a decryption key through an SM4 encryption algorithm according to the biometric hash value and the terminal identification;
[0043] The pre-stored encrypted token is decrypted using the decryption key to obtain the decrypted token.
[0044] Optionally, the acquisition module is also used to:
[0045] After the user successfully logs in for the first time, prompt the user to perform biometric identification to obtain the user's biometric information, and generate a biometric hash value based on the SM3 algorithm according to the biometric information;
[0046] Encrypting the biometric hash value by using the public key and sending it to the server, so that the server decrypts the biometric hash value by using the private key and generates a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm, and the public key is obtained by the terminal from the server in advance;
[0047] Receive a token encrypted by the server using a private key, and decrypt the token using the public key;
[0048] According to the biometric hash value and the terminal identification, an encryption key is obtained through the SM4 encryption algorithm, and the token is encrypted and stored through the encryption key.
[0049] Optionally, the acquisition module is also used to:
[0050] Receive a new token encrypted by the server using the private key;
[0051] Decrypting the new token using the public key;
[0052] The new token is encrypted by the encryption key and stored.
[0053] In a fourth aspect of the present application, the present application provides a token-based authentication device, applied to a server, comprising:
[0054] An acquisition module, used to acquire authentication information sent by the terminal, wherein the authentication information includes a token encrypted by a public key and a biometric hash value;
[0055] A decryption module, used to decrypt the encrypted token and biometric hash value by using a private key to obtain a decrypted token and biometric hash value;
[0056] A verification module, configured to verify the biometric hash value in the authentication information according to the biometric hash value of the token generated by the server;
[0057] The sending module is used to send an authentication response to the terminal after the verification is passed, and the authentication response is used to indicate that the authentication is successful.
[0058] Optionally, the acquisition module is also used to:
[0059] After the user successfully logs in for the first time, receiving the biometric hash value encrypted by the public key and sent by the terminal;
[0060] Decrypting the biometric hash value by using the private key, and generating a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm;
[0061] The token is encrypted by the private key and sent to the terminal.
[0062] Optionally, the sending module is further used for:
[0063] generating a new token based on the biometric hash value;
[0064] Encrypting the new token using the private key;
[0065] The encrypted new token is sent to the terminal.
[0066] In a fifth aspect of the present application, an electronic device is provided, including:
[0067] Processor and memory;
[0068] Memory stores computer-executable instructions;
[0069] The processor executes the computer-executable instructions stored in the memory, so that the electronic device executes any one of the methods in the first aspect.
[0070] In a sixth aspect of the present application, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement a method for determining a driver program for a hardware peripheral as described in any one of the first aspects.
[0071] The present embodiment provides a token-based authentication method, apparatus, device and storage medium, wherein after the terminal obtains the user's authentication request, the method prompts the user to input biometric information, and generates a biometric hash value based on the biometric information input by the user; the terminal decrypts the pre-stored encrypted token based on the biometric hash value to obtain the decrypted token; the terminal sends authentication information to the server; the terminal sends authentication information to the server; the server decrypts the encrypted token and the biometric hash value using a private key to obtain the decrypted token and the biometric hash value; the server verifies the biometric hash value in the authentication information based on the biometric hash value of the token generated by the server; after the verification is passed, the server sends an authentication response to the terminal; the terminal obtains the authentication response sent by the server. This method uses biometric hash values instead of biometric information for storage. The server generates a token related to the biometric hash value and encrypts the token using the biometric hash value. Secret key encryption is used in communication, so that neither the terminal nor the server stores sensitive information. Biometric information is used for secondary authentication, which simplifies the authentication process while reducing the risk of information leakage, protecting user privacy, and improving the reliability of verification results. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0073] Figure 1 It is a specific application scenario diagram of the token-based authentication method provided by this application;
[0074] Figure 2 Token-based authentication method process provided for the embodiment of the present application Figure 1 ;
[0075] Figure 3 Token-based authentication method process provided for the embodiment of the present application Figure 2 ;
[0076] Figure 4 A schematic diagram of the structure of a token-based authentication device provided in an embodiment of the present application;
[0077] Figure 5 A schematic diagram of the structure of a token-based authentication device provided in an embodiment of the present application;
[0078] Figure 6 A hardware structure diagram of a token-based authentication device provided in an embodiment of the present application.
[0079] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0080] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0081] First, the terms involved in this application are explained.
[0082] The token is a fixed-length string generated by negotiation between the client and the server. The token itself does not carry any customer information.
[0083] The device number is an electronic serial number consisting of 15 digits, which corresponds to each mobile phone one by one. The code is unique in the world and is generated by the client according to a specific algorithm.
[0084] Keychain storage technology is a secure storage container that comes with the iOS system. Keychain service provides a secure way to save private information (passwords, private keys, certificates, etc.). Each iOS program has an independent keychain storage. The data inside the keychain is automatically encrypted. Keychain storage security is much higher than localStorage.
[0085] The keystore storage technology is a service provided by the Android keystore system for applications to save and obtain private keys or certificates. The keystore is a native background daemon. First, the keystore can prevent the extraction of key materials from the application process and the Android device as a whole, thereby avoiding the unauthorized use of key materials outside the Android device. Second, the keystore allows applications to specify authorized use of keys and enforce these restrictions outside the application process, thereby avoiding the unauthorized use of key materials on Android devices.
[0086] The national secret algorithm is a set of encryption and decryption algorithms issued by the State Cryptography Administration, consisting of the national secret SM2 algorithm, the national secret SM3 algorithm and the national secret SM4 algorithm.
[0087] The national secret SM2 algorithm is an asymmetric encryption algorithm with higher security strength and computing speed than the RSA algorithm.
[0088] The national secret SM3 algorithm is a hash algorithm that generates a hash value of 256 bits in length. The algorithm design is complex and has high security.
[0089] The national secret SM4 algorithm is a group symmetric encryption algorithm with higher security than the DES encryption algorithm.
[0090] Automatic login means that when a user opens an app that they have logged in before, they can use it again without having to enter their account and password again.
[0091] Biometric authentication refers to the use of user's biometric information, such as fingerprints, faces, etc. to achieve login and identity recognition.
[0092] Identity authentication information refers to the authentication of user identity by verifying user ID information, mobile phone information and other information.
[0093] Biometric feature hash refers to a unique data string calculated based on the user's biometric features using a fixed algorithm.
[0094] Figure 1 This is a specific application scenario diagram of the token-based authentication method provided by this application. Figure 1 As shown, the application scenario includes: user 101, financial application 102 and server 103. Exemplarily, when user 101 uses financial application 102 on the terminal, he needs to log in with his account and password to enter the application. After receiving the user's login request, financial application 102 will communicate with the server to confirm the identity of user 101. When user 101 puts financial application 102 into the background and uses it again, or when user 101 conducts high-risk transactions, user 101 needs to enter the account and password again for identity authentication, which reduces the user's experience. At the same time, when the terminal has the function of storing the account and password, and the user checks the function of storing the account and password, the user's account and password are at risk of being stolen.
[0095] The present application provides a token-based authentication method, which uses biometric hash values instead of biometric information for storage. The server generates a token related to the biometric hash value, encrypts the token using the biometric hash value, and uses secret key encryption in communication, so that neither the terminal nor the server stores sensitive information, and uses biometric information to participate in secondary authentication. While simplifying the authentication process, it reduces the risk of information leakage, protects user privacy, and improves the reliability of verification results.
[0096] The token-based authentication method provided in this application is intended to solve the above technical problems of the prior art.
[0097] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0098] Figure 2 Token-based authentication method process provided for the embodiment of the present application Figure 1 .like Figure 2 As shown, this embodiment first describes in detail the process of performing secondary authentication after the terminal successfully logs in. The method provided in this embodiment includes:
[0099] S201. After receiving the authentication request from the user, the terminal prompts the user to input biometric information, and generates a biometric hash value according to the biometric information input by the user;
[0100] In this embodiment, the secondary authentication is mainly performed in the form of a security token. In financial mobile applications, the implementation logic of the secondary authentication mainly includes the following: one is that the mobile application locally stores the user's login name and password, and uses the information stored in the terminal to log in in the subsequent automatic login action; one is to use a long connection, the terminal and the server establish a long connection that is not released for a long time, and retrieve the login status through the long connection; one is to use a security token generated according to certain logic, and perform operations as a credential in the subsequent automatic login process. Among them, using an account password for manual login or automatic login has the risk of the message being intercepted and replayed, which is not conducive to the protection of user information; using a long connection for automatic login puts a large load pressure on the server, and there is a great test on the performance of the service provider. Therefore, this application uses a security token based on user biometric information for authentication. The basic process is that the server generates a token corresponding to the user's biometric information and stores the corresponding relationship between the token and the biometric information, and then sends the token to the terminal. When the terminal performs secondary authentication, it carries the token and the hash value corresponding to the biometric information and sends it to the server. The server verifies whether the token sent by the terminal corresponds to the biometric information hash value it sent, that is, the user can be authenticated.
[0101] After receiving the user's authentication request, the terminal obtains the user's biometric information in order to generate a biometric hash value based on the biometric information. The biometric hash value is a unique data string related to the biometric feature. After obtaining the user's biometric information, the terminal does not save it, but uses it as raw input data to generate a biometric hash value using an algorithm. The purpose is not to save the biometric information in the terminal and prevent the biometric information from being stolen.
[0102] S202, the terminal decrypts the pre-stored encrypted token according to the biometric hash value, and obtains the decrypted token, wherein the token is sent from the server to the terminal;
[0103] In this embodiment, when performing secondary authentication, a token sent by the server to the terminal has been obtained after the first successful login. The token is stored in the keychain or keystore of the terminal and has been encrypted during storage. The purpose is to ensure that when the terminal is attacked, if the token is stolen, without the secret key, the acquired data cannot be decrypted to obtain the token. In this embodiment, the token is encrypted using a biometric hash value. At the same time, when encrypting, the device number of the terminal can also be combined so that the acquisition of the secret key is bound to the terminal, further ensuring the security of the token.
[0104] Therefore, after obtaining the token in the keychain or keystore, it needs to be decrypted, and the decryption key needs to be generated by the biometric hash value.
[0105] Optionally, a decryption key may be obtained through an SM4 encryption algorithm according to a biometric hash value and an identification of the terminal, and then the terminal decrypts a pre-stored encrypted token through the decryption key to obtain a decrypted token.
[0106] In this embodiment, when encrypting the token based on the biometric hash value and the terminal identification, the SM4 encryption algorithm can be used, that is, a part of the biometric hash value and the terminal serial number are intercepted as the encryption key of the SM4 encryption algorithm. Therefore, when decrypting, the biometric hash value and the terminal identification are also required to calculate the decryption key.
[0107] Those skilled in the art will appreciate that the token may be sent by the server to the terminal after the terminal logs in for the first time or automatically logs in. For example, the terminal receives a new token encrypted by the server using a private key; the terminal decrypts the new token using a public key, and encrypts and stores the new token using an encryption key.
[0108] S203, the terminal sends authentication information to the server, the authentication information including the public key encrypted token and the biometric hash value;
[0109] In this embodiment, the server does not store the user's biometric information. The token is essentially a long string of characters. In order to make it correspond to the user's biometric information, the server uses an algorithm to generate a random string corresponding to the biometric hash value when generating the token, which is the token. After that, the server stores the biometric hash value and the corresponding token, and takes them out for comparison when waiting for authentication. Therefore, when performing authentication, the terminal needs to send authentication information including the token encrypted with the public key and the biometric hash value.
[0110] In this embodiment, the public key is generated by the server using an algorithm and then sent to the terminal. When the terminal logs in for the first time, it will send a request to the server to request the server to generate a pair of secret keys, a public key and a private key. The server stores the private key and sends the public key to the terminal. This method can encrypt the communication process between the terminal and the server, further ensuring the financial security of the user. When the terminal sends authentication information to the server, it uses the public key generated by the server for encryption.
[0111] S204, the server obtains the authentication information sent by the terminal;
[0112] S205, the server decrypts the encrypted token and biometric hash value using the private key to obtain the decrypted token and biometric hash value;
[0113] In this embodiment, the private key is a pair of secret keys generated by the server using the algorithm at the same time as the public key in the above step. The authentication information sent by the terminal received by the server is encrypted with the public key. Therefore, the server needs to obtain the specific token and biometric hash value for verification, that is, it needs to decrypt the authentication information using the private key.
[0114] S206, the server verifies the biometric hash value in the authentication information according to the biometric hash value of the token generated by the server;
[0115] In this embodiment, in order to verify that the token sent by the terminal is the biometric hash value of the user used to generate the token, the biometric hash value sent by the terminal is compared with the biometric hash value of the generated token stored in the server to complete the verification.
[0116] S207. After the verification is passed, the server sends an authentication response to the terminal, where the authentication response is used to indicate that the authentication is successful.
[0117] S208: The terminal obtains the authentication response sent by the server.
[0118] After the server sends an authentication response to the terminal, the token expires and the server will resend a new token to the terminal. For example, the server generates a new token using the stored biometric hash value, encrypts it with a private key and sends it to the terminal. The terminal decrypts the new token using the public key and encrypts and stores the new token using the encryption key.
[0119] In this embodiment, in order to prevent someone from stealing the token and using the token for subsequent secondary authentication or high-risk operations, after the automatic login is successful after the first login, or after the terminal sends the token to the server and passes the authentication, the server will cancel the verified token, use the biometric hash value to generate a new random string token, and encrypt the token and send it to the terminal. After the terminal receives the new token, it must first decrypt it, and then encrypt and store it in the manner described in the above steps.
[0120] This embodiment provides a token-based authentication method, which prompts the user to enter biometric information after the terminal obtains the user's authentication request, and generates a biometric hash value according to the biometric information entered by the user; the terminal decrypts the pre-stored encrypted token according to the biometric hash value to obtain the decrypted token; the terminal sends authentication information to the server; the terminal sends authentication information to the server; the server decrypts the encrypted token and the biometric hash value by a private key to obtain the decrypted token and the biometric hash value; the server verifies the biometric hash value in the authentication information according to the biometric hash value of the token generated by the server; after the verification is passed, the server sends an authentication response to the terminal; the terminal obtains the authentication response sent by the server. This method uses the biometric hash value to replace the biometric information for storage, the server generates a token related to the biometric hash value, and encrypts the token using the biometric hash value, and uses secret key encryption in communication, so that neither the terminal nor the server stores sensitive information, and uses biometric information to participate in secondary authentication, which simplifies the authentication process, reduces the risk of information leakage, protects user privacy, and improves the reliability of the verification result.
[0121] Figure 3 Token-based authentication method process provided for the embodiment of the present application Figure 2 .like Figure 2 As shown, in this embodiment Figure 2 Based on the embodiment shown, the process of first login of the terminal is described in detail. The method of this embodiment includes:
[0122] S301. After the user successfully logs in for the first time, the terminal prompts the user to perform biometric identification to obtain the user's biometric information, and generates a biometric hash value based on the SM3 algorithm according to the biometric information;
[0123] In this embodiment, biometric information is used during automatic login or secondary authentication, and no biometric information is entered during the first login. Therefore, after the user successfully logs in for the first time, if the user turns on automatic login, the user is required to enter the biometric information. After obtaining the biometric information, the terminal does not save it, but directly uses it as input for the SM3 algorithm to generate a unique data string, namely, the biometric hash value.
[0124] S302, the terminal encrypts the biometric hash value using the public key and sends it to the server;
[0125] In this embodiment, the public key is obtained in Figure 2 S203 of the illustrated embodiment has been described and will not be repeated here.
[0126] S303, the server receives the biometric hash value encrypted by the public key sent by the terminal;
[0127] S304, the server decrypts the biometric hash value using the private key, and generates a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm;
[0128] In this embodiment, the public key and the private key are generated by the server based on the SM2 encryption algorithm. In order to obtain a token that is uniquely related to the user's biometric information and not store the biometric information in the server, a random string, i.e., a token, is generated using a biometric hash value that is uniquely related to the biometric information. Those skilled in the art will understand that for a user, the biometric information corresponding to him is unique, and the biometric hash value generated using the same algorithm is also unique, but the token corresponding to him is not unique, but only the latest token is saved in the server. After the token is verified, it will be revoked, and the new token generated thereafter will be different from the last revoked token.
[0129] S305, the server encrypts the token using the private key and sends it to the terminal;
[0130] In this embodiment, the private key is generated by the server based on the SM2 encryption algorithm.
[0131] S306, the terminal receives the token encrypted by the server using the private key, and decrypts the token using the public key;
[0132] In this embodiment, the public key is generated by the server based on the SM2 encryption algorithm.
[0133] S307, the terminal obtains an encryption key through the SM4 encryption algorithm according to the biometric hash value and the terminal identification, and encrypts and stores the token through the encryption key;
[0134] In this embodiment, the token is encrypted using the biometric hash value because the terminal does not store the user's biometric information. Each time the terminal enters the user's biometric information, it will be used as the input of the SM4 encryption algorithm, and the terminal's identifier, which is also used as the input of the SM4 encryption algorithm, will immediately generate the SM4 encryption algorithm key, and then use the key to encrypt the token and store it in the keychain or keystore. In this way, even if someone steals the token, they cannot use the encrypted token without the user's biometric information.
[0135] In this embodiment, after the token is authenticated once, the server will cancel it and regenerate a new token for security reasons and send it to the terminal. The process has been described in the above embodiment and will not be repeated here in this embodiment.
[0136] Figure 4The schematic diagram of the structure of a token-based authentication device provided in an embodiment of the present application. The device of this embodiment can be in the form of software and / or hardware. Figure 4 As shown, a token-based authentication device 400 provided in an embodiment of the present application is applied to a terminal, and includes an acquisition module 401, a decryption module 402, and a sending module 403.
[0137] The acquisition module 401 is used to prompt the user to input biometric information after obtaining the user's authentication request, and generate a biometric hash value according to the biometric information input by the user;
[0138] The decryption module 402 is used to decrypt the pre-stored encrypted token according to the biometric hash value to obtain the decrypted token, wherein the token is sent from the server to the terminal;
[0139] The sending module 403 is used to send authentication information to the server, the authentication information including the token and the biometric hash value encrypted by the public key, so that the server can verify the biometric hash value in the authentication information by generating the biometric hash value of the token after decryption by the private key;
[0140] The acquisition module 401 is also used to acquire the authentication response sent by the server after the verification is passed, and the authentication response is used to indicate that the authentication is successful.
[0141] In a possible implementation, the decryption module is specifically used for:
[0142] According to the biometric hash value and the terminal identification, the decryption key is obtained through the SM4 encryption algorithm;
[0143] The pre-stored encrypted token is decrypted using the decryption key to obtain the decrypted token.
[0144] In a possible implementation, the acquisition module is further used to:
[0145] After the user successfully logs in for the first time, the user is prompted to perform biometric identification to obtain the user's biometric information, and a biometric hash value is generated based on the SM3 algorithm according to the biometric information;
[0146] Encrypt the biometric hash value by using the public key and send it to the server, so that the server can decrypt the biometric hash value by using the private key and generate a token based on the decrypted biometric hash value, wherein the public key and private key are generated by the server based on the SM2 encryption algorithm, and the public key is obtained by the terminal from the server in advance;
[0147] Receive the token encrypted by the server using the private key and decrypt it using the public key;
[0148] According to the biometric hash value and the terminal identification, the encryption key is obtained through the SM4 encryption algorithm, and the token is encrypted and stored with the encryption key.
[0149] In a possible implementation, the acquisition module is further used to:
[0150] Receive a new token encrypted by the server's private key;
[0151] Decrypt the new token using the public key;
[0152] The new token is encrypted with the encryption key and stored.
[0153] Figure 5 The schematic diagram of the structure of a token-based authentication device provided in an embodiment of the present application. The device of this embodiment can be in the form of software and / or hardware. Figure 5 As shown, a token-based authentication device 500 provided in an embodiment of the present application is applied to a server, and includes an acquisition module 501, a decryption module 502, a verification module 503, and a sending module 504.
[0154] The acquisition module 501 is used to acquire the authentication information sent by the terminal, where the authentication information includes a token encrypted by a public key and a biometric hash value;
[0155] A decryption module 502, used to decrypt the encrypted token and biometric hash value using a private key to obtain a decrypted token and biometric hash value;
[0156] Verification module 503, used to verify the biometric hash value in the authentication information according to the biometric hash value of the token generated by the server;
[0157] The sending module 504 is used to send an authentication response to the terminal after the verification is passed, and the authentication response is used to indicate that the authentication is successful.
[0158] In a possible implementation, the acquisition module is further used to:
[0159] After the user successfully logs in for the first time, the biometric hash value encrypted by the public key sent by the receiving terminal;
[0160] Decrypt the biometric hash value through the private key and generate a token based on the decrypted biometric hash value, where the public key and private key are generated by the server based on the SM2 encryption algorithm;
[0161] The token is encrypted with the private key and sent to the terminal.
[0162] In a possible implementation, the sending module is further used for:
[0163] generating a new token based on the biometric hash value;
[0164] Encrypt the new token using the private key;
[0165] Send the encrypted new token to the terminal.
[0166] Figure 6 The hardware structure diagram of the token-based authentication device provided in the embodiment of the present application. Figure 6 As shown, the token-based authentication device 600 includes:
[0167] Processor 601 and memory 602;
[0168] Memory stores computer-executable instructions;
[0169] The processor executes the computer-executable instructions stored in the memory 602, so that the electronic device performs the token-based authentication method as described above.
[0170] It should be understood that the processor 601 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), ASICs, etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor. The memory 602 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk.
[0171] The embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement a token-based authentication method.
[0172] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0173] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A token-based authentication method, characterized in that: Applied to a terminal, the method comprises: After obtaining the user's authentication request, prompt the user to enter biometric information, and generate a biometric hash value based on the biometric information entered by the user, wherein the biometric hash value is a data string related to the biometric; Obtaining a decryption key through an SM4 encryption algorithm according to the biometric hash value and the terminal identification; Decrypting the pre-stored encrypted token using the decryption key to obtain the decrypted token; Sending authentication information to a server, the authentication information including a token and a biometric hash value encrypted with a public key, so that the server verifies the biometric hash value in the authentication information by generating a biometric hash value of the token after decryption with a private key; After the verification is passed, obtaining the authentication response sent by the server, wherein the authentication response is used to indicate that the authentication is successful; After obtaining the user's authentication request, prompting the user to input biometric information, and before generating a biometric hash value based on the biometric information input by the user, the method further includes: After the user successfully logs in for the first time, prompt the user to perform biometric identification to obtain the user's biometric information, and generate a biometric hash value based on the SM3 algorithm according to the biometric information; Encrypting the biometric hash value by using the public key and sending it to the server, so that the server decrypts the biometric hash value by using the private key and generates a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm, and the public key is obtained by the terminal from the server in advance; Receive a token encrypted by the server using a private key, and decrypt the token using the public key; According to the biometric hash value and the terminal identification, an encryption key is obtained through the SM4 encryption algorithm, and the token is encrypted and stored through the encryption key.
2. The method according to claim 1, characterized in that After the user successfully logs in automatically, or after obtaining the authentication response sent by the server, the method further includes: Receiving a new token encrypted by the server using the private key; Decrypting the new token using the public key; The new token is encrypted by the encryption key and stored.
3. A token-based authentication method, characterized in that: Applied to the server, the method includes: Acquire authentication information sent by the terminal, the authentication information including a token encrypted with a public key and a biometric hash value; wherein the biometric hash value is generated by the terminal prompting the user to input biometric information after acquiring the user's authentication request, and is based on the biometric information input by the user, and the biometric hash value is a data string related to the biometric; the token before public key encryption is obtained by the terminal decrypting a pre-stored encrypted token with a decryption key, and the decryption key is obtained by the terminal using an SM4 encryption algorithm based on the biometric hash value and the terminal's identifier; Decrypting the encrypted token and biometric hash value using a private key to obtain a decrypted token and biometric hash value; Verifying the biometric hash value in the authentication information according to the biometric hash value of the token generated by the server; After the verification is passed, an authentication response is sent to the terminal, wherein the authentication response is used to indicate that the authentication is successful; Before obtaining the authentication information sent by the terminal, the method further includes: After the user successfully logs in for the first time, receiving the biometric hash value encrypted by the public key and sent by the terminal; Decrypting the biometric hash value by using the private key, and generating a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm; The token is encrypted by the private key and sent to the terminal so that the terminal decrypts the token by the public key. The encryption key is obtained by the SM4 encryption algorithm according to the biometric hash value and the identification of the terminal, and the token is encrypted and stored by the encryption key.
4. The method according to claim 3, characterized in that After the user automatically logs in successfully, or after sending an authentication response to the terminal, the method further includes: generating a new token based on the biometric hash value; Encrypting the new token using the private key; The encrypted new token is sent to the terminal.
5. A token-based authentication device, applied to a terminal, characterized in that: include: an acquisition module, configured to prompt the user to input biometric information after obtaining the user's authentication request, and generate a biometric hash value based on the biometric information input by the user, wherein the biometric hash value is a data string related to the biometric; A decryption module, used to obtain a decryption key through an SM4 encryption algorithm according to the biometric hash value and the terminal identification; Decrypting the pre-stored encrypted token using the decryption key to obtain the decrypted token; A sending module, used to send authentication information to a server, the authentication information including a token and a biometric hash value encrypted by a public key, so that the server verifies the biometric hash value in the authentication information by generating a biometric hash value of the token after decryption by a private key; The acquisition module is further used to acquire the authentication response sent by the server after the verification is passed, and the authentication response is used to indicate that the authentication is successful; The acquisition module is further used for: After the user successfully logs in for the first time, prompt the user to perform biometric identification to obtain the user's biometric information, and generate a biometric hash value based on the SM3 algorithm according to the biometric information; Encrypting the biometric hash value by using the public key and sending it to the server, so that the server decrypts the biometric hash value by using the private key and generates a token based on the decrypted biometric hash value, wherein the public key and the private key are generated by the server based on the SM2 encryption algorithm, and the public key is obtained by the terminal from the server in advance; Receive a token encrypted by the server using a private key, and decrypt the token using the public key; According to the biometric hash value and the terminal identification, an encryption key is obtained through the SM4 encryption algorithm, and the token is encrypted and stored through the encryption key.
6. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the electronic device performs the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement a token-based authentication method as described in any one of claims 1 to 4.
Citation Information
Cited By
Biometric-integrated coin
US12639700B2
