Encryption method and device, storage medium and electronic device

By obtaining and managing keys between IoT devices and the centralized key management platform, determining whether to regenerate the key based on the update cycle, the resource consumption problem caused by key update is solved, and the system performance and security of encrypted data are improved. .

CN115361223BInactive Publication Date: 2024-11-26BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211033290.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-26
Publication Date
2024-11-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the number of IoT devices is huge, the enterprise-level centralized key management platform consumes too much resources caused by key updates, which affects system performance.

Method used

By obtaining the latest generated target work key, target encryption key EKE and target root key respectively between the IoT device and the centralized key management platform, and determining whether the key needs to be regenerated based on the preset update cycle, avoiding Resource consumption caused by frequent updates of the same platform.

Benefits of technology

It effectively reduces the resource consumption caused by key updates, improves the performance and efficiency of the system, and ensures the security of encrypted data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115361223B_ABST
    Figure CN115361223B_ABST
Patent Text Reader

Abstract

The present application discloses an encryption method and device, a storage medium and an electronic device, which can be applied to the Internet field or the financial field. The method includes: when it is detected that an IoT device generates network data, obtaining the latest generated target working key in the preset IoT platform; applying the target working key to encrypt the network data to obtain the first encrypted data; obtaining the latest generated target encryption key EKE and target root key in the preset key centralized management platform; applying the target EKE to encrypt the first encrypted data to obtain the second encrypted data; applying the target root key to encrypt the second encrypted data to obtain the third encrypted data; storing the third encrypted data in a pre-set memory. By applying the method provided by the present invention, keys can be obtained through different platforms for encryption, avoiding resource consumption caused by updating the keys on the same platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to an encryption method and device, a storage medium and an electronic device. Background Art

[0002] Due to the large number of IoT devices, the number of working keys used to encrypt IoT devices is also relatively large. If such a large number of keys are managed by an enterprise-level centralized key management platform, key updates will result in huge system resource consumption. Summary of the invention

[0003] In view of this, the present invention provides an encryption method, through which keys can be obtained through different platforms for encryption, thereby avoiding resource consumption caused by updating the keys on the same platform.

[0004] The present invention also provides an encryption device to ensure the implementation and application of the above method in practice.

[0005] An encryption method, comprising:

[0006] When it is detected that the IoT device generates network data, the target working key newly generated in the preset IoT platform is obtained;

[0007] Using the target working key to encrypt the network data to obtain first encrypted data;

[0008] Obtain the latest generated target encryption key EKE and target root key in the preset key centralized management platform;

[0009] Using the target EKE to encrypt the first encrypted data to obtain second encrypted data;

[0010] Using the target root key to encrypt the second encrypted data to obtain third encrypted data;

[0011] The third encrypted data is stored in a preset memory.

[0012] In the above method, optionally, the step of obtaining the latest generated target working key in the preset Internet of Things platform includes:

[0013] Acquire first key information of a working key most recently generated by the Internet of Things platform, and determine a first generation time of the most recently generated working key based on the first key information;

[0014] Determining whether a first generation time of the most recently generated working key exceeds a preset first update period;

[0015] If the first generation time of the most recently generated working key does not exceed the first update period, obtaining the most recently generated working key in the Internet of Things platform as the target working key;

[0016] If the first generation time of the most recently generated working key exceeds the first update period, the Internet of Things platform is triggered to regenerate a new working key, and the new working key in the Internet of Things platform is obtained as the target working key.

[0017] In the above method, optionally, the step of obtaining the target encryption key EKE and the target root key that are newly generated in the preset key centralized management platform includes:

[0018] Acquire the EKE second key information most recently generated by the key centralized management platform, and determine the second generation time of the most recently generated EKE based on the second key information;

[0019] Obtaining the third key information of the root key most recently generated by the key centralized management platform, and determining the third generation time of the most recently generated root key based on the third key information;

[0020] Determine whether the second generation time of the most recently generated EKE exceeds the preset second update period, and whether the third generation time of the most recently generated root key exceeds the preset third update period;

[0021] If the second generation time of the most recently generated EKE does not exceed the second update period, the most recently generated EKE is obtained as the target EKE; otherwise, the key centralized management platform is triggered to regenerate a new EKE, and the new EKE is obtained as the target EKE;

[0022] If the third generation time of the most recently generated root key does not exceed the third update period, the most recently generated root key is obtained as the target root key; otherwise, the key centralized management platform is triggered to regenerate a new root key, and the new root key is obtained as the target root key.

[0023] The above method, optionally, before applying the target working key to encrypt the network data, further comprises:

[0024] Generate random numbers;

[0025] Using the target working key to encrypt the random number to obtain an encrypted random number;

[0026] Sending the encrypted random number to the Internet of Things platform to trigger the Internet of Things platform to decrypt the encrypted random number;

[0027] When a decryption success message fed back by the Internet of Things platform is received, the working key is verified.

[0028] An encryption device, comprising:

[0029] A first acquisition unit is used to acquire a target working key newly generated in a preset Internet of Things platform when it is detected that an Internet of Things device generates network data;

[0030] A first encryption unit, used to encrypt the network data using the target working key to obtain first encrypted data;

[0031] A second acquisition unit is used to acquire the target encryption key EKE and the target root key that are newly generated in the preset key centralized management platform;

[0032] a second encryption unit, configured to encrypt the first encrypted data using the target EKE to obtain second encrypted data;

[0033] a third encryption unit, configured to encrypt the second encrypted data using the target root key to obtain third encrypted data;

[0034] The storage unit is used to store the third encrypted data in a preset memory.

[0035] In the above device, optionally, the first acquisition unit includes:

[0036] A first acquisition subunit, configured to acquire first key information of a working key most recently generated by the Internet of Things platform, and determine a first generation time of the most recently generated working key based on the first key information;

[0037] A first judging subunit, used to judge whether a first generation time of the most recently generated working key exceeds a preset first update period;

[0038] A second acquisition subunit is configured to acquire the most recently generated working key in the Internet of Things platform as a target working key if the first generation time of the most recently generated working key does not exceed the first update period;

[0039] The triggering subunit is used to trigger the Internet of Things platform to regenerate a new working key if the first generation time of the most recently generated working key exceeds the first update period, and obtain the new working key in the Internet of Things platform as a target working key.

[0040] In the above device, optionally, the second acquisition unit includes:

[0041] A third acquisition subunit is used to acquire the EKE second key information most recently generated by the key centralized management platform, and determine the second generation time of the most recently generated EKE based on the second key information;

[0042] A generating subunit, configured to obtain the third key information of the root key most recently generated by the key centralized management platform, and determine the third generation time of the most recently generated root key based on the third key information;

[0043] A second judgment subunit is used to judge whether the second generation time of the most recently generated EKE exceeds the preset second update period, and whether the third generation time of the most recently generated root key exceeds the preset third update period;

[0044] A fourth acquisition subunit is configured to, if the second generation time of the most recently generated EKE does not exceed the second update period, acquire the most recently generated EKE as the target EKE; otherwise, trigger the key centralized management platform to regenerate a new EKE, and acquire the new EKE as the target EKE;

[0045] The fifth acquisition sub-unit is used to obtain the most recently generated root key as the target root key if the third generation time of the most recently generated root key does not exceed the third update period; otherwise, it triggers the key centralized management platform to regenerate a new root key and obtains the new root key as the target root key.

[0046] The above device may optionally further include:

[0047] A generating unit, used for generating random numbers;

[0048] A fourth encryption unit, used to encrypt the random number using the target working key to obtain an encrypted random number;

[0049] A sending unit, used to send the encrypted random number to the Internet of Things platform, triggering the Internet of Things platform to decrypt the encrypted random number;

[0050] The verification success unit is used to verify the working key when receiving the decryption success message fed back by the Internet of Things platform.

[0051] A storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above encryption method.

[0052] An electronic device includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the above encryption method.

[0053] Compared with the prior art, the present invention has the following advantages:

[0054] The present invention provides an encryption method, including: when it is detected that an IoT device generates network data, obtaining the latest generated target working key in a preset IoT platform; applying the target working key to encrypt the network data to obtain first encrypted data; obtaining the latest generated target encryption key EKE and target root key in a preset key centralized management platform; applying the target EKE to encrypt the first encrypted data to obtain second encrypted data; applying the target root key to encrypt the second encrypted data to obtain third encrypted data; storing the third encrypted data in a pre-set memory. By applying the method provided by the present invention, keys can be obtained through different platforms for encryption, avoiding resource consumption caused by updating keys on the same platform. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0056] Figure 1 A method flow chart of an encryption method provided by an embodiment of the present invention;

[0057] Figure 2 An example of an encryption method provided by an embodiment of the present invention;

[0058] Figure 3 Another method flow chart of an encryption method provided by an embodiment of the present invention;

[0059] Figure 4 A flowchart of another encryption method provided by an embodiment of the present invention;

[0060] Figure 5 A device structure diagram of an encryption device provided by an embodiment of the present invention;

[0061] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 are within the scope of protection of the present invention.

[0063] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0064] The present invention can be used in many general or special computing device environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or devices, etc.

[0065] The embodiment of the present invention provides an encryption method, which can be applied to various system platforms, and its execution subject can be a processor of a computer terminal or various mobile devices. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:

[0066] S101: When it is detected that an IoT device generates network data, a target working key newly generated in a preset IoT platform is obtained.

[0067] It should be noted that the IoT platform generates working keys according to a preset time period or time interval.

[0068] S102: Using the target working key to encrypt the network data to obtain first encrypted data.

[0069] S103: Obtain the target encryption key EKE and target root key that are most recently generated in the preset key centralized management platform.

[0070] It should be noted that the key centralized management platform also generates encryption keys and root keys according to a preset time period or time interval. The key centralized management platform can update the encryption key and root key separately at any time, or update the encryption key and root key at the same time.

[0071] S104: Using the target EKE to encrypt the first encrypted data to obtain second encrypted data.

[0072] S105: Use the target root key to encrypt the second encrypted data to obtain third encrypted data.

[0073] It should be noted that in the above S104 and S105, the target EKE is first used to encrypt the first encrypted data, and then the target root key is used to encrypt the second encrypted data. Optionally, the present invention can first use the target root key to encrypt the first encrypted data to obtain the second encrypted data, and then use the target EKE to encrypt the second encrypted data.

[0074] S106: Storing the third encrypted data in a preset memory.

[0075] In the method provided by the embodiment of the present invention, when the Internet of Things device generates network data, the target working key, the target EKE and the target root key are obtained through the Internet of Things platform and the key centralized management platform respectively. Among them, after first obtaining the target working key through the Internet of Things platform to encrypt the network data to obtain the first encrypted data, the target EKE and the target root key are obtained from the key centralized management platform to encrypt the first encrypted data for the second and third time, and the third encrypted data obtained after the third encryption is stored in the memory.

[0076] In the present invention, each key for encrypting network data is obtained through different platforms respectively, so as to avoid resource consumption caused by updating the key on the same platform.

[0077] The method provided in the embodiment of the present invention is mainly divided into three parts. Figure 2 The principle of hierarchical management of keys is as follows:

[0078] 1. The IoT platform manages the working key, which encrypts the network data reported by the IoT device. The life cycle of the working key refers to the life cycle of the IoT device and is not subject to many restrictions.

[0079] 2. The enterprise-level centralized key management platform manages KEK and root keys. The life cycle of these two keys should comply with the enterprise's security level specifications and financial level 3 security requirements.

[0080] 3. The enterprise-level cryptographic service platform provides standard encryption and decryption services.

[0081] In the method provided in the embodiment of the present invention, Figure 3 As shown, the obtaining of the latest generated target working key in the preset Internet of Things platform includes:

[0082] S301: Acquire first key information of a working key most recently generated by the Internet of Things platform, and determine a first generation time of the most recently generated working key based on the first key information.

[0083] It should be noted that the first key information records the generation time corresponding to each working key generated by the Internet of Things platform.

[0084] S302: Determine whether the first generation time of the most recently generated working key exceeds a preset first update period.

[0085] If the first generation time of the most recently generated working key does not exceed the first update period, S303 is executed; if the first generation time of the most recently generated working key exceeds the first update period, S304 is executed.

[0086] S303: Acquire the most recently generated working key in the Internet of Things platform as the target working key.

[0087] It is understandable that if the first generation time does not exceed the first update cycle, it indicates that the IoT platform does not need to update the working key in a short time, and directly applies the latest generated working key as the target working key.

[0088] S304: Trigger the Internet of Things platform to regenerate a new working key, and obtain the new working key in the Internet of Things platform as a target working key.

[0089] It is understandable that if the first generation time exceeds the first update cycle, it indicates that the IoT platform needs to update the working key, and the latest generated working key is applied as the target working key after the IoT platform completes the updating of the working key.

[0090] In the present invention, when the target working key is applied for encryption, encryption information corresponding to the network data is generated, and the encryption information includes a timestamp corresponding to the time when the target working key is generated. When the first encrypted data needs to be decrypted subsequently, the encryption method can be determined according to the timestamp, and the corresponding decryption method can be applied according to the encryption method for decryption.

[0091] In the present invention, if Figure 4 As shown, the step of obtaining the latest generated target encryption key EKE and target root key in the preset key centralized management platform includes:

[0092] S401: Acquire the EKE second key information most recently generated by the key centralized management platform, and determine the second generation time of the most recently generated EKE based on the second key information.

[0093] It can be understood that, similar to the above S301, each EKE and each root key in the key centralized management platform has a corresponding generation time.

[0094] S402: Acquire the third key information of the root key most recently generated by the key centralized management platform, and determine the third generation time of the most recently generated root key based on the third key information;

[0095] S403: Determine whether the second generation time of the most recently generated EKE exceeds a preset second update period.

[0096] If the second generation time of the most recently generated EKE does not exceed the second update period, S404 is executed; otherwise, S405 is executed.

[0097] S404: Acquire the most recently generated EKE as the target EKE.

[0098] In the present invention, after executing S404, S406 is executed.

[0099] It is understandable that if the second generation time does not exceed the second update period, it indicates that the centralized key management platform does not need to update the EKE in a short period of time, and directly applies the currently latest generated EKE as the target EKE.

[0100] S405: Trigger the centralized key management platform to regenerate a new EKE, and obtain the new EKE as the target EKE.

[0101] In the present invention, after executing S405, S406 is executed.

[0102] It can be understood that if the second generation time exceeds the second update period, it indicates that the centralized key management platform needs to update the EKE. After the centralized key management platform completes the update of the EKE, the latest generated EKE is applied as the target EKE.

[0103] S406: Determine whether the third generation time of the most recently generated root key exceeds a preset third update period.

[0104] If the third generation time of the most recently generated root key does not exceed the third update period, execute S407; otherwise, execute S408.

[0105] It should be noted that the second update cycle may be consistent with the third update cycle.

[0106] S407: Acquire the most recently generated root key as the target root key.

[0107] It is understandable that if the third generation time does not exceed the third update cycle, it indicates that the centralized key management platform does not need to update the root key in a short period of time and directly applies the currently latest generated root key as the target root key.

[0108] S408: Trigger the key centralized management platform to regenerate a new root key, and obtain the new root key as a target root key.

[0109] It can be understood that if the third generation time exceeds the third update cycle, it indicates that the centralized key management platform needs to update the root key. After the centralized key management platform completes the update of the root key, the latest generated root key is applied as the target root key.

[0110] In the present invention, after the target EKE and the target root key are applied for encryption, a timestamp corresponding to the generation time of the target EKE and a timestamp corresponding to the generation time of the target root key are generated, and the timestamp corresponding to the generation time of the target EKE and the timestamp corresponding to the generation time of the target root key are saved to the encryption information corresponding to the network data. When the second encrypted data and the third encrypted data need to be decrypted subsequently, the encryption method can be determined according to the timestamp in the encryption information, and the corresponding decryption method can be applied for decryption according to the encryption method.

[0111] In the embodiment of the present invention, before applying the target working key to encrypt the network data, the method further includes:

[0112] Generate random numbers;

[0113] Using the target working key to encrypt the random number to obtain an encrypted random number;

[0114] Sending the encrypted random number to the Internet of Things platform to trigger the Internet of Things platform to decrypt the encrypted random number;

[0115] When a decryption success message fed back by the Internet of Things platform is received, the working key is verified.

[0116] It is understandable that the security of communication with the IoT platform is determined by encrypting and decrypting the random number. If the decryption is successful, it indicates that the communication with the IoT platform is secure.

[0117] The specific implementation processes and derivative methods of the above-mentioned embodiments are all within the protection scope of the present invention.

[0118] and Figure 1 Corresponding to the method described above, the embodiment of the present invention further provides an encryption device for Figure 1The encryption device provided in the embodiment of the present invention can be applied to a computer terminal or various mobile devices, and its structural diagram is as follows Figure 5 As shown, specifically including:

[0119] The first acquisition unit 501 is used to acquire the latest generated target working key in the preset Internet of Things platform when it is detected that the Internet of Things device generates network data;

[0120] A first encryption unit 502, used to encrypt the network data using the target working key to obtain first encrypted data;

[0121] The second acquisition unit 503 is used to acquire the target encryption key EKE and the target root key that are newly generated in the preset key centralized management platform;

[0122] A second encryption unit 504, configured to encrypt the first encrypted data using the target EKE to obtain second encrypted data;

[0123] A third encryption unit 505, configured to encrypt the second encrypted data using the target root key to obtain third encrypted data;

[0124] The storage unit 506 is used to store the third encrypted data in a pre-set memory.

[0125] In the device provided by the embodiment of the present invention, when the Internet of Things device generates network data, the target working key, the target EKE and the target root key are obtained through the Internet of Things platform and the key centralized management platform respectively. Among them, after first obtaining the target working key through the Internet of Things platform to encrypt the network data to obtain the first encrypted data, the target EKE and the target root key are obtained from the key centralized management platform to encrypt the first encrypted data for the second and third time, and the third encrypted data obtained after the third encryption is stored in the memory.

[0126] By using the device provided by the present invention, each key for encrypting network data is obtained through different platforms respectively, thereby avoiding resource consumption caused by updating the key on the same platform.

[0127] In the device provided by the embodiment of the present invention, the first acquisition unit includes:

[0128] A first acquisition subunit, configured to acquire first key information of a working key most recently generated by the Internet of Things platform, and determine a first generation time of the most recently generated working key based on the first key information;

[0129] A first judging subunit, used to judge whether a first generation time of the most recently generated working key exceeds a preset first update period;

[0130] A second acquisition subunit is configured to acquire the most recently generated working key in the Internet of Things platform as a target working key if the first generation time of the most recently generated working key does not exceed the first update period;

[0131] The triggering subunit is used to trigger the Internet of Things platform to regenerate a new working key if the first generation time of the most recently generated working key exceeds the first update period, and obtain the new working key in the Internet of Things platform as a target working key.

[0132] In the device provided by the embodiment of the present invention, the second obtaining unit includes:

[0133] A third acquisition subunit is used to acquire the EKE second key information most recently generated by the key centralized management platform, and determine the second generation time of the most recently generated EKE based on the second key information;

[0134] A generating subunit, configured to obtain the third key information of the root key most recently generated by the key centralized management platform, and determine the third generation time of the most recently generated root key based on the third key information;

[0135] A second judgment subunit is used to judge whether the second generation time of the most recently generated EKE exceeds the preset second update period, and whether the third generation time of the most recently generated root key exceeds the preset third update period;

[0136] A fourth acquisition subunit is configured to, if the second generation time of the most recently generated EKE does not exceed the second update period, acquire the most recently generated EKE as the target EKE; otherwise, trigger the key centralized management platform to regenerate a new EKE, and acquire the new EKE as the target EKE;

[0137] The fifth acquisition sub-unit is used to obtain the most recently generated root key as the target root key if the third generation time of the most recently generated root key does not exceed the third update period; otherwise, it triggers the key centralized management platform to regenerate a new root key and obtains the new root key as the target root key.

[0138] The device provided in the embodiment of the present invention further includes:

[0139] A generating unit, used for generating random numbers;

[0140] A fourth encryption unit, used to encrypt the random number using the target working key to obtain an encrypted random number;

[0141] A sending unit, used to send the encrypted random number to the Internet of Things platform, triggering the Internet of Things platform to decrypt the encrypted random number;

[0142] The verification success unit is used to verify the working key when receiving the decryption success message fed back by the Internet of Things platform.

[0143] For the specific working process of each unit and sub-unit in the encryption device disclosed in the above embodiment of the present invention, reference may be made to the corresponding content in the encryption method disclosed in the above embodiment of the present invention, and will not be repeated here.

[0144] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above encryption method.

[0145] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 6 As shown, it specifically includes a memory 601 and one or more instructions 602, wherein the one or more instructions 602 are stored in the memory 601 and are configured to be executed by one or more processors 603 to perform the following operations:

[0146] When it is detected that the IoT device generates network data, the target working key newly generated in the preset IoT platform is obtained;

[0147] Using the target working key to encrypt the network data to obtain first encrypted data;

[0148] Obtain the latest generated target encryption key EKE and target root key in the preset key centralized management platform;

[0149] Using the target EKE to encrypt the first encrypted data to obtain second encrypted data;

[0150] Using the target root key to encrypt the second encrypted data to obtain third encrypted data;

[0151] The third encrypted data is stored in a preset memory.

[0152] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0153] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, computer software, or a combination of both.

[0154] In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0155] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An encryption method, characterized in that: include: When it is detected that the IoT device generates network data, the target working key newly generated in the preset IoT platform is obtained; The obtaining of the target working key most recently generated in the preset Internet of Things platform includes: obtaining the first key information of the working key most recently generated by the Internet of Things platform, and determining the first generation time of the working key most recently generated based on the first key information; judging whether the first generation time of the working key most recently generated exceeds a preset first update cycle; if the first generation time of the working key most recently generated does not exceed the first update cycle, obtaining the working key most recently generated in the Internet of Things platform as the target working key; if the first generation time of the working key most recently generated exceeds the first update cycle, triggering the Internet of Things platform to regenerate a new working key, and obtaining the new working key in the Internet of Things platform as the target working key; Using the target working key to encrypt the network data to obtain first encrypted data; Obtain the latest generated target encryption key KEK and target root key in the preset key centralized management platform; Using the target KEK to encrypt the first encrypted data to obtain second encrypted data; Using the target root key to encrypt the second encrypted data to obtain third encrypted data; The third encrypted data is stored in a preset memory.

2. The method according to claim 1, characterized in that: The obtaining of the target encryption key KEK and the target root key which are newly generated in the preset key centralized management platform includes: Acquire the second key information of the KEK most recently generated by the key centralized management platform, and determine the second generation time of the most recently generated KEK based on the second key information; Obtaining the third key information of the root key most recently generated by the key centralized management platform, and determining the third generation time of the most recently generated root key based on the third key information; Determine whether the second generation time of the most recently generated KEK exceeds the preset second update period, and whether the third generation time of the most recently generated root key exceeds the preset third update period; If the second generation time of the most recently generated KEK does not exceed the second update period, the most recently generated KEK is obtained as the target KEK; otherwise, the key centralized management platform is triggered to regenerate a new KEK, and the new KEK is obtained as the target KEK; If the third generation time of the most recently generated root key does not exceed the third update period, the most recently generated root key is obtained as the target root key; otherwise, the key centralized management platform is triggered to regenerate a new root key, and the new root key is obtained as the target root key.

3. The method according to claim 1, characterized in that Before applying the target working key to encrypt the network data, the method further includes: Generate random numbers; Using the target working key to encrypt the random number to obtain an encrypted random number; Sending the encrypted random number to the Internet of Things platform to trigger the Internet of Things platform to decrypt the encrypted random number; When a decryption success message fed back by the Internet of Things platform is received, the working key is verified.

4. An encryption device, characterized in that: include: A first acquisition unit is used to acquire a target working key newly generated in a preset Internet of Things platform when it is detected that an Internet of Things device generates network data; A first encryption unit, used to encrypt the network data using the target working key to obtain first encrypted data; A second acquisition unit is used to acquire the target encryption key KEK and the target root key that are newly generated in the preset key centralized management platform; A second encryption unit, configured to encrypt the first encrypted data using the target KEK to obtain second encrypted data; a third encryption unit, configured to encrypt the second encrypted data using the target root key to obtain third encrypted data; A storage unit, used for storing the third encrypted data in a preset memory; The first acquisition unit includes: a first acquisition subunit, a first judgment subunit, a second acquisition subunit and a trigger subunit; The first acquisition subunit is used to acquire first key information of a working key most recently generated by the Internet of Things platform, and determine a first generation time of the most recently generated working key based on the first key information; The first judging subunit is used to judge whether the first generation time of the most recently generated working key exceeds a preset first update period; The second acquisition subunit is configured to acquire the most recently generated working key in the Internet of Things platform as a target working key if the first generation time of the most recently generated working key does not exceed the first update period; The trigger subunit is used to trigger the Internet of Things platform to regenerate a new working key if the first generation time of the most recently generated working key exceeds the first update period, and obtain the new working key in the Internet of Things platform as a target working key.

5. The device according to claim 4, characterized in that The second acquisition unit includes: A third acquisition subunit is used to acquire the second key information of the KEK most recently generated by the key centralized management platform, and determine the second generation time of the most recently generated KEK based on the second key information; A generating subunit, configured to obtain the third key information of the root key most recently generated by the key centralized management platform, and determine the third generation time of the most recently generated root key based on the third key information; A second judgment subunit is used to judge whether the second generation time of the most recently generated KEK exceeds the preset second update period, and whether the third generation time of the most recently generated root key exceeds the preset third update period; A fourth acquisition subunit is configured to, if the second generation time of the most recently generated KEK does not exceed the second update period, acquire the most recently generated KEK as the target KEK; otherwise, trigger the key centralized management platform to regenerate a new KEK, and acquire the new KEK as the target KEK; The fifth acquisition sub-unit is used to obtain the most recently generated root key as the target root key if the third generation time of the most recently generated root key does not exceed the third update period; otherwise, it triggers the key centralized management platform to regenerate a new root key and obtains the new root key as the target root key.

6. The device according to claim 4, characterized in that Also includes: A generating unit, used for generating random numbers; A fourth encryption unit, used to encrypt the random number using the target working key to obtain an encrypted random number; A sending unit, used to send the encrypted random number to the Internet of Things platform, triggering the Internet of Things platform to decrypt the encrypted random number; The verification success unit is used to verify the working key when receiving the decryption success message fed back by the Internet of Things platform.

7. A storage medium comprising stored instructions, wherein: When the instruction is executed, the device where the storage medium is located is controlled to execute the encryption method as described in any one of claims 1 to 3.

8. An electronic device comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the encryption method as described in any one of claims 1 to 3.