End-to-end secure communication encryption method and system

By dynamically creating and updating encryption keys in memory, the problem of easy stolen fixed keys in the existing technology is solved, achieving lower risk of leakage and less operation and maintenance burden.

CN119854015AActive Publication Date: 2025-04-18BEIJING HUIYUAN JIXIANG TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510043898.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-04-18
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

In the prior art, end-to-end encryption keys are fixed and easily stolen, resulting in the risk of false requests and forging real transactions, and frequent replacement of keys increases workload.

Method used

By dynamically creating and updating encryption keys in memory, they are stored only in memory, and the keys are replaced every time the packets interact, avoiding the keys being stored at any end.

Benefits of technology

Reduces the risk of secret key leakage, quickly cuts off illegal request links, reduces the burden on operation and maintenance personnel, and avoids the risk of memory overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854015A_ABST
    Figure CN119854015A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an end-to-end secure communication encryption method and system. The method comprises the following steps that: a first service acquires a random key which changes along with time, creates a new encrypted key in a memory as an exchange key to be added into a request message, encrypts the request message by using the random key, and sends the encrypted request message to a second service of a link opposite end; and the second service obtains a random key according to a timestamp, decrypts the encrypted request message by using the random key, creates a new encrypted key in a memory as an exchange key, adds the exchange key to a response message, and sends the response message to the second service. Encrypting the response message by using an exchange key created by the first service last time and then sending the encrypted response message to the first service; and the first service decrypts the encrypted response message by using the last created exchange key, and decides to use or clear the last created exchange key of the second service according to whether the second service needs to continue to be requested.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of secure communication technology, and in particular to an end-to-end secure communication encryption method and system. Background Art

[0002] In the prior art, whether it is front-end to back-end or back-end to back-end, all end-to-end encryption keys are fixed. Regardless of whether it is symmetric encryption or asymmetric encryption, once the key is stolen, the message can be modified and re-encrypted using the stolen key, achieving the purpose of using false requests to forge real transactions. As long as the key is leaked, there will be a very high risk. In order to deal with this risk, it is usually necessary to frequently change the key, resulting in a huge workload at all ends. Summary of the invention

[0003] The embodiments of the present invention provide an end-to-end secure communication encryption method and system, which solve the above technical problems.

[0004] In a first aspect, an embodiment of the present invention provides an end-to-end secure communication encryption method, comprising:

[0005] The first service that initiates the first request of the link obtains a random key that changes with time, and creates a new encryption key in the memory as its own exchange key, adds the exchange key to the request message, and uses the random key to encrypt the request message and send it to the second service at the other end of the link;

[0006] After receiving the encrypted request message, the second service obtains the random key according to the timestamp, decrypts the encrypted request message using the random key, completes the service processing, and obtains the exchange key created by the first service last time;

[0007] The second service creates a new encryption key in the memory as its own exchange key, adds the exchange key to the response message, and encrypts the response message using the exchange key created by the first service last time and sends it to the first service;

[0008] The first service decrypts the encrypted response message using the exchange key created last time, completes the service processing, and obtains the exchange key created last time by the second service;

[0009] The first service decides, based on whether it needs to continue requesting the second service, to use the exchange key created last by the second service to continue encrypting new request messages, or to clear the exchange key created last by the second service.

[0010] In a second aspect, an embodiment of the present invention provides an end-to-end secure communication encryption system, comprising: an electronic device deployed by a first service that initiates a first request for a link, and an electronic device deployed by a second service at the other end of the link; wherein,

[0011] The first service is used to obtain a random key that changes over time, and at the same time create a new encryption key in the memory as its own exchange key, add the exchange key to the request message, and use the random key to encrypt the request message and send it to the second service at the other end of the link;

[0012] After receiving the encrypted request message, the second service is used to obtain the random key according to the timestamp, decrypt the encrypted request message using the random key, complete the business processing, and obtain the exchange key created by the first service last time; at the same time, create a new encryption key in the memory as its own exchange key, add its own exchange key to the response message, and use the exchange key created by the first service last time to encrypt the response message and send it to the first service;

[0013] The first service is also used to decrypt the encrypted response message using the exchange key it created last time, complete business processing, and obtain the exchange key created last time by the second service; and decide to use or clear the exchange key created last time by the second service based on whether it is necessary to continue requesting the second service.

[0014] In summary, this embodiment provides an end-to-end secure communication encryption method, which can achieve the following beneficial effects:

[0015] 1. In the method of this embodiment, the secret key is not stored at any end, but only in the memory. The probability of the memory being hacked and the secret key being accurately located is extremely low, and the secret key in the memory is also dynamically changed, and will be changed every time the message is interacted, which greatly reduces the risk of leakage;

[0016] 2. In the method of this embodiment, even if the secret key of the current link is leaked, it will be quickly detected due to a secret key error on the link at one end, and the illegal request link will be quickly cut off without affecting other links;

[0017] 3. In the method of this embodiment, since the secret key is generated in the link of each request, there is no need to frequently replace the stored secret key on both ends, reducing the burden on operation and maintenance personnel; and after a certain period of time, the secret key will also be cleared in the memory, and there will be no risk of memory overflow. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 It is a flow chart of an end-to-end secure communication encryption method provided by an embodiment of the present invention;

[0020] Figure 2 A schematic diagram of the structure of an end-to-end secure communication encryption system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0022] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are 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 therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0023] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0024] Figure 1This is a flow chart of an end-to-end secure communication encryption method provided by an embodiment of the present invention. The method is applicable to an end-to-end secure communication encryption system, and is executed by two services to be communicated in the system. For the sake of distinction and description, the first request initiator of the communication link is referred to as the first service, and the service at the other end of the link is referred to as the second service. The first service and the second service use a pair of identical security hardware devices as the starting key acquisition point, and the pair of devices will generate the same random key that changes over time.

[0025] Based on the above premise, combined with Figure 1 , the method specifically comprises:

[0026] S110. The first service that initiates the first request for the link obtains a random key that changes with time, and creates a new encryption key in the memory as its own exchange key, adds the exchange key to the request message, and uses the random key to encrypt the request message and send it to the second service at the other end of the link.

[0027] Specifically, assume that the first service is service A and the second service is service B. Service A, as the initiator of the first request of the link, reads the random key that changes with time in the secure hardware device as the encryption key I0 for the request, and creates a new encryption key in the memory as the exchange key I A1 ; and the new secret key I generated in memory A1 As a content in the message, the message is encrypted using the encryption key I0 read in the hardware and sent to service B.

[0028] S120. After receiving the encrypted request message, the second service obtains the random key according to the timestamp, decrypts the encrypted request message using the random key, completes the business processing, and obtains the exchange key created by the first service last time.

[0029] Specifically, after receiving the message, service B obtains the secret key I0 of the timestamp of the hardware device according to the timestamp, decrypts the message, and completes the actual business processing.

[0030] Optionally, the request message carries a timestamp of initiating the request, and the security hardware devices of the first service and the second service can directly generate a random sequence corresponding to the timestamp as an initial key; the security hardware devices of the first service and the second service can also only include a fixed random sequence, and the first service and the second service automatically generate an initial key that changes with time based on the random sequence. In the second mode, the steps for the first service and the second service to obtain a random initial key may include: the first service reads the random sequence from its own security hardware device, and converts the timestamp of initiating the request into a certain offset and adds it to the random sequence as a random key that changes with time; correspondingly, after the second service receives the encrypted request message, it also reads the random sequence from its own security hardware device, and converts the timestamp in the request message into a certain offset and adds it to the random sequence to obtain the random key. Among them, the random sequence and offset conversion methods in the security hardware devices of the first service and the second service are the same, thereby ensuring that the first service and the second service can obtain the same initial key.

[0031] S130. The second service creates a new encryption key in the memory as its own exchange key, adds its own exchange key to the response message, and uses the exchange key created last by the first service to encrypt the response message and sends it to the first service.

[0032] Specifically, after service B completes the business processing, it uses the newly created encryption key I sent by service A in the message A1 As the encryption key for return, a new encryption key I is also created in its own memory B1 As the exchange key; and the new key I generated in the memory B1 As a content in the message, use the encryption key I sent by service A A1 The message is encrypted and returned to service A.

[0033] S140. The first service uses the exchange key it created last time to decrypt the encrypted response message to complete the business processing.

[0034] Specifically, after receiving the response message, service A uses the secret key I created in memory last time A1 Decrypt the message, complete the business processing, and also obtain the encryption key I sent by service B B1 .

[0035] S150. The first service decides, based on whether it needs to continue to request the second service, to use the exchange key created last by the second service to continue to encrypt new request messages, or to clear the exchange key created last by the second service.

[0036] Specifically, this step includes the following two situations:

[0037] Case 1: The first service needs to continue to request the second service. Taking service A and service B as an example, in this case, service A recreates its own exchange key I in memory. A2 , the exchange key I A2 Add it to the new request message and use the exchange key I created by service B last time B1 The new request message is encrypted and sent to service B.

[0038] After receiving the encrypted new request message, service B uses the exchange key I created last time B1 Decrypt the encrypted new request message, complete the business processing, and obtain the exchange key I created by service A last time A2 .

[0039] At the same time, service B recreates its own exchange key I in memory B2 , the exchange key I B2 Add it to the new response message and use the exchange key I created by service A last time A2 The new response message is encrypted and sent to service A.

[0040] Service A continues to repeat S150 based on whether it needs to request service B, and the cycle continues to generate message exchanges, and a new exchange key I is generated in each message exchange. AN (new key created by service A for the Nth time) and I BN (The new key created by service B for the Nth time) until service A no longer needs to request the service B and terminates the current link.

[0041] In this way, each time the two services receive and send a message, they will use the new key generated in the memory of the other party last time for decryption, and provide the new key to the other party for decryption next time, thereby achieving the purpose of storing the key in memory and continuously exchanging it dynamically in each interaction.

[0042] Case 2: The first service does not need to continue to request the second service. Taking service A and service B as an example, in this case, service A terminates the current link and clears the exchange key in the memory (including its own exchange key and the other party's exchange key) after a certain period of time. The next time a request is initiated, it will be used as the first request to re-obtain the initial key that changes over time from the secure hardware device.

[0043] Furthermore, the communication between services will carry key fields such as timestamp and current link ID to mark whether the link has ended. When the first service initiates a new communication link, the request message carries a new link ID. After the second service receives a message, if the link ID in the message is inconsistent with the link ID of the previous message, it determines that the communication of the previous link has ended, and clears the exchange key created last time. After the second service receives a message, it finds that the difference between the current time and the timestamp in the message (representing the sending time of the message) is too large, and it can also determine that the current link has ended.

[0044] Furthermore, when the secret key is leaked (only the memory is breached and the secret key is accurately located, which is an extremely low probability event), a secret key error will occur on either side of the two services (the secret key exchange is interrupted by an illegal request), thereby quickly discovering the illegal access and notifying the opposite service that the current link is unsafe. The opposite service will then clear the secret key in the memory of the link and quickly end the illegal request link. Specifically, if an illegal access occurs, the illegally accessed end will communicate with the illegal visitor. After the real opposite service receives a certain message, it will find that the exchange key it created last time cannot be used to decrypt the message, indicating that the exchange key has been leaked, and the other party will be notified to terminate the current link and clear the exchange key in the memory. Therefore, in this embodiment, the secret key is only valid in one message exchange, the leakage cost is low and it is easy to detect in time, fully ensuring the security of communication.

[0045] In summary, in view of the defects in the prior art that the secret key is stored at the end and is fixed and easily stolen and leaked, and once the secret key is leaked, it is impossible to distinguish between true and false transactions, and each end needs to frequently replace the new secret key to prevent the leakage of the secret key, which increases the cost of personnel frequently maintaining the secret key. This embodiment provides an end-to-end secure communication encryption method, which can achieve the following beneficial effects:

[0046] 1. In the method of this embodiment, the secret key is not stored at any end, but only in the memory. The probability of the memory being hacked and the secret key being accurately located is extremely low, and the secret key in the memory is also dynamically changed, and will be changed every time the message is interacted, which greatly reduces the risk of leakage;

[0047] 2. In the method of this embodiment, even if the secret key of the current link is leaked, it will be quickly detected due to a secret key error on the link at one end, and the illegal request link will be quickly cut off without affecting other links;

[0048] 3. In the method of this embodiment, since the secret key is generated in the link of each request, there is no need to frequently replace the stored secret key on both ends, reducing the burden on operation and maintenance personnel; and after a certain period of time, the secret key will also be cleared in the memory, and there will be no risk of memory overflow.

[0049] Figure 2A schematic diagram of the structure of an end-to-end secure communication encryption system provided by an embodiment of the present invention, such as Figure 2 As shown, the system includes an electronic device deployed by a first service that initiates a first link request, and an electronic device deployed by a second service at the opposite end of the link.

[0050] The first service is used to obtain a random key that changes over time, and at the same time create a new encryption key in the memory as its own exchange key, add the exchange key to the request message, and use the random key to encrypt the request message and send it to the second service at the other end of the link;

[0051] After receiving the encrypted request message, the second service is used to obtain the random key according to the timestamp, decrypt the encrypted request message using the random key, complete the business processing, and obtain the exchange key created by the first service last time; at the same time, create a new encryption key in the memory as its own exchange key, add its own exchange key to the response message, and use the exchange key created by the first service last time to encrypt the response message and send it to the first service;

[0052] The first service is also used to decrypt the encrypted response message using the exchange key it created last time, complete business processing, and obtain the exchange key created last time by the second service; and based on whether it needs to continue requesting the second service, the first service decides to use the exchange key created last time by the second service to continue encrypting new request messages, or to clear the exchange key created last time by the second service.

[0053] Furthermore, if the first service needs to continue to request the second service, the first service is further used to recreate its own exchange key in the memory, add the exchange key to the request message, and use the exchange key created last by the second service to encrypt the request message and send it to the second service;

[0054] The second service is further configured to, after receiving the encrypted request message, decrypt the encrypted request message using the exchange key created last time by the second service, complete the business processing, and obtain the exchange key created last time by the first service; at the same time, recreate its own exchange key in the memory, add its own exchange key to the response message, and use the exchange key created last time by the first service to encrypt the response message and send it to the first service;

[0055] This cycle repeats until the first service no longer needs to request the second service and the current link is terminated.

[0056] If the first service does not need to continue requesting the second service, the first service is also used to terminate the current link and clear the exchange key in the memory after a certain period of time, and then re-acquire the random key that changes with time when the next request is initiated.

[0057] This embodiment and the above-mentioned method embodiment are based on the same inventive concept, and the features of any of the above-mentioned method embodiments are applicable to this embodiment and can achieve the same beneficial effects, which will not be repeated here.

[0058] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.

Claims

1. An end-to-end secure communication encryption method, characterized in that: include: The first service that initiates the first request of the link obtains a random key that changes with time, and creates a new encryption key in the memory as its own exchange key, adds the exchange key to the request message, and uses the random key to encrypt the request message and send it to the second service at the other end of the link; After receiving the encrypted request message, the second service obtains the random key according to the timestamp, decrypts the encrypted request message using the random key, completes the service processing, and obtains the exchange key created by the first service last time; The second service creates a new encryption key in the memory as its own exchange key, adds the exchange key to the response message, and encrypts the response message using the exchange key created by the first service last time and sends it to the first service; The first service decrypts the encrypted response message using the exchange key created last time, completes the service processing, and obtains the exchange key created last time by the second service; The first service decides, based on whether it needs to continue requesting the second service, to use the exchange key created last by the second service to continue encrypting new request messages, or to clear the exchange key created last by the second service.

2. The method according to claim 1, characterized in that The first service decides, according to whether it needs to continue to request the second service, to use the exchange key created last by the second service to continue to encrypt a new request message, or to clear the exchange key created last by the second service, including: If the first service needs to continue to request the second service, the first service recreates its own exchange key in the memory, adds the exchange key to a new request message, and uses the exchange key created by the second service last time to encrypt the new request message and send it to the second service; After receiving the encrypted new request message, the second service uses the exchange key created last time to decrypt the encrypted new request message, completes the business processing, and obtains the exchange key created last time by the first service; The second service recreates its own exchange key in the memory, adds the exchange key to the new response message, and encrypts the new response message using the exchange key created by the first service last time and sends it to the first service; This cycle repeats until the first service no longer needs to request the second service and the current link is terminated.

3. The method according to claim 1, characterized in that The first service decides, according to whether it needs to continue to request the second service, to use the exchange key created last by the second service to continue to encrypt a new request message, or to clear the exchange key created last by the second service, including: If the first service does not need to continue to request the second service, the current link is terminated, and the exchange key in the memory is cleared after a certain period of time, and the random key that changes with time is re-acquired when the next request is initiated.

4. The method according to claim 1, characterized in that The first service and the second service use a pair of identical security hardware devices as acquisition points of the random key, and the security hardware devices are capable of generating the same random key that changes over time.

5. The method according to claim 4, characterized in that The request message carries a timestamp of initiating the request; The first service that initiates the first link request obtains a random key that changes with time, including: the first service that initiates the first link request reads a random sequence from its own security hardware device, and converts the timestamp of the request into a certain offset and adds it to the random sequence as the random key that changes with time; Correspondingly, after receiving the encrypted request message, the second service obtains the random key according to the timestamp, including: after receiving the encrypted request message, the second service reads a random sequence from its own security hardware device, and converts the timestamp in the request message into a certain offset and adds it to the random sequence to obtain the random key; Among them, the random sequence and offset conversion methods in the security hardware devices of the first service and the second service are the same.

6. The method according to claim 1, characterized in that Each message carries a link ID; accordingly, the method further includes: After the second service receives a message, if the link ID in the message is inconsistent with the link ID of the previous message, it is determined that the previous link communication is ended, and the exchange key created last time is cleared.

7. The method according to claim 1, characterized in that Also includes: After the first service or the second service receives a message, if the exchange key created last time cannot be used to decrypt the message, it indicates that the exchange key has been leaked, and the other party is notified to terminate the current link and clear the exchange key in the memory.

8. The method according to claim 1, characterized in that The exchange key is cleared after being stored in the memory for a certain period of time, and the certain period of time is greater than the maximum time required for a message exchange.

9. An end-to-end secure communication encryption system, characterized in that: It includes: an electronic device deployed by a first service that initiates a first request for a link, and an electronic device deployed by a second service at the opposite end of the link; wherein, The first service is used to obtain a random key that changes over time, and at the same time create a new encryption key in the memory as its own exchange key, add the exchange key to the request message, and use the random key to encrypt the request message and send it to the second service at the other end of the link; After receiving the encrypted request message, the second service is used to obtain the random key according to the timestamp, decrypt the encrypted request message using the random key, complete the business processing, and obtain the exchange key created by the first service last time; at the same time, create a new encryption key in the memory as its own exchange key, add its own exchange key to the response message, and use the exchange key created by the first service last time to encrypt the response message and send it to the first service; The first service is also used to decrypt the encrypted response message using the exchange key it created last time, complete business processing, and obtain the exchange key created last time by the second service; and the first service decides to use the exchange key created last time by the second service to continue to encrypt new request messages, or clear the exchange key created last time by the second service, based on whether it needs to continue requesting the second service.

10. The system according to claim 9, characterized in that The first service decides to use the exchange key created last by the second service to continue to encrypt a new request message, or clear the exchange key created last by the second service, according to whether the first service needs to continue to request the second service in the following manner: If the first service needs to continue to request the second service, the first service recreates its own exchange key in the memory, adds the exchange key to the request message, and uses the exchange key created by the second service last time to encrypt the request message and send it to the second service; After receiving the encrypted request message, the second service uses the exchange key created last time to decrypt the encrypted request message, completes the business processing, and obtains the exchange key created last time by the first service; at the same time, it recreates its own exchange key in the memory, adds its own exchange key to the response message, and uses the exchange key created last time by the first service to encrypt the response message and send it to the first service; This cycle repeats until the first service no longer needs to request the second service and the current link is terminated.

Citation Information

Patent Citations

  • AES encryption decryption method and AES encryption decryption device

    CN106506140A

  • Data transmission encryption method, client and server

    CN109039598A

  • Vehicle machine data encryption transmission method and device

    CN111565177A

  • Method, device, equipment and medium for remotely controlling vehicle based on encryption algorithm,

    CN113645590A

  • Communication method and device, electronic equipment and computer storage medium

    CN115580460A