Browser login password encryption transmission method and device

Through asymmetric encryption algorithm and random string generation mechanism, the risk of information intercepting and cracking in browser and server communication is solved, and the user login information is achieved is achieved, the hardware requirements and system complexity are reduced, and the system is complex. Security and reliability of data transmission.

CN119094209APending Publication Date: 2024-12-06北京清研兰亭科技有限公司
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411248294.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The prior art has the risk of information being intercepted and cracked in browser and server communications, especially the risk of symmetric encryption algorithms being leaked in browser pages, and the usage scenarios of facial information and fingerprint information collection devices are limited.

Method used

Asymmetric encryption algorithm is used to generate public and private keys, and random strings are generated through random algorithms, and stored in the Redis database in key-value pairs. The browser uses the public key to encrypt the password and encrypted the encrypted password. and random strings are sent to the server, and the server obtains the private key through the random string for decryption and verification.

Benefits of technology

Improve the security of login information, prevent man-in-the-middle attacks and replay attacks, reduce the risk of user password leakage, reduce hardware investment and system complexity, ensure the uniqueness and temporaryness of keys, improve the security of data transmission and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094209A_ABST
    Figure CN119094209A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of Internet, and discloses a browser login password encryption transmission method and system, and the method comprises the steps: a server generates a public key and a private key through an asymmetric encryption algorithm, generates a random character string (random Key) through a random algorithm, stores the random Key and the private key in a Redis database in the form of a key-value pair, and sets a proper expiration time; the browser obtains a public key and a random Key through a network request, encrypts the password by using the public key when a user inputs an account password, and sends the account, the random Key and the encrypted password to the server; and after the server receives the account, the encrypted password and the random Key, a private key is obtained in a Redis database through the random Key, the received password is decrypted through the private key, and then user information verification is carried out through the account number and the decrypted password. According to the invention, in an unsafe environment, even if the network request is hijacked, the password input by the user can still be ensured to be safe and not cracked; and after login verification each time, the secret key is immediately invalid and cannot be cracked by brute force.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to but is not limited to the field of Internet technology, and in particular relates to a browser login password encryption transmission method and system. Background Art

[0002] Currently, browsers and servers communicate mainly through the https protocol to ensure secure data transmission. Although the https protocol is safe and reliable, there is still a risk of information being intercepted and cracked during network transmission.

[0003] In order to avoid user information leakage caused by information leakage due to network interception, the commonly used methods include: 1. Symmetrically encrypt the login information, and transmit the encrypted information and the secret key to the back end. After the back end parses it, it is compared with the information stored in the database to determine whether the user login is legal; 2. Save the user's facial information and fingerprint information when registering an account, add their facial information and fingerprint information to the login information, and verify the facial information and fingerprint information after receiving the login request on the server to prevent other people from logging into the current account.

[0004] In view of the above analysis, the technical problems that need to be solved urgently in the prior art are:

[0005] 1. For method 1, although the symmetric encryption algorithm is simple and has low server overhead, the encryption is performed in the browser page, and its encryption algorithm is bound to have the risk of leakage. Once the encryption algorithm is cracked, the user login information is easily leaked.

[0006] 2. For method 2, although the risk of information leakage is low, it must rely on facial information and fingerprint information collection equipment, and its usage scenarios are relatively limited. Summary of the invention

[0007] In view of the problems existing in the prior art, the present invention provides a method and system for encrypting and transmitting a browser login password.

[0008] The present invention is implemented as follows: a method for encrypting and transmitting a browser login password, characterized in that the method for encrypting and transmitting a browser login password specifically comprises:

[0009] S1: The server generates a public key (publicKey) and a private key (privateKey) through an asymmetric encryption algorithm, and generates a random string (randomKey) through a random algorithm. The randomKey and privateKey are stored in the Redis database as key-value pairs, and an appropriate expiration time is set.

[0010] S2: The browser obtains publicKey and randomKey through network request, encrypts the password with publicKey when the user enters the account number (account) and password (password), and sends the account, randomKey and encrypted password (passwordEncrypted) to the server;

[0011] S3: After receiving account, passwordEncrypted, and randomKey, the server obtains the private key from the Redis database through randomKey, decrypts passwordEncrypted with the private key, and then compares the account number and decrypted password with the user information stored on the server for login verification.

[0012] Furthermore, the asymmetric encryption algorithm S1 may use the RSA encryption algorithm.

[0013] Further, the steps of S2 are as follows:

[0014] (1) When the user opens the login page in the browser, the publicKey and randomKey are obtained through network request;

[0015] (2) The user enters the account password in the browser, encrypts the password using publicKey, and obtains the encrypted password (passwordEncrypted);

[0016] (3) The browser sends account, randomKey, and passwordEncrypted to the server.

[0017] Furthermore, when S2 uses publicKey to encrypt password, it first concatenates a random string of fixed length to password according to certain rules, and then encrypts it through RSA algorithm.

[0018] Furthermore, S3 uses privateKey to decrypt passwordEncrypted, removes the added random string, and obtains the password entered by the user. If an exception occurs during the verification process, S1 and S2 are repeated. If the verification is successful, the corresponding randomKey and privateKey in Redis are deleted. To ensure that each public key and randomKey can only be used once, the verification process is as follows:

[0019] (1) The server queries the privateKey stored in the Redis database through the randomKey. If the secret key does not exist, a login exception is returned, and the secret key generation and storage logic is repeated, and the new randomKey and publicKey are sent to the browser;

[0020] (2) The server uses the privateKey obtained to decrypt passwordEncrypted;

[0021] (3) The server deletes the key-value pair corresponding to randomKey in Redis;

[0022] (4) Login verification is performed by comparing the account number and decrypted password with the user information stored in the database. If the verification fails, a login exception is returned, and the secret key generation and storage logic is repeated. The new randomKey and publicKey are sent to the browser. If the verification is successful, the interface returns a login success message.

[0023] Another object of the present invention is to provide a browser login password encryption transmission system, the system specifically comprising:

[0024] The server module is used to generate public and private keys through an asymmetric encryption algorithm, generate a random string (randomKey) through a random algorithm, store the randomKey and private key in the Redis database as a key-value pair, and set an appropriate expiration time;

[0025] The browser client module is used to obtain the public key and randomKey from the server through a network request, encrypt the password with the public key when the user enters the account password, and send the randomKey and the encrypted password to the server;

[0026] The verification module is used to obtain the private key from the Redis database through the randomKey after receiving the encrypted password and randomKey on the server side, decrypt the password using the private key, and verify the user information.

[0027] Furthermore, the server module generates a public key and a private key using an RSA encryption algorithm and stores them in a Redis database to ensure security and one-time use of data.

[0028] Furthermore, when encrypting a password, the browser client module first concatenates a random string of fixed length to the password according to certain rules, and then encrypts it using the public key. When decrypting, the server uses the private key to decrypt and remove the added random string to obtain the original password entered by the user.

[0029] Furthermore, during the verification process, if an exception occurs in the verification module, the system will automatically regenerate the public key and randomKey, and repeat the generation and storage logic of the public key and randomKey to ensure that each public key and randomKey is used only once, thereby improving the security and reliability of the login process.

[0030] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:

[0031] First, asymmetric algorithms are currently more mature, easy to use and not easy to crack; with the development of technology, the security and computing efficiency of asymmetric encryption algorithms in devices will be greatly improved. Because the entire verification process is relatively independent, it is easy to upgrade the encryption algorithm in the device at a low cost. And after each login verification, regardless of whether the verification is successful or not, the secret key will become invalid immediately and cannot be cracked by brute force.

[0032] Second, the expected benefits and commercial value of the technical solution of the present invention after transformation are: while ensuring that login information is not leaked, it can reduce the use of information collection devices such as face and fingerprints, reduce hardware investment, and at the same time reduce the complexity of the device, saving the manpower cost of development and maintenance.

[0033] The technical solution of the present invention solves the technical problem that people have been eager to solve but have never succeeded in solving: the device is not limited to password encryption during browser login, but can be used for any confidential information sent to the server through the network, such as form submission for information tamper-proofing in the system.

[0034] Third, the technical solution of the present invention solves many problems of secure password transmission during user login in the prior art in industrial applications, and has achieved significant technical progress. Traditional password transmission mechanisms, such as simple symmetric encryption or plain text transmission, are vulnerable to man-in-the-middle attacks, data eavesdropping, and replay attacks, leading to the leakage of user sensitive information, which in turn causes serious security issues. Especially in industries such as e-commerce and banking that have extremely high requirements for user information security, the prior art cannot fully guarantee the security of passwords during transmission.

[0035] The present invention proposes a more secure method for encrypting and transmitting user login passwords by applying an asymmetric encryption algorithm and a random string generation mechanism. First, the system dynamically generates a pair of public and private keys in each login request, and uses the public key to encrypt the password during the transmission process. This mechanism ensures that even if the transmission data is intercepted, the attacker cannot decrypt the encrypted information obtained. Secondly, the system manages the key through a randomly generated string and destroys the key immediately after the verification is completed, ensuring the uniqueness and temporariness of the key, further improving the security of the system.

[0036] In addition, the solution of the present invention can effectively prevent the common man-in-the-middle attacks and replay attacks in traditional methods, greatly improving the security and reliability of data transmission during user login. In practical applications, such as e-commerce platforms and online banking systems, the technical solution of the present invention significantly reduces the risk of user password leakage and improves the security protection capability of the entire system.

[0037] Therefore, the present invention has achieved significant technological progress in industrial applications, provided a more complete and reliable solution for protecting user sensitive information, met user login needs in scenarios with high security requirements, and provided technical support for various industries that need to ensure user data security. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a flow chart of a browser login password encryption transmission method provided by an embodiment of the present invention;

[0039] Figure 2 This is a flow chart of a browser accessing a login page provided by an embodiment of the present invention;

[0040] Figure 3 It is a diagram of a user account and password login verification process provided by an embodiment of the present invention;

[0041] Figure 4 It is a module diagram of a browser login password encryption transmission system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0043] The following are two specific embodiments based on the browser login password encryption transmission method:

[0044] Example 1: E-commerce platform user login security protection system

[0045] Specific embodiment description:

[0046] In a large e-commerce platform, the security of user login is of vital importance. The platform implements the method of the present invention to protect the user's login information through an asymmetric encryption algorithm and a random string generation mechanism. Each time a user logs in, the platform's server generates a pair of RSA public and private keys, and stores a randomly generated string and private key in a key-value pair in the Redis database. After the user enters the account and password in the browser, the browser obtains the public key and random string generated by the platform through a network request, and uses the public key to encrypt the password entered by the user. The user account, encrypted password and random string are sent to the server together. The server obtains the private key in Redis through the random string and decrypts the password to verify the user's identity. Regardless of whether the identity authentication is successful, the server will immediately delete the corresponding random string and private key in Redis to ensure that each login process is independent and secure.

[0047] Implementation effect: Through this encryption method, the e-commerce platform effectively prevents man-in-the-middle attacks and password leakage, improves data security during the user login process, and protects user privacy.

[0048] Example 2: Secure Login Mechanism for Online Banking System

[0049] Specific embodiment description:

[0050] In an online banking system, user login security is the primary consideration. The banking system adopts the encryption transmission method of the present invention. Each time a user logs in, the server first generates an RSA public key and a private key, and stores and manages the private key through a randomly generated string. After the user enters the account information and password on the login page, the browser obtains the server's public key and random string through a network request, and uses the public key to encrypt the password. The user account, the encrypted password, and the random string are sent to the server together. The server obtains the private key in Redis through the random string and decrypts the password, and compares and verifies it with the user information in the database. Regardless of whether the verification is passed or not, the server will immediately delete the public and private key pair. If the verification is successful, the server returns a login message to the user. If the verification fails, the secret key generation process is repeated, and a verification failure message is returned to the user.

[0051] Implementation effect: This encrypted transmission method greatly protects user login information in the banking system during transmission, reduces financial risks caused by data leakage, and ensures the safety of users' funds.

[0052] The browser login password encryption transmission method provided by the present invention ensures the secure transmission of the password during the user login process through an asymmetric encryption algorithm and a random string generation mechanism. The specific working principle is as follows:

[0053] Step 1: Key Generation and Storage

[0054] At the beginning of the login process, the server first generates a pair of public and private keys through an asymmetric encryption algorithm (such as RSA). The server also uses a random algorithm to generate a random string (randomKey), which is stored in the Redis database as a key-value pair with the private key, and an appropriate expiration time is set to ensure the timeliness and security of the key pair. This step ensures that the public key and randomKey in each login process are independent and unique, improving login security.

[0055] Step 2: Browser encryption and data transmission

[0056] After the user enters the account number and password in the browser, the browser obtains the public key and randomKey generated by the server through the network request. Subsequently, the browser uses the obtained public key to encrypt the password entered by the user to generate an encrypted password (passwordEncrypted). In some embodiments, a random string with certain rules is concatenated to the password before encryption to further enhance the security of encryption. The browser sends the account number, encrypted password and randomKey together to the server.

[0057] Step 3: Server-side decryption and verification

[0058] After receiving the account number, encrypted password, and randomKey sent by the browser, the server queries the private key in the Redis database through the randomKey. If the query fails or the key has expired, the server returns a login exception and regenerates a new public key and randomKey for the browser to use. If the query is successful, the server uses the private key to decrypt the received encrypted password and obtain the original password entered by the user. The decrypted password is compared with the account information entered by the user to authenticate the user through the comparison of the user information in the database.

[0059] Step 4: Key management and login feedback

[0060] During the decryption and verification process, if decryption fails, the key does not exist, or verification fails, the server will return a login exception and regenerate a new public key and randomKey for the browser to use, ensuring that the key pair can only be used once during each login process, thereby enhancing the security of the system. In addition, after the decryption is successful and the verification is passed, the server will delete the corresponding randomKey and private key in Redis to avoid the reuse of the key and return the successful login information to the browser. The entire process improves the security of user passwords during network transmission by ensuring the uniqueness and temporariness of the key.

[0061] like Figure 1 As shown, an embodiment of the present invention provides a method for encrypting and transmitting a browser login password, the method specifically comprising:

[0062] S1: The server generates a public key and a private key through an asymmetric encryption algorithm, and generates a random string (randomKey) through a random algorithm. The randomKey and the private key are stored in the Redis database as a key-value pair, and an appropriate expiration time is set.

[0063] S2: The browser obtains the public key and randomKey through a network request, encrypts the password with the public key when the user enters the account password, and sends the randomKey and the encrypted password to the server;

[0064] S3: After receiving the account, encrypted password, and randomKey, the server obtains the private key through the randomKey in the Redis database, decrypts the received password through the private key, and then verifies the user information through the account and decrypted password.

[0065] In S1, the process of the browser accessing the login page is as follows Figure 2 As shown, the asymmetric encryption algorithm may adopt, for example, the RSA encryption algorithm.

[0066] In the S3, if an exception occurs during the verification process, S1 and S2 are repeated to ensure that each public key and randomKey can only be used once.

[0067] Figure 2 Login verification process for user account and password:

[0068] (1) The user enters the account password in the browser, encrypts the password using publicKey, and obtains the encrypted password (passwordEncrypted).

[0069] (2) The browser sends account, publicKey, and passwordEncrypted to the server.

[0070] (3) The server queries the privateKey stored in the Redis database through the randomKey. If the secret key does not exist, a login exception is returned and the server repeats the process. Figure 2 The secret key generation and storage logic sends the new randomKey and publicKey to the browser.

[0071] (4) The server deletes the key-value pair corresponding to randomKey in Redis

[0072] (5) The server uses the privateKey obtained to decrypt passwordEncrypted. If the decryption fails, a login exception is returned and the server repeats the process. Figure 2 The secret key generation and storage logic sends the new randomKey and publicKey to the browser.

[0073] (6) Query user information through account number and decrypted password, perform login verification, and return a login exception if verification fails, and repeat Figure 2 The secret key generation and storage logic sends the new randomKey and publicKey to the browser.

[0074] (7) The interface returns a successful login message.

[0075] Figure 3 Description of the encryption and decryption process:

[0076] S301, when using publicKey to encrypt the password, first concatenate a random string of fixed length to the password according to certain rules.

[0077] S302, after decrypting passwordEncrypted using privateKey, remove the random string added in S301 to obtain the password input by the user.

[0078] like Figure 4 As shown, a browser login password encryption transmission system provided by an embodiment of the present invention specifically includes:

[0079] Another object of the present invention is to provide a browser login password encryption transmission system, the system specifically comprising:

[0080] The server module is used to generate public and private keys through an asymmetric encryption algorithm, generate a random string (randomKey) through a random algorithm, store the randomKey and private key in the Redis database as a key-value pair, and set an appropriate expiration time;

[0081] The browser client module is used to obtain the public key and randomKey from the server through a network request, encrypt the password with the public key when the user enters the account password, and send the randomKey and the encrypted password to the server;

[0082] The verification module is used to obtain the private key from the Redis database through the randomKey after receiving the encrypted password and randomKey on the server side, decrypt the password using the private key, and verify the user information.

[0083] The server module uses the RSA encryption algorithm to generate public and private keys and stores them in the Redis database to ensure security and one-time use of data.

[0084] When encrypting a password, the browser client module first adds a random string of fixed length to the password according to certain rules, and then encrypts it using the public key. When decrypting, the server uses the private key to decrypt and remove the added random string to obtain the original password entered by the user.

[0085] If an exception occurs during the verification process of the verification module, the system will automatically regenerate the public key and randomKey, and repeat the generation and storage logic of the public key and randomKey to ensure that each public key and randomKey are used only once, thereby improving the security and reliability of the login process.

[0086] The specific application fields or related products of the present invention.

[0087] 1. Internet product login system

[0088] 2. Encryption of user information when submitting policies in the Internet insurance system

[0089] 3. Encryption of personal information in Internet user authentication systems

[0090] 3. In the online registration system (such as filling out college entrance examination volunteers), the registration form information is encrypted to prevent tampering (such as applying for college entrance examination volunteers)

[0091] Relevant evidence of the technical effects achieved by the embodiments of the present invention.

[0092] 1. Once the interface is hijacked during network transmission, the hijacker can easily obtain the user's encrypted password (passwordEncrypted) and public key (publicKey). The encryption algorithm may also be obtained through front-end code analysis, but the private key (privateKey) stored on the server cannot be obtained, so the hijacker cannot obtain the user's password through parsing. If the privateKey corresponding to the current publicKey is obtained by brute force, it is very difficult to implement because the current asymmetric encryption algorithm is relatively mature. Once the encryption algorithm is cracked, the asymmetric encryption algorithm used in this device can be easily upgraded, and the normal operation of the device will not be affected during the replacement process.

[0093] 2. The encryption and decryption key pair for each account is unique, and algorithms cannot be used to batch parse and obtain user passwords.

[0094] 3. PrivateKey is time-limited, and each time the server performs login verification, regardless of success or failure, the privateKey is deleted and the current publicKey is discarded. It is impossible to imitate the login process by hijacking the port and forwarding the request.

[0095] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.

Claims

1. A browser login password encryption transmission method, characterized in that: The method specifically includes: S1: The server generates a public key and a private key through an asymmetric encryption algorithm, and generates a random string (randomKey) through a random algorithm. The randomKey and the private key are stored in the Redis database as a key-value pair, and an appropriate expiration time is set. S2: The browser obtains the public key and randomKey through a network request, encrypts the password with the public key when the user enters the account password, and sends the randomKey and the encrypted password to the server; S3: After receiving the account, encrypted password, and randomKey, the server obtains the private key through the randomKey in the Redis database, decrypts the received password through the private key, and then verifies the user information through the account and decrypted password.

2. The method for encrypting and transmitting a browser login password as claimed in claim 1, characterized in that: The asymmetric encryption algorithm S1 may use the RSA encryption algorithm.

3. The method for encrypting and transmitting a browser login password as claimed in claim 1, characterized in that: The steps of S2 are as follows: (1) The user enters the account password in the browser, encrypts the password using publicKey, and obtains the encrypted password (passwordEncrypted); (2) The browser sends publicKey and passwordEncrypted to the server.

4. The method for encrypting and transmitting a browser login password as claimed in claim 1, characterized in that: In S2, when using publicKey to encrypt password, a random string of fixed length is first concatenated to password according to certain rules; after using privateKey to decrypt passwordEncrypted, the added random string is removed to obtain the password input by the user.

5. The method for encrypting and transmitting a browser login password as claimed in claim 1, characterized in that: In S3, if an exception occurs during the verification process, S1 and S2 are repeated to ensure that each public key and randomKey can only be used once. The verification process is as follows: (1) The server queries the privateKey stored in the Redis database through the randomKey. If the secret key does not exist, a login exception is returned, and the secret key generation and storage logic is repeated, and the new randomKey and publicKey are sent to the browser; (2) The server uses the privateKey obtained to decrypt passwordEncrypted; (3) The server deletes the key-value pair corresponding to randomKey in Redis; (4) If the decryption fails, a login exception is returned, and the key generation and storage logic is repeated, and the new randomKey and publicKey are sent to the browser; (4) Login verification is performed by comparing the account number and decrypted password with the user information stored in the database. If the verification fails, a login exception is returned, and the secret key generation and storage logic is repeated. The new randomKey and publicKey are sent to the browser. If the verification is successful, the interface returns a login success message.

6. A browser login password encryption transmission system based on claims 1-4, characterized in that: The system specifically includes: The server module is used to generate public and private keys through an asymmetric encryption algorithm, generate a random string (randomKey) through a random algorithm, store the randomKey and private key in the Redis database as a key-value pair, and set an appropriate expiration time; The browser client module is used to obtain the public key and randomKey from the server through a network request, encrypt the password with the public key when the user enters the account password, and send the randomKey and the encrypted password to the server; The verification module is used to obtain the private key from the Redis database through the randomKey after receiving the encrypted password and randomKey on the server side, decrypt the password using the private key, and verify the user information.

7. The system for encrypting and transmitting a browser login password as claimed in claim 6, characterized in that: The server module uses the RSA encryption algorithm to generate public and private keys and stores them in the Redis database to ensure security and one-time use of data.

8. The system for encrypting and transmitting a browser login password as claimed in claim 6, characterized in that: When encrypting a password, the browser client module first adds a random string of fixed length to the password according to certain rules, and then encrypts it using the public key. When decrypting, the server uses the private key to decrypt and remove the added random string to obtain the original password entered by the user.

9. The system for encrypting and transmitting a browser login password as claimed in claim 6, characterized in that: If an exception occurs during the verification process of the verification module, the system will automatically regenerate the public key and randomKey, and repeat the generation and storage logic of the public key and randomKey to ensure that each public key and randomKey are used only once, thereby improving the security and reliability of the login process.

Citation Information

Cited By

  • Account password security control method and device in fingerprint browser

    CN119740214A

  • WebSocket-based user login method and device

    CN120321050A

  • Dynamic login security control method and device

    CN120639318A

  • Key cloak user name password encryption transmission method, device and medium

    CN120811590A