Encryption and decryption method, system, device and storage medium

By using preset keys in the BLE device to encrypt broadcast data, and encapsulate the encrypted data and key identification into broadcast data, the problems of low broadcast data security and low data interaction efficiency of BLE devices are solved, and efficient and secure data interaction is achieved.

CN119789077APending Publication Date: 2025-04-08AMLOGIC (CHENG DU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311297866.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-08
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In IoT applications, the broadcast data security of BLE devices is low, making it difficult to meet the high requirements for data security. At the same time, the data interaction efficiency based on connection is not high, and it cannot meet the needs of efficient data interaction.

Method used

The broadcast information is encrypted using a preset key to obtain the encrypted data, and the encrypted data and key identification are encapsulated into broadcast data. The scanning terminal obtains the corresponding preset key through the key identification in the received broadcast data for decryption.

Benefits of technology

It improves the security and efficiency of data interaction between the broadcast end and the scanning end, reduces the complexity of data interaction, and supports one-to-many broadcast or many-to-one broadcast application scenarios, making it more versatile.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119789077A_ABST
    Figure CN119789077A_ABST
Patent Text Reader

Abstract

An encryption and decryption method and its system, device and storage medium, the encryption method includes: using a preset key to encrypt broadcast information to obtain encrypted data, the preset key has a corresponding key identifier; encapsulating the encrypted data and the key identifier corresponding to the preset key into broadcast data. The decryption method includes: decapsulating the received broadcast data, the broadcast data includes a key identifier and encrypted data; obtaining the corresponding preset key based on the key identifier obtained after decapsulation; decrypting the encrypted data using the preset key corresponding to the key identifier. The present invention indicates the key identifier in the broadcast data, and after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end, which reduces the complexity of data interaction, thereby improving the efficiency of data interaction, and can be applied to one-to-many or many-to-one broadcast application scenarios, with stronger versatility.
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 communication technology, and in particular to an encryption and decryption method of a terminal and a system, device and storage medium thereof. Background Art

[0002] With the rise of the Internet of Things and people's increasing demand for quality of life, BLE (Bluetooth Low Energy) technology has been widely used in many industries such as medical care, smart home, industrial Internet of Things, etc. BLE applications can be divided into connection-based and broadcast-based methods. The connection-based method can only realize point-to-point data interaction with high data security; the broadcast-based method can realize one-to-many broadcast or many-to-one broadcast, but the broadcast data is transmitted in plain text, and the data security is low.

[0003] In some application scenarios (for example, smart medical care needs to collect a large amount of patients' physiological information, smart buildings need to be configured or collect monitoring and street light status, etc.), there are more and more BLE devices, and the connection-based approach can no longer meet the needs. However, in application scenarios with high data sensitivity, the requirements for data security are also high. Therefore, it is necessary not only to improve the efficiency of data interaction, but also to improve data security. Summary of the invention

[0004] The problem solved by the embodiments of the present invention is to provide an encryption and decryption method and system, device and storage medium thereof, so as to improve the efficiency, security and versatility of data interaction between a broadcast end and a scanning end.

[0005] To solve the above problems, an embodiment of the present invention provides an encryption method, including: using a preset key to encrypt the broadcast information to obtain encrypted data, the preset key has a corresponding key identifier; encapsulating the encrypted data and the key identifier corresponding to the preset key into broadcast data.

[0006] Correspondingly, an embodiment of the present invention also provides a decryption method, including: unpacking received broadcast data, the broadcast data including a key identifier and encrypted data, the key identifier having a corresponding preset key; obtaining the corresponding preset key based on the key identifier obtained after depackaging; and decrypting the encrypted data using the preset key corresponding to the key identifier.

[0007] Correspondingly, an embodiment of the present invention also provides an encryption system, including: an encryption module, used to encrypt the broadcast information using a preset key to obtain encrypted data, and the preset key has a corresponding key identifier; an encapsulation module, used to encapsulate the encrypted data and the key identifier corresponding to the preset key into broadcast data.

[0008] Correspondingly, an embodiment of the present invention also provides a decryption system, including: a decapsulation module, used to decapsulate received broadcast data, the broadcast data including a key identifier and encrypted data, the key identifier having a corresponding preset key; a key acquisition module, used to acquire the corresponding preset key based on the key identifier obtained after decapsulation; and a decryption module, used to decrypt the encrypted data using the preset key corresponding to the key identifier.

[0009] Correspondingly, an embodiment of the present invention also provides a device, comprising at least one memory and at least one processor, wherein the memory stores one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the encryption method described in the embodiment of the present invention, or to implement the decryption method described in the embodiment of the present invention.

[0010] Correspondingly, an embodiment of the present invention further provides a storage medium, which stores one or more computer instructions, and the one or more computer instructions are used to implement the encryption method described in the embodiment of the present invention, or to implement the decryption method described in the embodiment of the present invention.

[0011] Compared with the prior art, the technical solution of the embodiment of the present invention has the following advantages:

[0012] In the encryption method provided in the embodiment of the present invention, a preset key is used to encrypt the broadcast information to obtain encrypted data, so as to improve the security of data interaction. Moreover, the preset key has a corresponding key identifier, and the encrypted data and the key identifier corresponding to the preset key are encapsulated as broadcast data, that is, the key identifier is indicated in the broadcast data. Then, after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, thereby improving the efficiency of data interaction. In addition, the method can be applied to application scenarios of one-to-many broadcast or many-to-one broadcast, and is more versatile.

[0013] In the decryption method provided by the embodiment of the present invention, after the received broadcast data is decapsulated, the corresponding preset key is obtained based on the key identifier in the broadcast data, and the encrypted data is decrypted using the preset key corresponding to the key identifier, thereby helping to improve the security of data interaction. Moreover, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, and thereby improving the efficiency of data interaction. In addition, the method can be applied to one-to-many broadcast or many-to-one broadcast application scenarios, and is more versatile. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of a flow chart of an embodiment of an encryption method of the present invention;

[0015] Figure 2 It is a flowchart of an embodiment of a decryption method of the present invention;

[0016] Figure 3 It is a data structure diagram of an embodiment of broadcast data of the present invention;

[0017] Figure 4 is a schematic diagram of an embodiment of a key management system of the present invention;

[0018] Figure 5 It is a schematic diagram of the structure of an embodiment of an encryption system of the present invention;

[0019] Figure 6 It is a structural diagram of an embodiment of a decryption system of the present invention;

[0020] Figure 7 A hardware structure diagram of a device provided in one embodiment of the present invention. DETAILED DESCRIPTION

[0021] As can be seen from the background technology, how to improve the efficiency of data interaction while improving data security has become an urgent problem to be solved.

[0022] In order to solve the technical problem, an embodiment of the present invention provides an encryption and decryption method.

[0023] The encryption method includes: encrypting the broadcast information with a preset key to obtain encrypted data, the preset key having a corresponding key identifier; encapsulating the encrypted data and the key identifier corresponding to the preset key into broadcast data. The decryption method includes: decapsulating the received broadcast data, the broadcast data including the key identifier and the encrypted data, the key identifier having a corresponding preset key; obtaining the corresponding preset key based on the key identifier obtained after decapsulation; and decrypting the encrypted data with the preset key corresponding to the key identifier.

[0024] The present invention uses a preset key to encrypt the broadcast information to obtain encrypted data, so as to improve the security of data interaction. Moreover, the key identifier is indicated in the broadcast data. Then, after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, and then improving the efficiency of data interaction. In addition, the method can be applied to one-to-many broadcast or many-to-one broadcast application scenarios, and is more versatile.

[0025] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0026] refer to Figure 1 , Figure 1 It is a flowchart of an embodiment of the encryption method of the present invention.

[0027] Step S101 is executed to encrypt the broadcast information using a preset key to obtain encrypted data, wherein the preset key has a corresponding key identifier.

[0028] On the broadcasting end side, the information it broadcasts is first encrypted, thereby improving the data security when the broadcast data is subsequently broadcast, and correspondingly improving the security of data interaction between the broadcasting end and the scanning end.

[0029] As an example, the broadcast end may be a user terminal with network capabilities, such as a personal computer (PC), a tablet computer or a smart phone, etc. Among them, an APP (application) or a desktop application may be installed in the user terminal to control the encryption and broadcasting of data.

[0030] The preset key has a corresponding key identifier, that is, there is a mapping relationship between the key identifier and the preset key, and the key identifier is used as an index for searching the preset key. Therefore, the key identifier is subsequently indicated in the broadcast data so that the scanning end can quickly find the corresponding preset key based on the key identifier and decrypt it, thereby reducing the complexity of data interaction between the broadcast end and the scanning end.

[0031] Specifically, a preset key and a corresponding key identifier are called from the local key library, and the broadcast information is encrypted using the called preset key. For example, a preset key can be randomly selected from the local key library, and the key identifier corresponding to the preset key is obtained accordingly.

[0032] The preset key and the corresponding key identifier are stored in a preset storage area locally on the broadcast end, so that the preset key and its corresponding key identifier can be quickly called, which is not only conducive to improving the efficiency of encryption, but also conducive to reducing the power consumption and hardware cost of the device.

[0033] Combined with reference Figure 4 , Figure 4 It is a schematic diagram of an embodiment of the key management system of the present invention. In one embodiment, the local key library can be obtained in the following manner: obtaining a preset key and a corresponding key identifier from the cloud server of the broadcast end, and storing the obtained preset key and the corresponding key identifier in a preset storage area locally on the broadcast end.

[0034] In this embodiment, the broadcast end is a user terminal with network capability, so the broadcast end can download the preset key and the corresponding key identifier online from its cloud server and store them locally.

[0035] As an example, the broadcast end establishes a secure connection with the cloud server, such as an HTTPS (Hypertext Transfer Protocol Secure) connection, thereby obtaining a preset key and a corresponding key identifier from the cloud server and ensuring improved data security.

[0036] It is understandable that in other embodiments, the broadcast end and the cloud server may also achieve other forms of secure connection.

[0037] In this embodiment, the broadcast information is encrypted by symmetric encryption, that is, the broadcast information is encrypted by using a symmetric encryption algorithm.

[0038] In symmetric encryption algorithms, the encryption and decryption keys are the same, which makes it easier for users to manage the keys. Moreover, the byte length of the keys used in symmetric encryption is shorter, which helps reduce the need to split the complete encrypted data.

[0039] Specifically, the symmetric encryption method includes but is not limited to an AES (Advanced Encryption Standard) encryption algorithm, a DES (Data Encryption Standard) encryption algorithm or a 3DES encryption algorithm.

[0040] Step S102 is executed to encapsulate the encrypted data and the key identifier corresponding to the preset key into broadcast data (AD data).

[0041] The encrypted data and the key identifier corresponding to the preset key are encapsulated as broadcast data so as to perform data interaction based on broadcasting, thereby improving the efficiency of data interaction.

[0042] Moreover, the data of the information to be broadcast has been encrypted, so that the information to be broadcast can be transmitted in ciphertext, thereby improving the security of data interaction between the broadcast end and the scanning end.

[0043] In addition, the key identifier and the encrypted data are encapsulated together in the broadcast data so that the key identifier is indicated in the broadcast data, and the key identifier has a corresponding relationship with the preset key used for encryption. Accordingly, after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, thereby improving the efficiency of data interaction, and can be applied to one-to-many broadcast or many-to-one broadcast application scenarios, with stronger versatility.

[0044] In this embodiment, the encrypted data and the key identifier corresponding to the preset key are packaged according to the data format of Bluetooth broadcasting, so that the data can be sent subsequently via Bluetooth broadcasting.

[0045] As an example, the data is encapsulated according to the data format of BLE broadcast. By adopting the low-power Bluetooth broadcast mode, it is beneficial to reduce the power consumption of the broadcast end.

[0046] Combined with reference Figure 3 , Figure 3 It is a data structure diagram of an embodiment of broadcast data of the present invention. In this embodiment, the encrypted data and the key identifier corresponding to the preset key are encapsulated into the broadcast data. The encrypted data can use a custom data type (AD Type), that is, the data type is 0xFF.

[0047] Specifically, the key identifier corresponding to the preset key is the header field of the broadcast data (AD data).

[0048] Since the key identifier is used as an index for obtaining the preset key, the key identifier is more important, so the key identifier is set as the header field of the broadcast data. Moreover, by setting the key identifier corresponding to the preset key in the header field of the broadcast data, the key identifier can be quickly obtained in the step of decapsulating the received broadcast data at the scanning end.

[0049] It should be noted that a broadcast data unit (AD Structure) of a broadcast packet usually includes three parts, namely length (Length), data type (AD type) and broadcast data, and the data type and broadcast data constitute the data part (Data) of the broadcast data unit, where the length represents the sum of the length of the data type and the broadcast data.

[0050] Specifically, in the data portion of the broadcast data unit, the first byte indicates the data type (AD type), and the remaining bytes are the broadcast data.

[0051] Therefore, the broadcast data here refers to: broadcast data corresponding to a specific data type.

[0052] In this embodiment, in the process of encapsulating the encrypted data and the key identifier corresponding to the preset key into broadcast data, the encrypted data is sub-packetized to obtain multiple broadcast data, each of which contains part of the encrypted data and the key identifier corresponding to the preset key.

[0053] By performing packet processing, it is convenient for subsequent group broadcasting.

[0054] It should be noted that after encrypting the broadcast information with a preset key, complete encrypted data is obtained. By subpacketizing the complete encrypted data, the byte length of the encrypted data in each broadcast data is shorter, which is beneficial to reduce the requirement for the maximum payload of the broadcast data, thereby better realizing the transmission of large amounts of data.

[0055] Specifically, when the length of the complete encrypted data is greater than the remaining payload of the broadcast data, the encrypted data is packetized so that the length of the encrypted data in each broadcast data is less than or equal to the remaining payload of the broadcast data.

[0056] Broadcast data usually has a specific payload size, and other data besides the encrypted data will also occupy a certain byte length. Therefore, by performing packet subpackaging, the length of the encrypted data in each broadcast data does not exceed the remaining payload size of the broadcast data, thereby ensuring that each broadcast data after packetization can be broadcast normally.

[0057] Here, the payload of the broadcast data refers to the remaining byte length in the broadcast data unit (AD Structure) after removing the byte length occupied by the length (Length).

[0058] Here, the remaining payload of the broadcast data refers to the maximum byte length of the broadcast data that can be provided to the encrypted data.

[0059] Among them, since the broadcast data also contains other data occupying byte length (for example, key identifier, group identifier, etc.), it is necessary to determine whether the original encrypted data needs to be subpacketized based on the remaining payload of the broadcast data.

[0060] For example, the byte length of a broadcast packet is 31 bytes. Excluding the 8 bytes occupied by the broadcast address, the payload of the broadcast data unit (AD Structure) is 23 bytes. The length (Length), data type (AD type), group identifier and key identifier will each occupy one byte (1B). Accordingly, the maximum byte length that can be provided to the encrypted data is 19 bytes. Therefore, when the byte length of the complete encrypted data is greater than or equal to 20 bytes, the complete encrypted data needs to be sub-packetized during the encapsulation process so that the length of the encrypted data in each broadcast data is less than 20 bytes, thereby performing group broadcasting.

[0061] Continue to refer Figure 3 In this embodiment, the key identifier, group identifier and encrypted data corresponding to the preset key are encapsulated as broadcast data, and the group identifier is used to represent the order of combining the encrypted data to obtain the complete encrypted data.

[0062] The group identifier is used to represent the order of combining the encrypted data in each broadcast data to obtain the complete encrypted data. Therefore, when the scanning end decapsulates the received broadcast data, it can combine the encrypted data according to the order of the group sequence number until the complete encrypted data is obtained.

[0063] In one embodiment, the group identifier includes a sub-packet sequence number and a total number of sub-packets of the encrypted data in the current broadcast data.

[0064] For example, the high bits of the group identifier represent the subpacket sequence number of the encrypted data, and the remaining low bits represent the total number of subpackets.

[0065] The sub-packet sequence number is used to indicate which group of data among all the encrypted data the encrypted data in any broadcast data belongs to, and the sub-packet sequence number is used to determine the order of data combination.

[0066] In data transmission based on Bluetooth broadcast, since the subpacket sequence number is used to determine the order of data combination, the subpacket sequence number is more important, and therefore, the subpacket sequence number is set at a high bit position.

[0067] The total number of sub-packets is used to represent the number of sub-packets of the complete encrypted data. Therefore, after the scanning end receives the broadcast data, it can determine how many broadcast data need to be received in total based on the total number of sub-packets to obtain the complete encrypted data.

[0068] For example, if the complete encrypted data is divided into 3 groups, then 3 broadcast data will be obtained accordingly. The subpacket number in the first broadcast data is 1, and the total number of subpackets is 3; similarly, the subpacket number in the second broadcast data is 2, and the total number of subpackets is 3; the subpacket number in the third broadcast data is 3, and the total number of subpackets is 3.

[0069] It should be noted that when the number of broadcast data is 1, the broadcast data still contains a group identifier, and the subpacket sequence number is equal to the total number of subpackets. For example, the subpacket sequence number is 1 and the total number of subpackets is 1.

[0070] like Figure 3 As shown, in a specific embodiment, in the step of encapsulating the key identifier, group identifier and encrypted data into broadcast data, the group identifier is located between the key identifier and the encrypted data, so that in the step of decapsulating the received broadcast data at the scanning end, the combination of the encrypted data can be more efficiently achieved.

[0071] Correspondingly, in this embodiment, after the encrypted data and the key identifier corresponding to the preset key are encapsulated as broadcast data, the broadcast data is broadcast so that the scanning end can scan and receive the broadcast data.

[0072] It should be noted that, since the broadcast data contains a key identifier, and there is a mapping relationship between the key identifier and the preset key, the method facilitates the broadcast end to update and maintain the preset key according to actual needs. Therefore, the method may also include updating and maintaining the preset key, for example, the updating and maintenance may be performed in one or more of the following ways: updating the preset key; updating the mapping relationship between the key identifier and the preset key.

[0073] As an example, the broadcast end may re-download the updated preset key and its corresponding key identifier from the cloud server.

[0074] Accordingly, an embodiment of the present invention also provides a decryption method. Figure 2 , Figure 2 It is a flowchart of an embodiment of a decryption method of the present invention.

[0075] Step S201 is executed to decapsulate the received broadcast data, where the broadcast data includes a key identifier and encrypted data, and the key identifier has a corresponding preset key.

[0076] On the scanning end side, decapsulation is performed to extract the secret key identifier and encrypted data in the broadcast data sent by the broadcast end, so that the secret key identifier can be used to decrypt the encrypted data in the broadcast data later.

[0077] The scanning end receives broadcast data by scanning, so that data interaction can be performed based on the broadcasting method, thereby improving the efficiency of data interaction.

[0078] The broadcast data includes encrypted data, so that the information to be broadcast in the broadcast data can be transmitted in ciphertext, thereby improving the security of data interaction between the broadcast end and the scanning end.

[0079] In this embodiment, the preset key has a corresponding key identifier, that is, there is a mapping relationship between the key identifier and the preset key, and the key identifier is used as an index for searching the preset key. Therefore, the scanning end can quickly find the corresponding preset key based on the key identifier and decrypt it, thereby reducing the complexity of data interaction between the scanning end and the broadcasting end.

[0080] In this embodiment, the broadcast data is encapsulated according to the data format of Bluetooth broadcast, that is, the broadcast data is sent to the scanning end through Bluetooth broadcast, and correspondingly, the scanning end receives the broadcast data through Bluetooth scanning.

[0081] As an example, the broadcast data is encapsulated in the data format of BLE broadcast, so the scanning end receives the broadcast data by BLE scanning. By adopting the low-power Bluetooth scanning method, it is beneficial to reduce the power consumption of the scanning end.

[0082] As an example, the scanning end may be an IOT (Internet Of Things) device without network capability.

[0083] In other embodiments, the scanning end may also be a device with network capabilities.

[0084] Combined with reference Figure 3 , Figure 3 It is a data structure diagram of an embodiment of broadcast data of the present invention. In this embodiment, the key identifier corresponding to the preset key is the header field of the broadcast data.

[0085] In this embodiment, there are multiple broadcast data, each broadcast data includes a key identifier and encrypted data, and the encrypted data of the multiple broadcast data are used to form complete encrypted data.

[0086] Specifically, in order to reduce the requirement for the maximum payload size of broadcast data and to better realize data transmission, the broadcast end will sub-packetize the encrypted data when encapsulating the data. Therefore, the scanning end needs to receive multiple broadcast data in order to subsequently combine the encrypted data in the multiple broadcast data into complete encrypted data.

[0087] For example, broadcast data usually has a specific payload size, and other data besides encrypted data will also occupy a certain byte length. Therefore, by performing packet subpackaging, the length of the encrypted data in each broadcast data does not exceed the remaining payload size of the broadcast data, thereby ensuring that each broadcast data after packetization can be broadcast normally.

[0088] Here, the payload of the broadcast data refers to the remaining byte length in the broadcast data unit (AD Structure) after removing the byte length occupied by the length (Length).

[0089] In this embodiment, the length of the encrypted data in each broadcast data is less than or equal to the remaining payload of the broadcast data.

[0090] Here, the remaining payload of the broadcast data refers to the maximum byte length of the broadcast data that can be provided to the encrypted data.

[0091] Since the broadcast data also contains other data occupying byte length (for example, key identifier, group identifier, etc.), it is necessary to ensure that the length of the encrypted data in each broadcast data is less than or equal to the remaining payload of the broadcast data.

[0092] For example, the byte length of a broadcast packet is 31 bytes. Excluding the 8 bytes occupied by the broadcast address, the payload of the broadcast data unit (AD Structure) is 23 bytes. The length (Length), data type (AD type), group identifier and key identifier will each occupy one byte (1B). Accordingly, the maximum byte length that can be provided for encrypted data is 19 bytes. Therefore, the length of the encrypted data in each broadcast data is less than 20 bytes.

[0093] In a specific embodiment, the broadcast data includes a key identifier, a group identifier, and encrypted data, and the group identifier is used to represent the order of combining the encrypted data to obtain the complete encrypted data.

[0094] The group identifier is used to represent the order of combining the encrypted data in each broadcast data to obtain the complete encrypted data. Therefore, in the step of decapsulating the received broadcast data at the scanning end, the encrypted data can be combined according to the order of the group sequence number until the complete encrypted data is obtained.

[0095] In one embodiment, the group identifier includes the subpacket sequence number and the total number of subpackets of the encrypted data in the current broadcast data. For example, the high bit of the group identifier indicates the subpacket sequence number of the encrypted data, and the remaining low bits indicate the total number of subpackets.

[0096] The sub-packet sequence number is used to indicate which group of data among all the encrypted data the encrypted data in any broadcast data belongs to, and the sub-packet sequence number is used to determine the order of data combination.

[0097] The total number of sub-packets is used to represent the number of sub-packets of the complete encrypted data. Therefore, after the scanning end receives the broadcast data, it can determine how many broadcast data need to be received in total based on the total number of sub-packets to obtain the complete encrypted data.

[0098] For example, the number of broadcast data received by the scanning end is 3, the subpacket sequence number in the first broadcast data is 1, and the total number of subpackets is 3; similarly, the subpacket sequence number in the second broadcast data is 2, and the total number of subpackets is 3; the subpacket sequence number in the third broadcast data is 3, and the total number of subpackets is 3.

[0099] It should be noted that when the number of broadcast data is 1, the broadcast data still contains a group identifier, and the subpacket sequence number is equal to the total number of subpackets. For example, the subpacket sequence number is 1 and the total number of subpackets is 1.

[0100] like Figure 3 As shown, in a specific embodiment, in the broadcast data, the group identifier is located between the key identifier and the encrypted data.

[0101] It should be noted that, in this embodiment, the broadcast data is obtained by the encryption method described in the above embodiment. For the specific description of the broadcast data, reference may be made to the relevant description of the above embodiment.

[0102] In this embodiment, during the decapsulation of the received broadcast data, the encrypted data in a plurality of the broadcast data are combined to obtain complete encrypted data.

[0103] Since the complete encrypted data has been split into different broadcast data by means of packet processing, and each broadcast data contains part of the encrypted data, it is necessary to combine the encrypted data in multiple broadcast data to form the complete encrypted data.

[0104] In this embodiment, the group identifier is used to represent the order of combining the encrypted data to obtain the complete encrypted data. Therefore, in the process of decapsulating the received broadcast data, the complete encrypted data is obtained based on the group identifier.

[0105] Specifically, obtaining complete encrypted data based on the group identifier includes: performing combination of encrypted data according to the order of the sub-packet sequence numbers until the total number of sub-packets is reached.

[0106] The total number of sub-packets is used to represent the number of sub-packets of the complete encrypted data. Therefore, when the number of combined encrypted data reaches the total number of sub-packets, it is considered that the complete encrypted data is obtained.

[0107] Execute step S202 to obtain the corresponding preset key based on the key identifier obtained after decapsulation.

[0108] After decapsulating the broadcast data, the key identifier in the broadcast data is obtained, and the key identifier has a corresponding preset key, so that the corresponding preset key can be obtained according to the mapping relationship between the key identifier and the preset key, thereby preparing for subsequent decryption operations.

[0109] In this embodiment, obtaining the corresponding preset key based on the key identifier obtained after decapsulation includes: using the key identifier to search in a local key library to call the preset key corresponding to the key identifier.

[0110] The preset key and the corresponding key identifier are stored in a preset storage area locally on the scanning end, so that the preset key corresponding to the key identifier can be quickly called, which is not only conducive to improving the efficiency of decryption, but also conducive to reducing the power consumption and hardware cost of the device.

[0111] Combined with reference Figure 4 , Figure 4 It is a schematic diagram of an embodiment of the key management system of the present invention. Specifically, the local key library can be obtained in the following manner: obtaining a preset key and a corresponding key identifier from a cloud server, and storing the obtained preset key and the corresponding key identifier in a local preset storage area.

[0112] As an example, the burning tool establishes a secure connection with the cloud server, such as an HTTPS (Hypertext Transfer Protocol Secure) connection, and obtains a preset key and a corresponding key identifier from the cloud server, and then stores them in a local preset storage area by burning, which helps ensure data security.

[0113] In other embodiments, the burning tool and the cloud server may also be securely connected in other ways.

[0114] It can be understood that in other embodiments, the scanning end can also be a device with network capabilities, and the scanning end can also directly establish a secure connection with the cloud server, thereby obtaining the preset key and the corresponding key identifier from the cloud server, and storing the obtained preset key and the corresponding key identifier in the local preset storage area.

[0115] Execute step S203 to decrypt the encrypted data using the preset key corresponding to the key identifier.

[0116] The encrypted data is decrypted to obtain the information to be broadcasted sent by the broadcasting end to the scanning end.

[0117] The key identifier and encrypted data are encapsulated together in the broadcast data so that the key identifier is indicated in the broadcast data, and the key identifier corresponds to the preset key used for encryption. Accordingly, after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, thereby improving the efficiency of data interaction, and can be applied to one-to-many broadcast or many-to-one broadcast application scenarios, with stronger versatility.

[0118] In this embodiment, the encrypted data is decrypted using the preset key corresponding to the key identifier, including: decrypting the encrypted data by symmetric decryption, that is, the preset key used for decryption and encryption is the same.

[0119] In the symmetric decryption method, the encryption and decryption keys are the same, which makes it easier for users to manage the keys; moreover, the byte length of the key used in symmetric encryption is shorter, which helps reduce the need to split the complete encrypted data.

[0120] It should be noted that, since the broadcast data contains a key identifier, and there is a mapping relationship between the key identifier and the preset key, the method is also convenient for updating and maintaining the preset key according to actual needs. Therefore, the method may also include updating and maintaining the preset key, for example, the updating and maintenance may be performed in one or more of the following ways: updating the preset key; updating the mapping relationship between the key identifier and the preset key.

[0121] As an example, the scanning end can obtain the updated preset key and its corresponding key identifier through Bluetooth firmware Over The Air (OTA) upgrade.

[0122] Correspondingly, an embodiment of the present invention also provides an encryption system. Figure 5 It is a schematic diagram of the structure of an encryption system according to an embodiment of the present invention.

[0123] The encryption system comprises: an encryption module 11, used to encrypt the broadcast information with a preset key to obtain encrypted data, wherein the preset key has a corresponding key identifier; and an encapsulation module 12, used to encapsulate the encrypted data and the key identifier corresponding to the preset key into broadcast data.

[0124] On the broadcasting end side, the information it broadcasts is first encrypted, thereby improving the data security when the broadcast data is subsequently broadcast, and correspondingly improving the security of data interaction between the broadcasting end and the scanning end.

[0125] As an example, the broadcast end may be a user terminal with network capabilities, such as a personal computer, a tablet computer, or a smart phone, etc. Among them, an APP or a desktop application may be installed in the user terminal to control the encryption and broadcasting of data.

[0126] The preset key has a corresponding key identifier, that is, there is a mapping relationship between the key identifier and the preset key, and the key identifier is used as an index for searching the preset key. Therefore, the key identifier is subsequently indicated in the broadcast data so that the scanning end can quickly find the corresponding preset key based on the key identifier and decrypt it, thereby reducing the complexity of data interaction between the broadcast end and the scanning end.

[0127] Specifically, the encryption module 11 calls a preset key and a corresponding key identifier from the local key library, and uses the called preset key to encrypt the broadcast information. For example, a preset key can be randomly selected from the local key library, and a key identifier corresponding to the preset key can be obtained accordingly.

[0128] The preset key and the corresponding key identifier are stored in a preset storage area locally on the broadcast end, so that the preset key and its corresponding key identifier can be quickly called, which is not only conducive to improving the efficiency of encryption, but also conducive to reducing the power consumption and hardware cost of the device.

[0129] Combined with reference Figure 4 , Figure 4 It is a schematic diagram of an embodiment of the key management system of the present invention. In one embodiment, the local key library can be obtained in the following manner: obtaining a preset key and a corresponding key identifier from the cloud server of the broadcast end, and storing the obtained preset key and the corresponding key identifier in a preset storage area locally on the broadcast end.

[0130] In this embodiment, the broadcast end is a user terminal with network capability, so the broadcast end can download the preset key and the corresponding key identifier online from its cloud server and store them locally.

[0131] As an example, the broadcast end realizes a secure connection with the cloud server, such as an HTTPS connection, so as to obtain a preset key and a corresponding key identifier from the cloud server and ensure improved data security.

[0132] It is understandable that in other embodiments, the broadcast end and the cloud server may also achieve other forms of secure connection.

[0133] In this embodiment, the encryption module 11 encrypts the broadcast information by symmetric encryption. That is, the encryption module 11 uses a symmetric encryption algorithm to encrypt the broadcast information.

[0134] In symmetric encryption algorithms, the encryption and decryption keys are the same, which makes it easier for users to manage the keys. Moreover, the byte length of the keys used in symmetric encryption is shorter, which helps reduce the need to split the complete encrypted data.

[0135] Specifically, the symmetric encryption method includes but is not limited to the AES encryption algorithm, the DES encryption algorithm or the 3DES encryption algorithm.

[0136] The encapsulation module 12 encapsulates the encrypted data and the key identifier corresponding to the preset key into broadcast data (ADdata) so as to perform data interaction based on broadcasting, thereby improving the efficiency of data interaction.

[0137] Moreover, the data of the information to be broadcast has been encrypted, so that the information to be broadcast can be transmitted in ciphertext, thereby improving the security of data interaction between the broadcast end and the scanning end.

[0138] In addition, the encapsulation module 12 encapsulates the key identifier and the encrypted data into the broadcast data together so as to indicate the key identifier in the broadcast data, and the key identifier has a corresponding relationship with the preset key used for encryption. Accordingly, after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, thereby improving the efficiency of data interaction, and can be applied to one-to-many broadcast or many-to-one broadcast application scenarios, with stronger versatility.

[0139] In this embodiment, the encapsulation module 12 encapsulates the encrypted data and the key identifier corresponding to the preset key according to the data format of Bluetooth broadcast, so as to subsequently send the data through Bluetooth broadcast.

[0140] As an example, the encapsulation module 12 performs encapsulation according to the data format of BLE broadcast. By adopting the low-power Bluetooth broadcast mode, it is beneficial to reduce the power consumption of the broadcast end.

[0141] Combined with reference Figure 3 , Figure 3 It is a data structure diagram of an embodiment of broadcast data of the present invention. In this embodiment, the encrypted data can use a custom data type (AD Type), that is, the data type is 0xFF.

[0142] Specifically, the key identifier corresponding to the preset key is the header field of the broadcast data (AD data).

[0143] Since the key identifier is used as an index for obtaining the preset key, the key identifier is more important, so the key identifier is set as the header field of the broadcast data. Moreover, by setting the key identifier corresponding to the preset key in the header field of the broadcast data, the key identifier can be quickly obtained in the step of decapsulating the received broadcast data at the scanning end.

[0144] It should be noted that a broadcast data unit (AD Structure) of a broadcast packet usually includes three parts, namely length (Length), data type (AD type) and broadcast data, and the data type and broadcast data constitute the data part (Data) of the broadcast data unit, where the length represents the sum of the length of the data type and the broadcast data.

[0145] Specifically, in the data portion of the broadcast data unit, the first byte indicates the data type (AD type), and the remaining bytes are the broadcast data.

[0146] Therefore, the broadcast data here refers to: broadcast data corresponding to a specific data type.

[0147] In this embodiment, when the encapsulation module 12 encapsulates the encrypted data and the key identifier corresponding to the preset key into broadcast data, the encrypted data is sub-packetized to obtain multiple broadcast data, each of which contains part of the encrypted data and the key identifier corresponding to the preset key.

[0148] By performing packet processing, it is convenient for subsequent group broadcasting.

[0149] It should be noted that after encrypting the broadcast information with a preset key, complete encrypted data is obtained. By subpacketizing the complete encrypted data, the byte length of the encrypted data in each broadcast data is shorter, which is beneficial to reduce the requirement for the maximum payload of the broadcast data, thereby better realizing the transmission of large amounts of data.

[0150] Specifically, when the length of the complete encrypted data is greater than the remaining payload of the broadcast data, the encrypted data is packetized so that the length of the encrypted data in each broadcast data is less than or equal to the remaining payload of the broadcast data.

[0151] Broadcast data usually has a specific payload size, and other data besides the encrypted data will also occupy a certain byte length. Therefore, by performing packet subpackaging, the length of the encrypted data in each broadcast data does not exceed the remaining payload size of the broadcast data, thereby ensuring that each broadcast data after packetization can be broadcast normally.

[0152] Here, the payload of the broadcast data refers to the remaining byte length in the broadcast data unit (AD Structure) after removing the byte length occupied by the length (Length).

[0153] Here, the remaining payload of the broadcast data refers to the maximum byte length of the broadcast data that can be provided to the encrypted data.

[0154] Among them, since the broadcast data also contains other data occupying byte length (for example, key identifier, group identifier, etc.), it is necessary to determine whether the original encrypted data needs to be subpacketized based on the remaining payload of the broadcast data.

[0155] Continue to refer Figure 3 In this embodiment, the encapsulation module 12 encapsulates the key identifier, group identifier and encrypted data corresponding to the preset key into broadcast data, and the group identifier is used to represent the order of combining the encrypted data to obtain the complete encrypted data.

[0156] The group identifier is used to represent the order of combining the encrypted data in each broadcast data to obtain the complete encrypted data. Therefore, when the scanning end decapsulates the received broadcast data, it can combine the encrypted data according to the order of the group sequence number until the complete encrypted data is obtained.

[0157] In one embodiment, the group identifier includes a sub-packet sequence number and a total number of sub-packets of the encrypted data in the current broadcast data.

[0158] For example, the high bits of the group identifier represent the subpacket sequence number of the encrypted data, and the remaining low bits represent the total number of subpackets.

[0159] The sub-packet sequence number is used to indicate which group of data among all the encrypted data the encrypted data in any broadcast data belongs to, and the sub-packet sequence number is used to determine the order of data combination.

[0160] In data transmission based on Bluetooth broadcast, since the subpacket sequence number is used to determine the order of data combination, the subpacket sequence number is more important, and therefore, the subpacket sequence number is set at a high bit position.

[0161] The total number of sub-packets is used to represent the number of sub-packets of the complete encrypted data. Therefore, after the scanning end receives the broadcast data, it can determine how many broadcast data need to be received in total based on the total number of sub-packets to obtain the complete encrypted data.

[0162] It should be noted that when the number of broadcast data is 1, the broadcast data still contains a group identifier, and the subpacket sequence number is equal to the total number of subpackets. For example, the subpacket sequence number is 1 and the total number of subpackets is 1.

[0163] like Figure 3 As shown, in a specific embodiment, in the broadcast data, the group identifier is located between the key identifier and the encrypted data, so that in the step of decapsulating the received broadcast data at the scanning end, the combination of the encrypted data can be more efficiently achieved.

[0164] Correspondingly, in this embodiment, the encryption system may further include: a broadcast module (not shown) for broadcasting the broadcast data so that the scanning end can scan and receive the broadcast data.

[0165] It should be noted that, since the broadcast data contains a key identifier, and there is a mapping relationship between the key identifier and the preset key, the encryption system is convenient for updating and maintaining the preset key according to actual needs. The encryption system may also include: an update module (not shown) for updating and maintaining the preset key. For example, the update module may perform update and maintenance in one or more of the following ways: updating the preset key; updating the mapping relationship between the key identifier and the preset key.

[0166] As an example, the update module may re-download the updated preset key and its corresponding key identifier from the cloud server.

[0167] As an example, the encryption system is used to execute the aforementioned encryption method. For a specific description of the encryption system, reference may be made to the specific description of the aforementioned encryption method.

[0168] Correspondingly, an embodiment of the present invention also provides a decryption system. Figure 6 It is a structural diagram of an embodiment of a decryption system of the present invention.

[0169] The decryption system includes: a decapsulation module 21, used to decapsulate the received broadcast data, the broadcast data including a key identifier and encrypted data, the key identifier having a corresponding preset key; a key acquisition module 22, used to acquire the corresponding preset key based on the key identifier obtained after decapsulation; and a decryption module 23, used to decrypt the encrypted data using the preset key corresponding to the key identifier.

[0170] On the scanning end side, the decapsulation module 21 is used to decapsulate the data to extract the key identifier and the encrypted data in the broadcast data sent by the broadcast end, so that the encrypted data in the broadcast data can be decrypted using the key identifier later.

[0171] The scanning end receives broadcast data by scanning, so that data interaction can be performed based on the broadcasting method, thereby improving the efficiency of data interaction.

[0172] Correspondingly, in this embodiment, the decryption system may further include: a scanning module (not shown) for scanning and receiving broadcast data.

[0173] The broadcast data includes encrypted data, so that the information to be broadcast in the broadcast data can be transmitted in ciphertext, thereby improving the security of data interaction between the broadcast end and the scanning end.

[0174] In this embodiment, the preset key has a corresponding key identifier, that is, there is a mapping relationship between the key identifier and the preset key, and the key identifier is used as an index for searching the preset key. Therefore, the scanning end can quickly find the corresponding preset key based on the key identifier and decrypt it, thereby reducing the complexity of data interaction between the scanning end and the broadcasting end.

[0175] In this embodiment, the broadcast data is encapsulated according to the data format of Bluetooth broadcast, that is, the broadcast data is sent to the scanning end through Bluetooth broadcast, and correspondingly, the scanning end receives the broadcast data through Bluetooth scanning.

[0176] As an example, the broadcast data is encapsulated in the data format of BLE broadcast, so the scanning end receives the broadcast data by BLE scanning. By adopting the low-power Bluetooth scanning method, it is beneficial to reduce the power consumption of the scanning end.

[0177] As an example, the scanning end may be an IOT device without network capability. In other embodiments, the scanning end may also be a device with network capability.

[0178] Combined with reference Figure 3 , Figure 3 It is a data structure diagram of an embodiment of broadcast data of the present invention. In this embodiment, the key identifier corresponding to the preset key is the header field of the broadcast data.

[0179] In this embodiment, there are multiple broadcast data, each broadcast data includes a key identifier and encrypted data, and the encrypted data of the multiple broadcast data are used to form complete encrypted data.

[0180] Specifically, in order to reduce the requirement for the maximum payload size of broadcast data and to better realize data transmission, the broadcast end will sub-packetize the encrypted data when encapsulating the data. Therefore, the scanning end needs to receive multiple broadcast data in order to subsequently combine the encrypted data in the multiple broadcast data into complete encrypted data.

[0181] For example, broadcast data usually has a specific payload size, and other data besides encrypted data will also occupy a certain byte length. Therefore, by performing packet subpackaging, the length of the encrypted data in each broadcast data does not exceed the remaining payload size of the broadcast data, thereby ensuring that each broadcast data after packetization can be broadcast normally.

[0182] In this embodiment, the length of the encrypted data in each broadcast data is less than or equal to the remaining payload of the broadcast data.

[0183] In a specific embodiment, the broadcast data includes a key identifier, a group identifier, and encrypted data, and the group identifier is used to represent the order of combining the encrypted data to obtain the complete encrypted data.

[0184] The group identifier is used to represent the order of combining the encrypted data in each broadcast data to obtain the complete encrypted data. Therefore, in the step of decapsulating the received broadcast data at the scanning end, the encrypted data can be combined according to the order of the group sequence number until the complete encrypted data is obtained.

[0185] In one embodiment, the group identifier includes the subpacket sequence number and the total number of subpackets of the encrypted data in the current broadcast data. For example, the high bit of the group identifier indicates the subpacket sequence number of the encrypted data, and the remaining low bits indicate the total number of subpackets.

[0186] The sub-packet sequence number is used to indicate which group of data among all the encrypted data the encrypted data in any broadcast data belongs to, and the sub-packet sequence number is used to determine the order of data combination.

[0187] The total number of sub-packets is used to represent the number of sub-packets of the complete encrypted data. Therefore, after the scanning end receives the broadcast data, it can determine how many broadcast data need to be received in total based on the total number of sub-packets to obtain the complete encrypted data.

[0188] It should be noted that when the number of broadcast data is 1, the broadcast data still contains a group identifier, and the subpacket sequence number is equal to the total number of subpackets. For example, the subpacket sequence number is 1 and the total number of subpackets is 1.

[0189] like Figure 3 As shown, in a specific embodiment, in the broadcast data, the group identifier is located between the key identifier and the encrypted data.

[0190] In this embodiment, during the decapsulation process, the decapsulation module 21 combines the encrypted data in the plurality of broadcast data to obtain complete encrypted data.

[0191] Since the complete encrypted data has been split into different broadcast data by means of packet processing, and each broadcast data contains part of the encrypted data, it is necessary to combine the encrypted data in multiple broadcast data to form the complete encrypted data.

[0192] In this embodiment, the decapsulation module 21 obtains complete encrypted data based on the group identifier during the decapsulation process.

[0193] Specifically, the decapsulation module 21 performs the combination of the encrypted data according to the order of the sub-packet numbers until the total number of sub-packets is reached.

[0194] The total number of sub-packets is used to represent the number of sub-packets of the complete encrypted data. Therefore, when the number of combined encrypted data reaches the total number of sub-packets, it is considered that the complete encrypted data is obtained.

[0195] The key identifier in the broadcast data is obtained through the decapsulation module 21, and the key identifier has a corresponding preset key. Therefore, the key acquisition module 22 can obtain the corresponding preset key according to the mapping relationship between the key identifier and the preset key, and then prepare for subsequent decryption operations.

[0196] In this embodiment, the key acquisition module 22 uses the key identifier to search in the local key library to call the preset key corresponding to the key identifier.

[0197] The preset key and the corresponding key identifier are stored in a preset storage area locally on the scanning end, so that the preset key corresponding to the key identifier can be quickly called, which is not only conducive to improving the efficiency of decryption, but also conducive to reducing the power consumption and hardware cost of the device.

[0198] Combined with reference Figure 4 , Figure 4 It is a schematic diagram of an embodiment of the key management system of the present invention. Specifically, the local key library can be obtained in the following manner: obtaining a preset key and a corresponding key identifier from a cloud server, and storing the obtained preset key and the corresponding key identifier in a local preset storage area.

[0199] As an example, the burning tool establishes a secure connection with the cloud server, such as an HTTPS (Hypertext Transfer Protocol Secure) connection, and obtains a preset key and a corresponding key identifier from the cloud server, and then stores them in a local preset storage area by burning, which helps ensure data security.

[0200] It can be understood that in other embodiments, the scanning end can also be a device with network capabilities, and the scanning end can also directly establish a secure connection with the cloud server, thereby obtaining the preset key and the corresponding key identifier from the cloud server, and storing the obtained preset key and the corresponding key identifier in the local preset storage area.

[0201] The decryption module 23 decrypts the encrypted data to obtain the information to be broadcasted sent by the broadcasting end to the scanning end.

[0202] The key identifier and encrypted data are encapsulated together in the broadcast data so that the key identifier is indicated in the broadcast data, and the key identifier corresponds to the preset key used for encryption. Accordingly, after receiving the broadcast data, the scanning end can obtain the corresponding preset key through the key identifier and decrypt it. Therefore, there is no need to exchange keys between the broadcast end and the scanning end of the broadcast data, thereby reducing the complexity of data interaction between the broadcast end and the scanning end, thereby improving the efficiency of data interaction, and can be applied to one-to-many broadcast or many-to-one broadcast application scenarios, with stronger versatility.

[0203] In this embodiment, the decryption module 23 decrypts the encrypted data by symmetric decryption, that is, the preset key used for decryption and encryption is the same.

[0204] In the symmetric decryption method, the encryption and decryption keys are the same, which makes it easier for users to manage the keys; moreover, the byte length of the key used in symmetric encryption is shorter, which helps reduce the need to split the complete encrypted data.

[0205] It should be noted that, since the broadcast data contains a key identifier, and there is a mapping relationship between the key identifier and the preset key, the decryption system can update and maintain the preset key according to actual needs. The decryption system may also include: an update module for updating and maintaining the preset key. For example, the update module may perform update and maintenance in one or more of the following ways: updating the preset key; updating the mapping relationship between the key identifier and the preset key.

[0206] As an example, the update module may obtain the updated preset key and its corresponding key identifier through OTA.

[0207] Correspondingly, an embodiment of the present invention further provides a device, which can implement the encryption method or decryption method provided by the embodiment of the present invention by loading the above encryption method or decryption method in the form of a program.

[0208] refer to Figure 7, shows a hardware structure diagram of an electronic device provided by an embodiment of the present invention. The device of this embodiment includes: at least one processor 01, at least one communication interface 02, at least one memory 03 and at least one communication bus 04.

[0209] In this embodiment, the number of each of the processor 01 , the communication interface 02 , the memory 03 and the communication bus 04 is at least one, and the processor 01 , the communication interface 02 and the memory 03 communicate with each other via the communication bus 04 .

[0210] The communication interface 02 may be an interface of a communication module for network communication, such as an interface of a GSM module.

[0211] The processor 01 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the method described in this embodiment.

[0212] The memory 03 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory. The memory 03 stores one or more computer instructions, and the one or more computer instructions are executed by the processor 01 to implement the encryption method or decryption method provided in the above-mentioned embodiment.

[0213] It should be noted that the above-mentioned electronic device may also include other devices (not shown) that may not be necessary for understanding the contents disclosed in the embodiments of the present invention; since these other devices may not be necessary for understanding the contents disclosed in the embodiments of the present invention, the embodiments of the present invention will not introduce them one by one.

[0214] An embodiment of the present invention further provides a storage medium, wherein the storage medium stores one or more computer instructions, and the one or more computer instructions are used to implement the encryption method or decryption method provided by the aforementioned embodiment.

[0215] The above-mentioned embodiments of the present invention are combinations of elements and features of the present invention. Unless otherwise mentioned, elements or features may be considered as optional. Each element or feature may be put into practice without being combined with other elements or features. In addition, embodiments of the present invention may be constructed by combining some elements and / or features. The order of operations described in the embodiments of the present invention may be rearranged. Some configurations of any one embodiment may be included in another embodiment, and may be replaced by the corresponding configuration of another embodiment. It is obvious to those skilled in the art that claims that do not have a clear reference relationship to each other in the attached claims may be combined into embodiments of the present invention, or may be included as new claims in the amendment after submitting this application.

[0216] The embodiments of the present invention can be implemented by various means such as hardware, firmware, software or a combination thereof. In a hardware configuration, the method according to the exemplary embodiment of the present invention can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, etc.

[0217] In a firmware or software configuration, the embodiments of the present invention may be implemented in the form of modules, procedures, functions, etc. The software code may be stored in a memory unit and executed by a processor. The memory unit is located inside or outside the processor and may send data to and receive data from the processor via various known means.

[0218] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those 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.

[0219] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.

Claims

1. An encryption method, characterized in that: include: Encrypting the broadcast information using a preset key to obtain encrypted data, wherein the preset key has a corresponding key identifier; The encrypted data and the key identifier corresponding to the preset key are encapsulated as broadcast data.

2. The encryption method according to claim 1, wherein: When the preset key is used to encrypt the broadcast information, the preset key and the corresponding key identifier are called from the local key library.

3. The encryption method according to claim 2, characterized in that: The method of obtaining the local key library includes: obtaining a preset key and a corresponding key identifier from a cloud server, and storing the obtained preset key and the corresponding key identifier in a local preset storage area.

4. The encryption method according to claim 1, wherein: In the process of encapsulating the encrypted data and the key identifier corresponding to the preset key into broadcast data, the encrypted data is sub-packetized to obtain multiple broadcast data, each of which contains part of the encrypted data and the key identifier corresponding to the preset key.

5. The encryption method according to claim 4, characterized in that: When the length of the complete encrypted data is greater than the remaining payload of the broadcast data, the encrypted data is packetized so that the length of the encrypted data in each broadcast data is less than or equal to the remaining payload.

6. The encryption method according to claim 1, wherein: In the process of encapsulating the encrypted data and the key identifier corresponding to the preset key into broadcast data, the key identifier corresponding to the preset key is the header field of the broadcast data.

7. The encryption method according to any one of claims 1 to 6, characterized in that: The key identifier, group identifier and encrypted data corresponding to the preset key are encapsulated as broadcast data, and the group identifier is used to represent the order of combining the encrypted data to obtain the complete encrypted data.

8. The encryption method according to claim 7, characterized in that: The group identifier includes the sub-packet sequence number and the total number of sub-packets of the encrypted data in the current broadcast data.

9. The encryption method according to any one of claims 1 to 6, characterized in that: The broadcast information is encrypted by symmetric encryption.

10. A decryption method, characterized in that: include: Decapsulating received broadcast data, the broadcast data comprising a key identifier and encrypted data, the key identifier having a corresponding preset key; Obtaining a corresponding preset key based on the key identifier obtained after decapsulation; The encrypted data is decrypted using the preset key corresponding to the key identifier.

11. The decryption method according to claim 10, characterized in that: Acquiring a corresponding preset key based on the key identifier obtained after decapsulation includes: using the key identifier to search in a local key library to call the preset key corresponding to the key identifier.

12. The decryption method according to claim 11, characterized in that: The method of obtaining the local key library includes: obtaining a preset key and a corresponding key identifier from a cloud server, and storing the obtained preset key and the corresponding key identifier in a local preset storage area.

13. The decryption method according to claim 10, characterized in that: There are multiple broadcast data, each broadcast data includes a key identifier and encrypted data, and the encrypted data of the multiple broadcast data are used to form complete encrypted data; In the process of decapsulating the received broadcast data, the encrypted data in the plurality of broadcast data are combined to obtain complete encrypted data.

14. The decryption method according to any one of claims 10 to 13, characterized in that: The broadcast data includes a key identifier, a group identifier, and encrypted data, wherein the group identifier is used to represent the order in which the encrypted data is combined to obtain the complete encrypted data; In the process of decapsulating the received broadcast data, the complete encrypted data is obtained based on the group identifier.

15. The decryption method according to claim 14, characterized in that: The group identifier includes the sub-packet sequence number and the total number of sub-packets of the encrypted data in the current broadcast data; Obtaining complete encrypted data based on the group identifier includes: performing combination of encrypted data according to the order of the sub-packet sequence numbers until the total number of sub-packets is reached.

16. The decryption method according to any one of claims 10 to 13, characterized in that: The encrypted data is decrypted using a preset key corresponding to the key identifier, including: decrypting the encrypted data by symmetric decryption.

17. An encryption system, characterized in that: include: An encryption module, used to encrypt the broadcast information using a preset key to obtain encrypted data, wherein the preset key has a corresponding key identifier; The encapsulation module is used to encapsulate the encrypted data and the key identifier corresponding to the preset key into broadcast data.

18. A decryption system, characterized in that: include: A decapsulation module, used to decapsulate received broadcast data, wherein the broadcast data includes a key identifier and encrypted data, and the key identifier has a corresponding preset key; A key acquisition module, used to acquire a corresponding preset key based on the key identifier obtained after decapsulation; The decryption module is used to decrypt the encrypted data using a preset key corresponding to the key identifier.

19. A device, characterized in that It comprises at least one memory and at least one processor, wherein the memory stores one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the encryption method as described in any one of claims 1 to 9, or to implement the decryption method as described in any one of claims 10 to 16.

20. A storage medium, characterized in that: The storage medium stores one or more computer instructions, and the one or more computer instructions are used to implement the encryption method as described in any one of claims 1-9, or to implement the decryption method as described in any one of claims 10-16.