Control Method, System and Medium for Message Storage Processing and Security Authentication
By introducing the encryption and decryption mechanism of the process key and message key generated by the security authentication center in the Internet of Things communication of the MQTT protocol, the problem of data transmission and storage processing security in Internet of Things communication is solved, and the security of keys and overall data security is improved.
Patent Information
- Application Number
- CN202111492414.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-12-08
AI Technical Summary
In the prior art, the Internet of Things communication based on the MQTT protocol is insufficient in terms of data transmission and storage processing, and in particular, the security of the message encryption and decryption key cannot be guaranteed.
A control method is proposed to generate process keys through the security authentication center, and use the message key to encrypt and decrypt between the publisher client and the subscriber client, and at the same time, use the process key to perform secondary encryption on the distribution proxy side to ensure that the message remains encrypted during transmission and storage processing.
Improve the security of message keys, prevent key leakage and tampering, ensure the security of data during transmission and storage processing, and reduce the security risks of the distribution proxy.
Smart Images

Figure CN114386054B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication security technologies, and in particular to a control method, system, and medium for message storage processing and security authentication. Background Art
[0002] As a lightweight communication protocol, the MQTT protocol has the characteristics of small communication overhead and adaptability to unreliable networks, making it widely used in today's Internet of Things field. In related technologies, in the solution for data transmission based on the MQTT protocol, the current security guarantee solution for the data transmission process can ensure the security of data in both the transmission and storage processing aspects, but the security of the key for encrypting and decrypting messages cannot be guaranteed. Summary of the Invention
[0003] The present invention aims to at least solve one of the technical problems existing in the prior art. For this purpose, the present invention provides a control method, system, and medium for message storage processing and security authentication, which can improve the security of the key.
[0004] On the one hand, an embodiment of the present invention provides a control method for message storage processing and security authentication, including the following steps:
[0005] The security authentication center generates a process key according to the message key;
[0006] The publisher client encrypts the original message with the message key to obtain a first encrypted message, and transmits the first encrypted message to the distribution proxy;
[0007] The distribution proxy obtains the process key from the security authentication center, and performs secondary encryption on the first encrypted message with the process key to obtain a second encrypted message;
[0008] The subscriber client receives the second encrypted message forwarded by the distribution proxy, and decrypts the second encrypted message with the message key to obtain the original message.
[0009] In some embodiments, the security authentication center generates the message key for the topic message and manages the message key.
[0010] In some embodiments, when encrypting or decrypting the message key according to the exclusive public-private key, the publisher client generates and manages the message key of the topic message at the publisher client, and the security authentication center generates the message key of the topic message at the subscriber client.
[0011] In some embodiments, both the message key and the process key are symmetric keys; the exclusive public-private key is an asymmetric key.
[0012] In some embodiments, the first encrypted message includes a message encrypted by a message key and a message key encrypted by an exclusive public key; the second encrypted message includes a message encrypted by a process key and a message key of a subscriber client.
[0013] In some embodiments, the distribution agent requests a process key from the security authentication center through client information and a message key encrypted by an exclusive public key, where the client information includes subscriber client information and publisher client information.
[0014] In some embodiments, before generating the process key, the security authentication center decrypts the message key encrypted by the exclusive public key sent by the distribution agent through an exclusive private key to obtain the message key of the publisher client, randomly generates the message key of the subscriber client according to the message key of the publisher client, and encrypts the message key of the subscriber client through the exclusive private key.
[0015] In some embodiments, the subscriber client decrypts the message key encrypted by the exclusive private key through the exclusive public key, and decrypts the message encrypted by the process key in the second encrypted message through the decrypted message key to obtain the original message.
[0016] On the other hand, an embodiment of the present invention provides a control system for message storage processing and security authentication, including:
[0017] A security authentication center for generating a process key according to a message key;
[0018] A publisher client for encrypting an original message with the message key to obtain a first encrypted message and transmitting the first encrypted message to a distribution agent;
[0019] A distribution agent for obtaining the process key from the security authentication center and re-encrypting the first encrypted message with the process key to obtain a second encrypted message;
[0020] A subscriber client for receiving the second encrypted message forwarded by the distribution agent and decrypting the second encrypted message with the message key to obtain the original message.
[0021] On the other hand, an embodiment of the present invention provides a storage medium in which a computer-executable program is stored, and when the computer-executable program is executed by a processor, it is used to implement the control method for message storage processing and security authentication described above.
[0022] The control method for message storage processing and security authentication provided by the embodiment of the present invention has the following beneficial effects:
[0023] In this embodiment, the publisher client encrypts the original message using a message key, and the subscriber client decrypts it using the message key, so that the original message is in an encrypted state during the transmission process, thereby improving the security of the original message. Moreover, the security authentication center generates a process key based on the message key. After the distribution agent obtains the process key from the security authentication center, the distribution agent uses the process key to perform secondary encryption on the first encrypted message, so that when the distribution agent only knows the process key, it cannot deduce the message key, thereby solving the security problem when the message is processed in plain text at the agent side and improving the key security.
[0024] Additional aspects and advantages of the present invention will be given in part in the following description, will become apparent in part from the following description, or will be understood through the practice of the present invention. Brief Description of the Drawings
[0025] The present invention will be further described below in conjunction with the drawings and embodiments, where:
[0026] Figure 1 It is a schematic diagram of the positional relationship of an SSL / TLS protocol solution in a network model for an embodiment;
[0027] Figure 2 It is an interaction schematic diagram of the distribution agent, security authentication center, publisher client, and subscriber client of the embodiment of the present invention;
[0028] Figure 3 It is a flowchart of a control method for message storage processing and security authentication of an embodiment of the present invention. Detailed Embodiments
[0029] The embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention.
[0030] In the description of the present invention, it should be understood that for the orientation description, such as up, down, front, back, left, right, etc., the orientation or positional relationship indicated is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation of the present invention.
[0031] In the description of the present invention, "several" means more than one, "multiple" means more than two, and terms such as "greater than", "less than", "exceeding", etc. are understood not to include the corresponding number, while terms such as "above", "below", "within", etc. are understood to include the corresponding number. If there is a description of "first" and "second", it is only for the purpose of distinguishing technical features and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or the sequence relationship of the indicated technical features.
[0032] In the description of the present invention, unless otherwise clearly defined, terms such as "set", "installed", "connected", etc. should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific content of the technical solution.
[0033] In the description of the present invention, the descriptions with reference to terms such as "one embodiment", "some embodiments", "schematic embodiments", "examples", "specific examples", or "some examples" mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic descriptions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.
[0034] In the related art, as a lightweight communication protocol, the MQTT protocol has the characteristics of small communication overhead and adaptability to unreliable networks, making it widely used in today's Internet of Things field. However, since the MQTT protocol was initially designed in a private network environment, more attention was paid to the lightweightness of message publishing and distribution rather than the security in some message processing or transmission processes. Except for the method of authentication by username and password, there are no other security measures. With the rapid development of the Internet of Things field today, as the number of users increases, corresponding security risks and problems are becoming increasingly prominent.
[0035] In the investigation and analysis of the current situation of Internet of Things communication based on the MQTT protocol, it is found that under the public network conditions, a total of 78,829 proxy terminals use the MQTT protocol for communication. Among them, the servers using port 1883 (the default communication port of the MQTT protocol, without using SSL / TLS for security authentication) account for 99.69%, that is, the vast majority of MQTT servers in the current public network environment do not perform relevant security encryption measures on the communication process. The results of many research practices show that more than 60% of the servers do not perform username and password verification on the client, and the vast majority of proxy terminals can use any client to subscribe to all topics and receive corresponding plaintext pushes.
[0036] This also practically indicates that the current communication status based on the MQTT protocol is not optimistic. The focus of the embodiments of the present invention lies in the security of data in both the transmission and storage processing aspects. Therefore, the embodiments of the present invention do not consider analyzing some solutions that focus on topic permission control or solutions that focus on the performance of encryption and decryption algorithms. Among the solutions that focus on ensuring the security of data in the transmission aspect, the relatively common ones are the SSL / TLS protocol solution and the emerging AugPAKE protocol solution. However, since the AugPAKE solution is a simplified version of the SSL / TLS solution, it actually places the authentication step of the SSL / TLS solution offline: the client and the proxy need to perform authentication offline to ensure security, which is not applicable to scenarios with a large number of clients. And the subsequent online execution process is similar to the SSL / TLS solution. Essentially, both are to negotiate the symmetric key used to ensure the security of data transmission in the future. Therefore, it is unnecessary to analyze these two solutions repeatedly.
[0037] The following analyzes the SSL / TLS protocol solution, summarizes its deficiencies under the research focus of this patent, and then introduces the specific content of the embodiments of the present invention.
[0038] As Figure 1 shown, the SSL / TLS protocol solution is located between the application layer and the TCP / IP layer. In the Figure 1 network model shown, the SSL / TLS protocol solution is mainly used to ensure the security of communication based on the TCP protocol. The basic encryption idea adopts a combination of asymmetric encryption and symmetric encryption. Its encrypted communication process is as follows:
[0039] Step 1: The client sends a request to the server to obtain the server's public key;
[0040] Step 2: The two parties negotiate the session key used for this session. This key belongs to the symmetric key;
[0041] Step 3: In the subsequent stage of this session, both parties communicate using the negotiated session key.
[0042] The first two steps of the communication are also called the handshake process, which is also the most core part of the SSL / TLS protocol. It includes a series of negotiations of encryption-related information and the determination of security parameters used for subsequent encryption.
[0043] Specifically, when the client requests encrypted communication for the first time, it sends a ClientHello request to the server, which mainly includes several fields: VersionNumber (the highest version of the TLS protocol currently supported), Randomly Generated Data (which will be used later to generate the session key), Cipher Suite (the encryption suites supported by the client), etc.;
[0044] After receiving the client's ClientHello request, the server needs to send a response to the client. The three most important fields are: ServerHello, ServerCertificate, and ServerHelloDone. The fields contained in ServerHello correspond one by one to the fields in the ClientHello request sent by the client; ServerCertificate is the certificate provided by the server to the client for authenticating its own identity. This certificate is used to prove the legitimacy of the server and transfer the public key. Finally, ServerHelloDone indicates that the server's response is complete and waits for the client's subsequent response;
[0045] After receiving the server's response, the client first authenticates the legitimacy of the server's certificate. After the authentication of the server's certificate is passed, the information sent by the client to the server mainly includes: the encrypted last random number PreMasterKey, ChangeCipherSpec, and ClientFinished. ChangeCipherSpec indicates that the previously negotiated encryption suite will be used for subsequent communication encryption. ClientFinished indicates the end of the client's handshake. This item is also the Hash value of all the content sent previously and is used for the server to perform verification;
[0046] After receiving the response sent by the client, the server first decrypts the last random number PreMasterKey using the corresponding private key, then calculates the symmetric key to be used for the subsequent session in combination with the two random numbers in the previous communication process, and finally sends the following information to the client: ChangeCipherSpecMessage and ServerFinishedMessage. The former is used to notify the client that the previously negotiated symmetric key and encryption algorithm will be used for communication subsequently, and the latter indicates that the entire session is hashed to obtain a Hash value for client authentication. After the client authentication is successful, subsequent encrypted communication will be carried out using the negotiated symmetric key.
[0047] From the above process, we can see that the SSL / TLS protocol negotiates the symmetric key used for subsequent data encryption through an additional handshake process, thereby solving the security problem of data transmission. However, the solution based on the SSL / TLS protocol still has the following problems: First, it does not solve the security problems that may exist when storing and processing messages on the proxy side. For example, as more and more message brokers are deployed to the cloud, if the message broker is hacked, since the messages are stored in plain text on the proxy side, a large number of plain text messages are likely to be leaked and tampered with; second, the SSL / TLS protocol adds an additional handshake process to negotiate the subsequent symmetric key, that is, it adds two additional round trips for information. In the case of relatively congested network conditions, it may cause a burden for IoT communications that pursue light and fast, especially for clients in communication.
[0048] In order to ensure the security of both transmission and storage processing, especially to ensure the security of data storage processing on the proxy side, the most basic requirement is to ensure that the data is still encrypted when it is distributed and processed on the proxy side. Then, on the existing basis, the publisher client encrypts the original message part before publishing the message on a certain topic. In this way, as long as the encryption algorithm is selected appropriately and the key is not leaked, it can be ensured that the message remains encrypted during transmission and storage processing without exposing the original message content. And after the message broker forwards the message to the corresponding subscriber client, the subscriber client can use the corresponding publisher's key to decrypt the ciphertext to obtain the original message.
[0049] However, assume that symmetric encryption is adopted, that is, the key k exists in the hands of multiple clients, which increases the risk of key leakage. As long as a certain client is invaded and the key k is obtained, and coupled with the invasion of a certain distribution agent, all subsequent message encryptions will be in vain. The attacker can decrypt all the messages received by the distribution agent and tamper with and forward them at will. Assume that the subscriber client itself may be disguised by an attacker, then this attacker can directly obtain the key k. Further, after the distribution agent is invaded, the encrypted messages can be easily decrypted by the attacker. Adopting the method of asymmetric encryption can solve the problem of easy key leakage faced by symmetric encryption above. Assume that each client itself has a pair of public and private keys: pubKey, privKey. Then when the publisher needs to publish a message, it only needs to encrypt the original message with the public key of the subscriber client. After the subscriber client receives the encrypted message forwarded by the distribution agent, it can decrypt it with its own private key to obtain the original message. Even if a certain client is invaded and its own private key is leaked, even if the distribution agent is invaded subsequently, the attacker can only decrypt the messages forwarded to the invaded client, because the public and private keys of each client are independent. However, this solution also has defects: First, from the MQTT protocol communication model, it can be seen that the publisher itself does not know the information of the subscriber clients on a certain topic, so it cannot know which subscriber clients the published message will be forwarded to by the distribution agent, and the publisher does not know which subscriber client's public key to use to encrypt the message; Second, assume that the original MQTT protocol is modified so that the publisher can know the information of the subscriber clients existing on the topic where the message is to be published currently. However, since there may be multiple subscriber clients, and the publisher client can only use the public key of one subscriber client to encrypt the original message at a single time when publishing a message. Since the public key information of the subscriber clients is independent and irrelevant, this solution cannot meet the requirements when there are multiple subscriber clients; Third, assume that the original MQTT protocol is modified in some way so that the publisher client can transmit a combination of multiple messages encrypted with different subscriber public keys at a single time, and the distribution agent can correctly split the encrypted messages belonging to different subscriber clients in the message and forward them to different subscriber clients. Then when the number of subscriber clients on a certain topic is very large, the length of the PUBLISH message published by the publisher client will be very long, and the client needs to store a large amount of public keys and other information of the subscribers when acting as the publisher. In the actual scenario, the client is often a terminal device with limited hardware resources such as memory and CPU, and this solution is difficult to bear for these terminal devices.
[0050] In summary, although the above-mentioned solution can ensure the security of data in both transmission and storage processing, the security of the key used to encrypt and decrypt messages cannot be guaranteed, and it is impossible to effectively manage the key when there are a large number of clients.
[0051] Based on this, the embodiments of the present invention provide a control method, system, and medium for message storage processing and security authentication. In this embodiment, by separating the security authentication of the MQTT protocol from the message storage processing, the message broker with the message storage processing function can be distributedly deployed in the cloud, denoted as the distribution agent, while the part with the message security authentication function is separately deployed, denoted as the security authentication center. Specifically, the interaction process among the distribution agent, the security authentication center, the publisher client, and the subscriber client is as Figure 2 shown. In Figure 2 the interaction system shown, as Figure 3 shown, the embodiments of the present invention provide a control method for message storage processing and security authentication, including the following steps:
[0052] S31. The security authentication center generates a process key according to the message key.
[0053] In this embodiment, the security authentication center can be a trusted third-party institution, which is used to handle the following two items:
[0054] First, according to the request of the distribution agent, use the message keys of the relevant publisher client and subscriber client to generate a process key, so that the distribution agent can use the process key to perform secondary encryption processing on the message ciphertext;
[0055] Second, use the generated exclusive public and private keys to encrypt and decrypt the message keys of the clients. By using the process key, it can solve the problem that when the message is stored and processed in plain text at the distribution agent side, a large amount of message leakage and tampering may occur due to the untrustworthiness of the distribution agent side. At the same time, by using the exclusive public and private keys, it can improve the security and management problems of the message keys when there are a large number of clients.
[0056] S32. The publisher client encrypts the original message with the message key to obtain a first encrypted message, and transmits the first encrypted message to the distribution agent.
[0057] In this embodiment, before the publisher client publishes a message to the distribution agent, it encrypts the original message with the message key. Since the message is already in an encrypted state before transmission, on the premise that the message key is not leaked, it is difficult for an attacker to obtain the original text of the message, and there is no need to add an additional handshake process like the SSL / TLS solution to negotiate the subsequent symmetric key.
[0058] S33. The distribution agent obtains the process key from the security authentication center, and uses the process key to perform secondary encryption on the first encrypted message to obtain a second encrypted message.
[0059] In this embodiment, the distribution agent also needs to communicate with the security authentication center to obtain the process key for secondary encryption of the message transmitted by the publisher. Each time it forwards a message to a subscriber, the distribution agent uses the obtained process key to perform secondary encryption on the message ciphertext transmitted by the publisher client to obtain a new ciphertext, and then forwards the processed result to the subscriber client. On the premise of only knowing the process key, the distribution agent cannot deduce the message key of the publisher or subscriber client, which solves the problem when the message is stored and processed in plain text at the agent side.
[0060] S34. The subscriber client receives the second encrypted message forwarded by the distribution agent, and uses the message key to decrypt the second encrypted message to obtain the original message.
[0061] In this embodiment, the subscriber client is the client that receives messages on the subscribed topic. In this solution, after receiving the ciphertext double-encrypted by the distribution agent, the subscriber client will decrypt the ciphertext with its own message key to obtain the original message. Similar to the publisher client, before the distribution agent forwards the data, the message is still in an encrypted state. On the premise that the message key is not leaked, it is difficult for an attacker to obtain the original message.
[0062] In the implementation of the present invention, the following three types of keys are mainly used:
[0063] First, the message key. The message key belongs to a symmetric key and is used by the publisher client and the subscriber client to encrypt or decrypt messages. Before publishing a message, the publisher client will use its message key to encrypt the original message, and the subscriber client will finally use its message key to decrypt the encrypted message. It should be noted that when exclusive public and private keys are not used, the message key is generated and controlled by the security authentication center, and there is no encrypted message key when the publisher client sends a message or the distribution agent forwards a message; when exclusive public and private keys are used, the message key of the publisher client will be generated by the publisher client, and the message key of the subscriber client will be generated by the security authentication center. Among them, the first encrypted message includes the message encrypted by the message key and the message key encrypted by the exclusive public key; the second encrypted message includes the message encrypted by the process key and the message key of the subscriber client. It can be seen that since the message has been encrypted before transmission and forwarding, there is no need to perform an additional handshake process like the SSL / TLS solution to negotiate the subsequent symmetric key, thus solving the overhead problem that may be caused by the additional network round-trip of the SSL / TLS solution.
[0064] Second, the process key. The process key belongs to the symmetric key, which is generated by the security authentication center using the message keys of the relevant publisher client and subscriber client and delivered to the distribution agent for use. It is used to perform secondary encryption on the ciphertext message transmitted by the publisher client. The encrypted data is still a ciphertext message, and finally, the subscriber client can directly decrypt it using its message key to obtain the original message. Moreover, the distribution agent cannot reverse-derive the message keys of the publisher or subscriber client only from the process key. The process key is to solve the problem that messages are stored and processed in plain text at the proxy end in the SSL / TLS solution.
[0065] Third, the exclusive public-private key. It belongs to the asymmetric key and is generated by the publisher client, subscriber client, and security authentication center. It is used to encrypt and decrypt the message keys used by the publisher client and subscriber client. The exclusive public-private key is mainly used to solve the problems of message key management and the security of message keys in the case of a large number of clients in a solution without security authentication.
[0066] In this embodiment, the process key procKeysrc-dest-T is jointly generated by the message keys encKeysrc and encKeydest of the publisher client and subscriber client, and is only used by the distribution agent to perform secondary encryption on the message ciphertext transmitted by the publisher. The encrypted ciphertext can be decrypted by the subscriber client to obtain the original message content. The message key is determined jointly by the publisher client, subscriber client, and topic, and varies with different clients or topics.
[0067] Taking XOR encryption as an example, assume that the message key of the publisher client is "00011010" and the message key of the subscriber client is "00000100". Then the generated process key is the result of XORing the two message keys: "00011110". Assume that the original message to be encrypted is "abc". Then the ciphertext generated by the publisher client after encrypting it with its message key is: "{xy". The result of the distribution agent using the process key to perform secondary encryption on this ciphertext is: "efg". The subscriber client uses its message key to decrypt the ciphertext after secondary encryption, and finally obtains the message original text: "abc".
[0068] The publisher client encrypts the message to be published using the message key and sends the ciphertext to a node in the distribution agent cluster. The subscriber client directly decrypts the received forwarded message using the message key to obtain the original message content. Different from the client using the message key to encrypt and decrypt data, the distribution agent re-encrypts the ciphertext generated by encrypting the message key plaintext using the process key, and also needs to ensure that the result after the second encryption can be directly decrypted by the subscriber client to obtain the original message. At the same time, it also needs to ensure that the distribution agent cannot deduce the plaintext only through the process key. General encryption and decryption keys and corresponding algorithms cannot meet the above conditions, so there are certain restrictions and requirements for the generation and encryption of the process key. Specifically, for the application of the process key, it has the following advantages:
[0069] As can be seen from the above application of the process key, the data is secure in both the transmission and storage processing aspects, and there is no need to negotiate the subsequent symmetric key for encryption through an additional handshake process like the SSL / TLS scheme, and the client does not need to manage a large number of keys. It can be specifically understood as the following points: First, the data is encrypted during the transmission process, and the plaintext and ciphertext can only be encrypted and decrypted through the relevant encryption and decryption message keys. On the premise that the message key is not leaked, the security of data transmission is guaranteed, and there is no need to add an additional handshake process to negotiate the key like the SSL / TLS scheme; Second, the distribution agent can only perform secondary encryption processing on the received ciphertext message and cannot independently deduce the key information for decrypting the ciphertext, so it cannot decrypt the original message, which ensures the security of the message in the storage processing aspect; Third, for any topic T, the encryption and decryption keys of different clients for this topic are independent and different, which also ensures that even if a certain client and the distribution agent are invaded at the same time, it is impossible to leak and tamper with all the messages passing through the distribution agent on a large scale, thus ensuring the security of the data; Fourth, when each client needs to publish or decrypt a message on a certain topic, the key used is generated and managed by the authentication center, which solves the problem of client key management mentioned above. Finally, the subscriber client can decrypt the secondarily encrypted message to obtain the original message after receiving it, which ensures the integrity of the entire publishing and forwarding process.
[0070] In this embodiment, after secondary encryption using the process key, problems such as a large number of plaintext message leaks and tampering that may exist when the distribution agent is untrusted can be solved. However, there are still two problems: the first is the problem of message key management and control by the security authentication center, and the second is the security problem of the message key. Specifically, the number of message keys that the security authentication center needs to manage and control is proportional to the number of publisher clients and subscriber clients. When the number of publisher clients and subscriber clients is large, the management and control of a large number of message keys will bring an additional burden to the security authentication center. Further, it may cause a large delay in the network communication between the publisher client, subscriber client, distribution agent, and security authentication center, and ultimately lead to the lag or even paralysis of the message publishing and distribution process. The security problem of the message key cannot be ignored either. If the form of the client requesting the message key and the security authentication center generating and returning the message key is adopted, then the security of the message key in transmission cannot be guaranteed. After intercepting the message key, the attacker can skip the process key and easily obtain or tamper with the information that the publisher wants to publish, which will have a serious impact on the normal publishing and distribution process.
[0071] Therefore, to solve the above problems, in this embodiment, the number of message keys k*l*n that the security authentication center needs to generate and manage and control is made independent of the publisher, and the security of the message key is guaranteed. On the basis of applying the process key, an exclusive public-private key is used to encrypt and decrypt the message key. After introducing the exclusive public-private key, the processing content is also different:
[0072] The client has its own public-private key, which is used to generate an exclusive public key for encrypting and decrypting the encrypted message key;
[0073] The message key of the publisher client is generated and managed by itself, while the message key of the subscriber client is generated by the security authentication center;
[0074] The security authentication center manages and controls the public-private key at the granularity of the topic, and this public-private key is used to generate an exclusive private key for encrypting and decrypting the message key.
[0075] For Figure 2 each terminal in the interactive system shown, some changes also occur during operation:
[0076] The publisher client no longer requests the message key from the authentication center but generates it by itself. The data sent to the distribution agent is divided into two parts: the message encrypted by the message key and the message key encrypted by the exclusive public key;
[0077] When the distribution agent requests a process key, it not only needs to carry the corresponding client information but also the encrypted message key sent by the publisher. When forwarding data to the subscriber client, it not only needs to forward the doubly encrypted ciphertext but also the message key of the subscriber client returned by the security authentication center;
[0078] Before generating the process key, the security authentication center first needs to decrypt the encrypted message key transmitted by the distribution agent using its exclusive private key to obtain the publisher's message key. Then, it randomly generates the message key of the subscriber client and generates the process key according to the aforementioned requirements. After that, it encrypts the message key of the subscriber client using the relevant exclusive private key to prevent the distribution agent from obtaining the unencrypted message key. Finally, it returns the generated process key and the encrypted subscriber client key to the distribution agent;
[0079] The message key used by the subscriber client to decrypt the message ciphertext is included in the data forwarded by the distribution agent. The subscriber client first decrypts the message key using its exclusive public key and then decrypts the ciphertext with the message key to obtain the original message.
[0080] In this embodiment, when using exclusive public and private keys, for the publisher client, the exclusive public key is used to encrypt the message key; for the subscriber client, the exclusive private key is used to decrypt the message key. Among them, the security authentication center uses the exclusive private key of the publisher client to decrypt the publisher's message key and uses the exclusive public key of the subscriber client to encrypt the message key of the subscriber client. Specifically, at the publisher client, a new exclusive public key pubKeysrc-T is generated by using the private key privKeysrc of the publisher client and the public key pubbKeyT of the corresponding topic. This exclusive public key is used to encrypt the message key for encrypting the message by the publisher client. When the authentication center generates the process key, it uses the public key pubKeysrc of the publisher client and the private key privKeyT of the corresponding topic to generate the exclusive private key corresponding to the exclusive public key of the publisher client, thereby decrypting the encrypted message key of the publisher client.
[0081] Next, the security of the optimized embodiment of the present invention will be analyzed according to the communication processes of each part.
[0082] First, the communication between the publisher client and the distribution agent:
[0083] The communication process between the publisher client and the distribution agent is unidirectional, that is, from the publisher client to the distribution agent. The security of this communication process will be analyzed under various attack modes.
[0084] Eavesdropping attack: Since the message key is randomly generated by the publisher client, the attacker cannot steal the encryption key. During the transmission process, both the key and the message are encrypted. The attacker can only obtain the encrypted message and the message key, and cannot get the plaintext of the message, so they cannot eavesdrop on or leak the corresponding message. This ensures the security of data during transmission.
[0085] Man-in-the-middle attack: After the corresponding ciphertext and the encrypted message key are generated, the relevant packets will be sent to the distribution agent. On the premise that the message key is not leaked, if the man-in-the-middle wants to launch an attack, they need to decrypt the message key first, which requires two conditions: 1) Steal or crack the private key of the publisher; 2) Generate the corresponding exclusive public key through the exclusive public-private key generation algorithm. It can be seen that under normal circumstances, these two points are difficult for the attacker to obtain, so it is difficult for the man-in-the-middle to launch an attack.
[0086] The distribution agent is untrusted: Suppose a certain node in the distribution agent cluster is successfully invaded by the attacker through some means. Since the messages transmitted by the publisher to the distribution agent are encrypted: the message body is encrypted by a randomly generated message key, and this message key will be encrypted by the exclusive public key. The data encrypted by the exclusive public key can only be decrypted by the corresponding exclusive private key, and the corresponding exclusive private key can only be calculated and deduced by the certification center. Therefore, even if the attacker successfully invades a certain distribution agent node, they cannot obtain the plaintext content of the relevant messages. This solves the problem of a large number of plaintext messages being leaked and tampered with when the distribution agent is untrusted, thus ensuring the security of data in storage and processing.
[0087] Second, the communication between the distribution agent and the certification center:
[0088] The communication between the distribution agent and the authentication center is two-way. The main processes between them are the request and response processes of the process key. Since there are no hardware limitations of the client in the Internet of Things environment, such as memory and computing power limitations, between the distribution agent and the authentication center, the communication between them can be completely solved by the existing solution, that is, the SSL / TLS protocol solution. Due to the use of the SSL / TLS protocol solution, a series of attack means such as eavesdropping attacks and man-in-the-middle attacks will not take effect. In addition, even if the distribution agent is invaded, since the data transmitted during the entire communication process is encrypted, the attacker can only obtain the process key returned by the authentication center and the encrypted message key of the subscriber client: for the process key, the publisher cannot separately deduce the encryption key of the publisher or the subscriber client through the process key, so the attacker cannot decrypt the original message through the process key. For the encrypted message key of the subscriber client, decrypting it requires first obtaining the exclusive public key generated by the subscriber client, and this process requires the use of the private key of the subscriber client, but the private key of the subscriber client is unique to it, which ensures the security of data storage and processing.
[0089] Third, the communication between the distribution agent and the subscriber client:
[0090] The communication between the distribution agent and the subscriber client is also one-way. The distribution agent forwards and pushes the ciphertext and the encrypted message key to the corresponding subscriber client.
[0091] The following analyzes the security of this communication process:
[0092] Eavesdropping attack: During the transmission process, both the message key and the corresponding ciphertext are in an encrypted state. The attacker cannot separately deduce the corresponding plaintext from the ciphertext, but can only indirectly obtain the plaintext content by cracking the encryption key. The message key is encrypted by the relevant exclusive private key, and only the subscriber client can calculate and deduce the corresponding exclusive public key. Therefore, the attacker cannot obtain the original plaintext message content, which ensures the security of data during transmission.
[0093] Man-in-the-middle attack: Similar to the communication process from the publisher to the distribution agent, in the case where the message key is not leaked, the man-in-the-middle needs to meet two conditions to carry out the attack: 1) Steal or crack the private key of the publisher; 2) Generate the corresponding exclusive public key through the exclusive public key generation algorithm. These two points are difficult for the attacker to meet, so it is difficult for the man-in-the-middle to carry out the attack.
[0094] The distribution agent is not trustworthy: Similar to the publisher, assume that a certain node in the distribution agent cluster is successfully invaded by an attacker through some means. Since the data that the distribution agent is about to forward to the subscriber client is in an encrypted state: the message content is double-encrypted by the process key, and the message key of the subscriber client is encrypted by the exclusive private key. The data encrypted by the exclusive private key can only be decrypted by the corresponding exclusive public key, and the corresponding exclusive public key can only be calculated and deduced by the subscriber client. Therefore, even if the attacker successfully invades a certain distribution agent node, it cannot obtain the plaintext content of the relevant message, which solves the problem of a large number of plaintext messages being leaked and tampered with that may occur when the distribution agent is not trustworthy, thus ensuring the security of data in storage and processing.
[0095] In summary, the message storage and security authentication separation scheme proposed in the embodiments of the present invention is theoretically both secure and effective, and improves the security and control problems of the message key. At the same time, the MQTT protocol adopted has better overall performance than the MQTT protocol using SSL / TLS. Compared with the original MQTT protocol, the MQTT protocol based on this improved scheme achieves a better compromise between performance indicators and data security.
[0096] The embodiments of the present invention provide a control system for message storage processing and security authentication, including:
[0097] A security authentication center for generating a process key according to the message key;
[0098] A publisher client for encrypting the original message with the message key to obtain a first encrypted message and transmitting the first encrypted message to the distribution agent;
[0099] A distribution agent for obtaining the process key from the security authentication center and double-encrypting the first encrypted message with the process key to obtain a second encrypted message;
[0100] A subscriber client for receiving the second encrypted message forwarded by the distribution agent and decrypting the second encrypted message with the message key to obtain the original message.
[0101] The content of the method embodiments of the present invention is applicable to the system embodiments. The functions specifically implemented by the system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above methods.
[0102] The embodiments of the present invention provide a storage medium in which a computer-executable program is stored. When the computer-executable program is executed by a processor, it is used to implement as Figure 3The control method for message storage processing and security authentication as shown.
[0103] An embodiment of the present invention also discloses a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 3 The control method for message storage processing and security authentication as shown.
[0104] The embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the knowledge scope of those of ordinary skill in the art to which the present invention pertains, various changes can be made without departing from the gist of the present invention. In addition, without conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
Claims
1. A control method for message storage processing and security authentication, characterized in that, It includes the following steps: The security authentication center generates a process key based on the message key; The publisher client encrypts the original message using the message key to obtain a first encrypted message, and transmits the first encrypted message to the distribution proxy; The distribution proxy obtains the process key from the security authentication center, and performs secondary encryption on the first encrypted message using the process key to obtain a second encrypted message; The subscriber client receives the second encrypted message forwarded by the distribution proxy, and decrypts the second encrypted message using the message key to obtain the original message; Wherein, the first encrypted message includes a message encrypted by the message key and the message key encrypted by the exclusive public key; the second encrypted message includes a message encrypted by the process key and the message key of the subscriber client encrypted; The distribution proxy requests the process key from the security authentication center through the client information and the message key encrypted by the exclusive public key, and the client information includes the subscriber client information and the publisher client information; according to the request of the distribution proxy, the process key is generated using the message keys of the relevant publisher client and subscriber client; Before generating the process key, the security authentication center decrypts the message key encrypted by the exclusive public key sent by the distribution proxy using the exclusive private key to obtain the message key of the publisher client, randomly generates the message key of the subscriber client according to the message key of the publisher client, and encrypts the message key of the subscriber client using the exclusive private key; The subscriber client decrypts the message key encrypted by the exclusive private key using the exclusive public key, and decrypts the message encrypted by the process key in the second encrypted message using the decrypted message key to obtain the original message.
2. The control method for message storage processing and security authentication according to claim 1, characterized in that, The security authentication center generates the message key of the topic message and controls the message key.
3. The control method for message storage processing and security authentication according to claim 1, characterized in that, When encrypting or decrypting the message key according to the exclusive public and private keys, the publisher client generates and manages the message key of the topic message in the publisher client, and the security authentication center generates the message key of the topic message in the subscriber client.
4. The control method for message storage processing and security authentication according to claim 3, characterized in that, Both the message key and the process key are symmetric keys; the exclusive public and private keys are asymmetric keys.
5. A control system for message storage processing and security authentication, characterized in that, It includes: A security authentication center for generating a process key based on the message key; A publisher client for encrypting the original message using the message key to obtain a first encrypted message and transmitting the first encrypted message to the distribution proxy; A distribution proxy for obtaining the process key from the security authentication center and performing secondary encryption on the first encrypted message using the process key to obtain a second encrypted message; A subscriber client for receiving the second encrypted message forwarded by the distribution proxy and decrypting the second encrypted message using the message key to obtain the original message; Wherein, the first encrypted message includes a message encrypted by the message key and the message key encrypted by the exclusive public key; the second encrypted message includes a message encrypted by the process key and the message key of the subscriber client encrypted; The distribution agent requests a process key from the security authentication center through the client information and the message key encrypted by the exclusive public key. The client information includes subscriber client information and publisher client information; according to the request of the distribution agent, a process key is generated using the message keys of the relevant publisher client and subscriber client. Before generating the process key, the security authentication center decrypts the message key encrypted by the exclusive public key sent by the distribution agent using the exclusive private key to obtain the message key of the publisher client, randomly generates the message key of the subscriber client according to the message key of the publisher client, and encrypts the message key of the subscriber client using the exclusive private key. The subscriber client decrypts the message key encrypted by the exclusive private key using the exclusive public key, and decrypts the message encrypted with the process key in the second encrypted message using the decrypted message key to obtain the original message.
6. A storage medium, characterized in that, A computer-executable program is stored therein, and when the computer-executable program is executed by a processor, it is used to implement the control method for message storage processing and security authentication according to any one of claims 1-4.
Citation Information
Patent Citations
Quantum encryption system for special type emergency ad-hoc network communication
CN108377188A
Devices and methods for enabling portable secure communication using random cipher pad cryptography
CN109564614A