An Encryption Transmission Method for Instant Messaging (IM) Messages
By generating user password str1 and using RabbitMQ to manage message transmission encryption methods, the stability and security issues of instant messaging system under large-scale users are solved, efficient and secure data transmission is achieved, and user privacy is protected.
Patent Information
- Application Number
- CN202211037321.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-08-26
AI Technical Summary
The existing instant messaging system is difficult to support stably when used online by millions of users, and data transmission is easy to be cracked, making it difficult to protect user privacy.
The user identifier guid and random code are used to generate the user password str1, manage message transmission through websocket connection and RabbitMQ, and use symmetric encryption technology to protect user information, reduce system coupling and improve security.
It has achieved stable online support for millions of users, ensuring the security and reliability of information transmission, protecting user privacy, reducing system pressure, and improving user experience.
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network data communication, and more specifically, relates to an encrypted transmission method for instant messaging (IM) messages. Background Art
[0002] In recent years, with the rapid development of mobile communication technology, an instant messaging (IM) application that enables users to establish a private chat room on a mobile network has been increasingly widely used, and the functions of the IM application are all realized based on the reliable transmission of IM messages. Considering factors such as the complexity of the mobile network and the mobility of mobile terminals, the reliable transmission of IM messages faces huge challenges. When the number of users reaches more than one million, it is very difficult for the background server to provide stable support, which is likely to cause a bad experience for users.
[0003] There are many instant messaging systems at home and abroad currently. Among them, QQ, WeChat, WhatsApp, Skype, etc. have a relatively high market share. However, with the popularization of users, huge potential benefits have emerged, and instant messaging systems have also become targets of attacks by hackers and viruses. Investigations also show that Internet users are now increasingly concerned about their privacy, and developers have begun to develop more secure instant messaging systems. Therefore, there is an urgent need to design an encrypted transmission method for instant messaging (IM) messages that can not only support more than one million users to use online, but also protect the privacy of users and provide better services for users.
[0004] After retrieval, a large number of patents have been publicly disclosed regarding the technical application of remote image transmission. For example, Chinese Patent Application No.: 2015107132307, Invention Creation Name: A Transmission Method, Device and System for Instant Messaging (IM) Messages. This application discloses a transmission method, device and system for instant messaging (IM) messages. The method includes that the client selects one connection from multiple connections established with the first access server and the second access server as the target connection for currently sending IM messages, sends the IM messages through the currently selected target connection, and determines whether an acknowledgment message is received within a preset time period after sending the IM messages. When the acknowledgment message is not received, the client selects one connection other than the above target connection from multiple connections as the target connection for currently sending IM messages, and performs the operations of sending the IM messages through the currently selected target connection and determining whether an acknowledgment message is received within a preset time period after sending the IM messages until the client receives an acknowledgment message within a preset time period after sending the IM messages through the currently selected target connection.
[0005] Another example is the Chinese patent application number: 2016111668114, and the name of the invention is: A user-state encrypted instant messaging method and system, which discloses a user-state encrypted instant messaging method and system, which uses user-controllable encryption technology to protect the user's instant messaging information, and can effectively protect the user's personal privacy. The principle of the system is to construct a set of user-unique characteristic passwords, and encrypt the user's communication information based on this password to ensure that only the legal owner of this password can decrypt it. The specific process is: initialization; message encryption; message transmission; message decryption. The system includes a server and several clients, and the client is connected to the server through the network. The advantage of this system is strong security, even the communication server cannot understand the content of the information transmitted by the user, high efficiency, and communication efficiency on par with similar non-encrypted products. Summary of the invention
[0006] 1. Problems to be solved
[0007] In view of the problems existing in the prior art, the present invention intends to provide an encrypted transmission method for instant messaging IM messages and provide a secure data transmission technology that can not only support more than one million users online at the same time, but also protect the privacy of users and provide better services for users.
[0008] 2. Technical solution
[0009] To solve the above problems, the present invention adopts the following technical solutions.
[0010] The invention provides an encrypted transmission method for instant messaging IM messages, comprising the following steps:
[0011] A: The user enters the account number and password and logs in to the client;
[0012] B: The backend server accepts the account and password entered by the user, and checks whether the account and password match. If they do not match, it returns a check failure and the login is unsuccessful. If they match, it generates a user password str1;
[0013] C: The user gets the user password str1, logs in successfully and stores the password, and creates a websocket connection between the user and the message forwarding server;
[0014] D: The client obtains the http request of the user login data from the backend server and places the http in the user password str1;
[0015] E: The backend server receives the request from the client, obtains the user password str1, decrypts it to obtain the user information, and searches the backend server database for relevant user information. If no information is found, a failure message is returned. If relevant user information is found, the information requested by the client is returned based on the user.
[0016] F: The user logs in to the user terminal and sends an IM message to another user or group;
[0017] G: The background server verifies whether the user password str1 of the message sender is correct. If it is incorrect, it returns a failure message. If it is correct, it constructs an object obj;
[0018] H: Convert the object obj to a json string, open a RabbitMQ connection, and send the json string to the exchange of RabbitMQ;
[0019] I: Each message forwarding server obtains the message in the exchange queue, parses the json string into an object, obtains the user information of the message recipient, and then queries whether there is a connection of the message recipient user in the websocket connection list of the message forwarding server. If not, it does nothing. If so, it sends the json string to the message recipient user through the message forwarding server;
[0020] J: The user terminal of the message recipient user obtains the message sent by the message forwarding server.
[0021] As a further improvement of the present invention, the steps for generating the password in step B are as follows:
[0022] B1: The background server numbers the user IDs in the order of user registration, 1, 2, 3... n, where the user ID corresponding to the nth registered user is n;
[0023] B2: When the user first registers and logs in, the background server will automatically generate a globally unique user identifier guid;
[0024] B3: Each time the user logs in to the user terminal, the background server will also automatically generate a random code;
[0025] B4: The user identity code str is "user ID, user identifier guid, user account, random code";
[0026] B5: Use symmetric encryption to encrypt the user identity code str, and the encrypted user identity code str is the user password str1.
[0027] As a further improvement of the present invention, the user identifier guid is a random string with a length of 32 bits.
[0028] As a further improvement of the present invention, the random code is also a random string with a length of 32 bits.
[0029] As a further improvement of the present invention, step A includes the user opening the device, which can be a web page, an APP or a mini-program. For the first login, an account and password need to be registered first.
[0030] As a further improvement of the present invention, in step E, symmetric decryption is used to obtain the decrypted user information. The decrypted user information is a string. According to the comma-separated string, a string array arr is obtained. According to the first value, the second value, and the third value in the array arr, the user ID, the user identifier guid, and the user account are queried in the background server database. If not found, a failure message is returned. If the relevant user information is found, the information requested by the user terminal is returned according to the user.
[0031] As a further improvement of the present invention, the constructed object obj in step G includes the message sending user information, the message receiving user information, and the message content. Among them, the message sending user information includes the message sending user account, the message sending user terminal type, and the message sending user ID; the message receiving user information includes the message receiving user ID, and the message receiving user ID is the user ID or the group ID; the message content includes the message type, the message content, and the relevant remarks.
[0032] As a further improvement of the present invention, step I includes multiple message forwarding servers. Each message forwarding server is connected to the background server. The background server receives the im message sent by the message sending user and sends the im message to each message forwarding server. Then, through the message forwarding server that establishes a websocket connection with the message receiving user, the corresponding message is sent to the message receiving user.
[0033] As a further improvement of the present invention, after the user logs in successfully, the background server randomly assigns a message forwarding server to the user. After the user establishes a websocket connection with the message forwarding server, during the user's current login period, all received messages are obtained from the exchange queue of the background server through the message forwarding server that establishes a websocket connection with the user.
[0034] As a further improvement of the present invention, when a certain user is not in the login state, the background server stores all messages related to the user received in the background server database. When the user logs in again, the background server sends all messages related to the user in the background server database to the user through the message forwarding server connected to the user.
[0035] 3. Beneficial effects
[0036] Compared with the prior art, the beneficial effects of the present invention are:
[0037] (1)A method for encrypted transmission of instant messaging IM messages according to the present invention can effectively solve the problems in the prior art that the instant messaging technical route is complex, difficult to build, and the data is easily cracked during the data transmission process. It is simple to install and deploy, can provide secure data transmission technology, can not only support more than one million users to be online at the same time, but also protect the privacy of users and provide better services for users.
[0038] (2)In a method for encrypted transmission of instant messaging IM messages according to the present invention, when a user first registers and logs in, the background server will automatically generate a globally unique user identifier guid. The user identifier guid is a random string with a length of 32 bits. Using the user identifier guid as part of the user encryption string makes the encrypted string more complex and difficult to crack, which can effectively improve the security of user information, as well as the reliability and security of information transmission.
[0039] (3)In a method for encrypted transmission of instant messaging IM messages according to the present invention, when a user logs in to the user side each time, the background server will also automatically generate a random code. The random code is also a random string with a length of 32 bits. Using the random code generated each time the user logs in as part of the user encryption string can ensure that the user encryption strings for each user's login are different, greatly increasing the cracking difficulty and improving the security.
[0040] (4)A method for encrypted transmission of instant messaging IM messages according to the present invention uses RabbitMQ as the cluster manager, binds the message sending to the RabbitMQ exchange, and binds the exchange to the RabbitMQ queue, isolating the message sending from the queue, reducing the system coupling, which can greatly reduce the pressure on the background server, can support more than one million users to be online at the same time, and is mainly applied in scenarios such as mobile communication and enterprise cloud services, ensuring that the instant messaging cluster for users can be quickly built, the communication content is securely encrypted and not stolen, with strong security, and ensuring that only the sender and the receiver know the content of the communication information. Detailed implementation mode
[0041] To further understand the content of the present invention, the present invention will be further described below in conjunction with embodiments.
[0042] Embodiment 1
[0043] In view of the problems of complex instant messaging technology routes and difficult setup in the prior art, as well as the problem of being easily cracked during data transmission, this embodiment provides an encrypted transmission method for instant messaging IM messages. Its installation and deployment of instant messaging technology are simple, and it can provide secure data transmission technology. It can not only support more than one million users to use online simultaneously, but also protect the privacy of users and provide better services for users.
[0044] Specifically, an encrypted transmission method for instant messaging IM messages in this embodiment includes the following steps:
[0045] A: The user inputs an account and password to log in to the user terminal, which includes the user turning on the device. The device can be a Web page, an APP, or a small program. When logging in for the first time, the user needs to first register an account and password.
[0046] B: The background server receives the account and password input by the user terminal, and verifies whether the account and password match. If they do not match, it returns a verification failure and the login is unsuccessful. If they match, it generates a user password str1;
[0047] The generation steps of the user password str1 are as follows:
[0048] B1: The background server numbers the user IDs in the order of user registration as 1, 2, 3... n, where the user ID corresponding to the nth registered user is n;
[0049] B2: When the user registers and logs in for the first time, the background server will automatically generate a globally unique user identifier guid. The user identifier guid is a random string with a length of 32 bits. Using the user identifier guid as part of the user encryption string makes the encrypted string more complex and difficult to crack, which can effectively improve the security of user information, as well as the reliability and security of information transmission.
[0050] B3: Each time the user logs in to the user terminal, the background server will also automatically generate a random code. The random code is also a random string with a length of 32 bits. Using the random code generated each time the user logs in as part of the user encryption string can ensure that the user encryption strings for each user's login are different, greatly increasing the cracking difficulty and improving security.
[0051] B4: The user identity code str is "user ID, user identifier guid, user account, random code";
[0052] B5: Encrypt the user identification code str using symmetric encryption. After encryption, the user identification code str becomes the user password str1. Each time the user logs in to the client, a unique and independent identification password str1 is generated. That is, by performing corresponding encryption processing on user information, the security of user information can be effectively guaranteed, user information leakage can be avoided, and the reliability and security of information transmission can be effectively improved.
[0053] C: The client obtains the user password str1, logs in successfully and stores the password. At the same time, a websocket connection between the user and the message forwarding server is created.
[0054] D: The client sends an http request to obtain the user login data from the background server and places the http in the user password str1.
[0055] E: The background server receives the request from the client, obtains the user password str1, decrypts it to get the user information, and queries the relevant user information in the background server database. If it cannot be found, a failure message is returned. If the relevant user information is found, the information requested by the client is returned according to the user. Specifically, in this embodiment, symmetric decryption is used to obtain the decrypted user information. The decrypted user information is a string. By splitting the string according to commas, a string array arr is obtained. According to the first value, the second value, and the third value in the array arr, the user ID, user identifier guid, and user account are queried in the background server database respectively. If it cannot be found, a failure message is returned. If the relevant user information is found, the information requested by the client is returned according to the user.
[0056] F: The user logs in to the client and sends an im message to another user or group.
[0057] G: The background server verifies whether the user password str1 of the message sender is correct. If it is incorrect, a failure message is returned. If it is correct, an object obj is constructed. Specifically, in this embodiment, the constructed object obj includes the message sending user information, the message receiving user information, and the message content. Among them, the message sending user information includes the message sending user account, the message sending client type, and the message sending user ID; the message receiving user information includes the message receiving user ID, and the message receiving user ID is the user ID or group ID; the message content includes the message type, the message content, and relevant remarks.
[0058] H: Convert the object obj into a json string, open the RabbitMQ connection, and send the json string to the exchange of RabbitMQ.
[0059] I: Each message forwarding server retrieves the messages in the exchange queue, parses the JSON string into an object, obtains the user information of the message recipient, and then checks whether there is a connection of the message recipient user in the websocket connection list of the message forwarding server. If not, no operation is performed. If so, the JSON string is sent to the message recipient user through the message forwarding server.
[0060] Specifically, in this embodiment, there are multiple message forwarding servers, and each message forwarding server is connected to the background server. The background server receives the IM message sent by the message sending user and sends the IM message to each message forwarding server. Then, through the message forwarding server that has established a websocket connection with the message receiving user, the corresponding message is sent to the message receiving user. After the user logs in successfully, the background server randomly assigns a message forwarding server to the user. After the user establishes a websocket connection with the message forwarding server, during this login period of the user, all received messages are retrieved from the exchange queue of the background server through the message forwarding server that has established a websocket connection with the user.
[0061] When a certain user is not logged in, the background server stores all messages related to the user received in the background server database. When the user logs in again, the background server sends all messages related to the user in the background server database to the user through the message forwarding server connected to the user, which can effectively avoid message omission and effectively improve the transmission reliability of IM messages.
[0062] J: The user terminal of the message recipient user receives the message sent by the message forwarding server.
[0063] In this embodiment, RabbitMQ is used as the cluster manager. The message sending is bound to the RabbitMQ exchange, and the exchange is bound to the RabbitMQ queue, isolating the message sending from the queue, reducing the system coupling, greatly reducing the pressure on the background server, and being able to support more than one million users online at the same time. It is mainly applied in scenarios such as mobile communication and enterprise cloud services, ensuring that the rapid construction of the user instant messaging cluster can be achieved, the communication content is securely encrypted and not stolen, with strong security, ensuring that only the sender and the recipient know the content of the communication information.
[0064] The embodiments described in the present invention are only descriptions of the preferred embodiments of the present invention, and do not limit the concept and scope of the present invention. Without departing from the design idea of the present invention, various deformations and improvements made by those skilled in the art to the technical solutions of the present invention should fall within the protection scope of the present invention.
[0065] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used in conjunction with the teachings presented herein. The structure required to construct such systems will be apparent from the above description. Additionally, the present invention is not directed to any particular programming language. It should be appreciated that the teachings of the present invention can be implemented in a variety of programming languages, and the description of a particular language above is for the purpose of disclosing the best mode of the present invention.
[0066] In the specification provided herein, numerous specific details are set forth. However, it can be understood that embodiments of the present invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0067] Similarly, it should be understood that in order to streamline this disclosure and assist in understanding one or more of the various inventive aspects, in the description of the exemplary embodiments of the present invention above, the various features of the present invention are sometimes grouped together in a single embodiment or description thereof. However, the disclosed method should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, the inventive aspects lie in less than all of the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the present invention.
[0068] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and disposed in one or more devices different from those of the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all the features disclosed in this specification (including the accompanying claims, abstract) and all the processes or units of any method or device so disclosed. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract) can be replaced by an alternative feature that provides the same, equivalent, or similar purpose.
[0069] In addition, those skilled in the art will appreciate that although some of the embodiments described herein include certain features included in other embodiments but not others, the combination of features of different embodiments is meant to be within the scope of the present invention and forms different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.
[0070] It should be noted that the above embodiments are illustrative of the present invention and not restrictive thereof, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim listing several devices, several of these devices can be embodied by the same item of hardware. The use of the words first, second, and third, etc. does not denote any order. These words can be interpreted as names.
Claims
1. An encryption transmission method for instant messaging IM messages, characterized in that: It includes the following steps: A: The user inputs the account number and password to log in to the user terminal; B: The background server receives the account number and password input by the user terminal, checks whether the account number and password match. If they do not match, it returns a verification failure and the login is unsuccessful. If they match, it generates a user password str1; C: The user terminal obtains the user password str1, the login is successful and the password is stored. At the same time, a websocket connection between the user and the message forwarding server is created; D: The user terminal sends an http request to obtain the user login data from the background server and places the http in the user password str1; E: The background server receives the request from the user terminal, obtains the user password str1, decrypts it to obtain the user information, and queries the relevant user information in the background server database. If it cannot be queried, it returns a failure message. If the relevant user information is queried, it returns the information requested by the user terminal according to the user; F: The user logs in to the user terminal and sends an im message to another user or group; G: The background server verifies whether the user password str1 of the message sender is correct. If it is incorrect, it returns a failure message. If it is correct, it constructs an object obj; H: Converts the object obj into a json string, opens a connection to RabbitMQ, and sends the json string to the exchange in RabbitMQ; I: Each message forwarding server obtains the message in the exchange queue, parses the json string, obtains the user information of the message recipient, and then checks whether there is a connection of the message recipient user in the websocket connection list of the message forwarding server. If not, it does nothing. If there is, it sends the json string to the message recipient user through the message forwarding server; J: The user terminal of the message recipient user obtains the message sent by the message forwarding server.
2. The encrypted transmission method of instant messaging IM messages according to claim 1, wherein: The steps for generating the password in step B are as follows: B1: The background server numbers the user IDs in the order of user registration as 1, 2, 3... n, where the user ID corresponding to the nth registered user is n; B2: When the user first registers and logs in, the background server will automatically generate a globally unique user identifier guid; B3: Each time the user logs in to the user terminal, the background server will also automatically generate a random code; B4: The user identity code str is "user ID, user identifier guid, user account number, random code"; B5: Encrypts the user identity code str using symmetric encryption, and the encrypted user identity code str is the user password str1.
3. The encrypted transmission method of instant messaging IM messages according to claim 2, wherein: The user identifier guid is a random string with a length of 32 bits.
4. A method for encrypted transmission of instant messaging IM messages according to claim 3, characterized in that: The random code is also a random string with a length of 32 bits.
5. A method for encrypting and transmitting instant messaging IM messages according to claim 1, characterized in that: Step A includes the user turning on the device, and the device includes a Web page, an APP, or a small program. For the first login, an account number and password need to be registered first.
6. The encryption transmission method of an instant messaging IM message according to claim 1, wherein: In step E, symmetric decryption is used to obtain the decrypted user information. The decrypted user information is a string. The string is split according to commas to obtain a string array arr. According to the first value, the second value, and the third value in the array arr, the user ID, user identifier guid, and user account are queried in the background server database. If they cannot be queried, a failure message is returned. If the relevant user information is queried, the information requested by the user side is returned according to the user.
7. A method for encrypted transmission of instant messaging IM messages according to claim 6, characterized in that: In step G, the constructed object obj includes the message sending user information, the message receiving user information, and the message content. The message sending user information includes the message sending user account, the message sending user terminal type, and the message sending user ID. The message receiving user information includes the message receiving user ID, and the message receiving user ID is the user ID or the group ID. The message content includes the message type, the message content, and the relevant remarks.
8. A method for encrypted transmission of instant messaging IM messages according to any one of claims 1-7, characterized in that: Step I includes multiple message forwarding servers. Each message forwarding server is connected to the background server. The background server receives the im message sent by the message sending user and sends the im message to each message forwarding server. Then, through the message forwarding server that has established a websocket connection with the message receiving user, the corresponding message is sent to the message receiving user.
9. The encrypted transmission method of an instant messaging IM message according to claim 8, characterized in that: After the user logs in successfully, the background server randomly assigns a message forwarding server to the user. After the user establishes a websocket connection with the message forwarding server, during the user's current login period, all the messages received are obtained from the exchange queue of the background server through the message forwarding server that has established a websocket connection with the user.
10. A method for encrypted transmission of instant messaging IM messages according to claim 9, characterized in that: When a certain user is not logged in, the background server stores all the messages related to the user received in the background server database. When the user logs in again, the background server sends all the messages related to the user in the background server database to the user through the message forwarding server connected to the user.
Citation Information
Patent Citations
Login method and login system
CN104967604A
Instant messaging method and system for user mode encryption
CN106790037A