A low-power Bluetooth upgrade encryption method and its system, device, and medium

Through streaming processing technology and dynamically adjusting Bluetooth power, the efficiency and security problems of existing encryption algorithms on miniaturized devices are solved, and efficient data encryption, decryption and upgrade are achieved, ensuring low power consumption and high equipment Security.

CN119031365BActive Publication Date: 2025-01-10XIAMEN FOUR-FAITH SMART POWER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411455185.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-01-10
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

The existing encryption algorithms are low in efficiency in small packet processing, cannot meet real-time requirements, consume too much energy, limited adaptability, cannot ensure long-term operation security, and are prone to insufficient memory on miniaturized devices. Problem, resulting in the upgrade failure.

Method used

The large data blocks are divided into small data blocks for encryption and decryption, and the Bluetooth power is dynamically adjusted during the encryption and decryption process. The GCM algorithm and HASH algorithm are used to combine the key information and the initial vector to subpackage the data and encrypt it. Decrypt and dynamically adjust the crystal frequency of Bluetooth during the upgrade process.

Benefits of technology

It reduces the memory usage of Bluetooth devices, improves upgrade efficiency and success rate, saves about 75% of memory cache, ensures instant data transmission and processing security, and prevents data from being cracked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119031365B_ABST
    Figure CN119031365B_ABST
Patent Text Reader

Abstract

The present invention provides a low-power Bluetooth upgrade encryption method and its system, device, and medium, which relate to the field of data encryption technology. The present invention connects the master end and the slave end through Bluetooth, obtains upgrade data, secret key information, and initial vector after identity authentication; divides the upgrade data into several data packets according to the preset upgrade point; combines the secret key information and the initial vector, performs packet encryption on the upgrade data, and sends the generated ciphertext and message verification code of each data packet to the slave end; after each data packet is sent, updates the secret key information and the initial vector, receives feedback from the slave end, and continues to encrypt the next data packet until the encryption and sending of all data packets of the upgrade data are completed. The present invention reduces the memory usage of the Bluetooth device, and effectively solves the problem of small size, limited memory and computing resources of the Bluetooth device. In addition, in the encryption and decryption process, the method of dynamically adjusting the Bluetooth crystal oscillator frequency is adopted to improve the encryption and decryption speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data encryption technology, and in particular to a low-power Bluetooth upgrade encryption method and a system, device, and medium thereof. Background Art

[0002] Existing encryption algorithms and technologies can ensure the data security of Bluetooth devices to a certain extent, but there are still some problems and limitations:

[0003] (1) Existing encryption algorithms are inefficient in processing small data packets and do not support parallel processing, which increases the time required for encryption and decryption operations and causes data transmission delays, making them unable to meet the needs of application scenarios with high real-time requirements.

[0004] (2) Existing encryption algorithms may consume excessive energy when running in small embedded systems with limited computing resources, affecting the battery life of the device.

[0005] (3) The existing encryption algorithms have low security assurance capabilities during long-term operation. BLE devices may only use basic encryption methods and cannot ensure the security of the entire communication link. In actual applications, security vulnerabilities are prone to exist and they can be cracked by attackers, causing devices to be exposed for a long time to be attacked.

[0006] (4) Existing encryption algorithms have limited adaptability to miniaturized and low-power devices and lack the ability to resist replay attacks.

[0007] (5) During the device upgrade process, the existing encryption algorithm takes a long time to encrypt and decrypt. The longer the time, the more susceptible the communication equipment is to interference, resulting in an increase in the upgrade failure rate.

[0008] (6) The existing technology requires a large cache in the process of encryption and decryption, and the MCU memory occupies a large amount of memory. After running, it is easy for the encryption and decryption resources to be insufficient, resulting in failure.

[0009] In view of this, the applicant filed this application after studying the existing technology. Summary of the invention

[0010] The present invention aims to provide a low-power Bluetooth upgrade encryption method and its system, device, and medium, which adopts streaming processing technology to divide a large data block into several small data blocks for encryption and decryption, and dynamically adjusts the Bluetooth power during the encryption and decryption process to solve at least one of the above-mentioned problems.

[0011] In order to solve the above technical problems, the present invention is implemented through the following technical solutions:

[0012] A low-power Bluetooth upgrade encryption method, comprising:

[0013] S1, establishes a Bluetooth connection with the slave end, obtains the upgrade data, key information and initial vector after passing the identity authentication;

[0014] S2, dividing the upgrade data into a plurality of data packets according to the preset upgrade points;

[0015] S3, combining the secret key information and the initial vector, encrypting the upgrade data in packets, and sending the generated ciphertext and message verification code of each data packet to the slave end;

[0016] S4, after each data packet is sent, the key information and the initial vector are updated, and feedback from the slave end is received to continue encrypting the next data packet until the encryption and sending of all data packets of the upgrade data are completed.

[0017] Preferably, it also includes:

[0018] S5, the slave enters the upgrade mode through the communication protocol and receives the ciphertext and message authentication code of a data packet for decryption;

[0019] S6, when the decryption of a data packet is completed, the slave end sends a response command to the master end, and updates the secret key information and initial vector, and continues to receive the ciphertext and message verification code of the next data packet until the decryption of all data packets of the upgrade data is completed, and the data upgrade is completed.

[0020] Preferably, during the encryption and decryption process, the crystal oscillator frequency of Bluetooth is dynamically adjusted, specifically: in normal mode, the crystal oscillator frequency of Bluetooth is set to low power consumption mode, i.e., the first gear; when the device is in the encryption and decryption process, the crystal oscillator frequency of Bluetooth is set to the second gear; when the device is in the upgrade process, the crystal oscillator frequency of Bluetooth is set to the highest gear, i.e., the third gear, to improve the upgrade efficiency and success rate.

[0021] Preferably, the key information includes an additional message AAD and an encryption key, which is generated by obtaining the mobile terminal configuration information and integrating the current device type and device ID through a hash algorithm; the initial vector is generated by the data packet sequence number, device type and device ID.

[0022] Preferably, the data packet includes several data blocks, and the process of sub-packetizing and encrypting the upgrade data in combination with the key information and the initial vector is as follows:

[0023] Read the first data block of the current data packet, use the GCM algorithm, combine the secret key information and the initial vector to encrypt the read data block, and obtain the ciphertext and message verification code corresponding to the first data block;

[0024] Continue to read the next data block for encryption until all data blocks of the current data packet are encrypted and sent, and the secret key information and initial vector are updated.

[0025] Preferably, the process of receiving the ciphertext and the message verification code from the end for decryption is as follows:

[0026] Identify the secret key information and initial vector of the current data packet through the communication protocol, and verify the message authentication code;

[0027] If the verification is successful, the GCM algorithm is used to decrypt the first data block of the ciphertext of the current data packet to obtain the plaintext of the first data block;

[0028] Continue to read the next data block for decryption; until all data blocks of the current data packet are decrypted, thereby obtaining the plaintext of the current data packet, the slave end sends a response command to the master end, and updates the current secret key information and initial vector.

[0029] Preferably, when setting the upgrade point, the upgrade point is set in combination with the memory size of the Bluetooth communication device and the maximum payload of the Bluetooth communication to achieve the optimal data packet size and improve the Bluetooth transmission efficiency.

[0030] The present invention also provides a low-power Bluetooth upgrade encryption system, including a master end and a slave end, wherein:

[0031] The master end is used to establish a Bluetooth connection with the slave end, obtain the upgrade data, secret key information and initial vector after identity authentication; divide the upgrade data into several data packets according to the preset upgrade point; combine the secret key information and the initial vector to encrypt the upgrade data in packets, and then send the generated ciphertext and message verification code to the slave end; after each data packet is sent, update the secret key information and initial vector, receive feedback from the slave end, and continue to encrypt the next data packet until the encryption and sending of all data packets of the upgrade data are completed;

[0032] The slave end is used to connect to the master end through Bluetooth, enter the upgrade mode through the communication protocol, and receive the ciphertext and message verification code of a data packet for decryption; when the decryption of a data packet is completed, the slave end sends a response command to the master end, and updates the secret key information and initial vector, and continues to receive the ciphertext and message verification code of the next data packet until the decryption of all data packets of the upgrade data is completed, and the data upgrade is completed.

[0033] The present invention also provides a low-power Bluetooth upgrade encryption device, including a processor and a memory, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement a low-power Bluetooth upgrade encryption method as described above.

[0034] The present invention also provides a computer-readable storage medium, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a device where the computer-readable storage medium is located, a low-power Bluetooth upgrade encryption method as described above is implemented.

[0035] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0036] The method of the present invention adopts a packet stream processing method for encryption and decryption. In the encryption and decryption process, by reasonably setting the upgrade point, the large data block is split and processed in small blocks until the transmission length is reached or the parsing is completed. Compared with the method of directly performing encryption and decryption data upgrade transmission on the entire large data packet in the existing encryption method, this small data packet processing method reduces the memory usage of the Bluetooth device. In the case of extremely limited MCU memory, the method of the present invention can save about 75% of the memory cache, improve the upgrade efficiency of the device, and effectively solve the problem of limited memory and computing resources due to the small size of the Bluetooth device in actual situations.

[0037] The method of the present invention improves the encryption and decryption speed of the Bluetooth device and the upgrade success rate by dynamically adjusting the crystal oscillator frequency of the Bluetooth device.

[0038] The present invention adopts the GCM encryption algorithm to encrypt data and uses the HASH algorithm to calculate the secret key, which further improves the security of the data, prevents the data from being cracked by attackers, and ensures that the data can be transmitted and processed in real time. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A schematic diagram of a low-power Bluetooth upgrade encryption method provided in Embodiment 1 of the present invention.

[0041] Figure 2 The present invention provides a flowchart of a low-power Bluetooth upgrade encryption method provided in the first embodiment of the present invention.

[0042] Figure 3 This is a flow chart of the upgrade decryption and dynamic adjustment of the Bluetooth crystal oscillator provided in the first embodiment of the present invention.

[0043] Figure 4 A flowchart for generating key information provided in Example 1 of the present invention.

[0044] Figure 5 This is a flowchart of the encryption process provided in Example 1 of the present invention.

[0045] Figure 6 This is a flowchart of the decryption process provided in Example 1 of the present invention.

[0046] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0048] Embodiment 1

[0049] In the prior art, the encryption and decryption process of Bluetooth devices takes a long time during the upgrade process. The longer the time, the more likely the Bluetooth communication is to be interfered, resulting in an increased upgrade failure rate. In addition, the encryption and decryption process takes up a large amount of MCU memory, and after the device is running, it is easy to fail due to insufficient encryption and decryption resources.

[0050] Embodiment 1 of the present invention provides a low-power Bluetooth upgrade encryption method, which can be implemented by a low-power Bluetooth upgrade encryption device (hereinafter referred to as the upgrade encryption device), and in particular, is executed by one or more processors in the upgrade encryption device.

[0051] In this embodiment, the upgraded encryption device may be an electronic device equipped with a processor, the processor having a computer program for the upgraded encryption method of the Bluetooth communication device and the computer program can be executed, such as a computer, a smart phone, a smart tablet, a workstation, etc., which is not limited here.

[0052] like Figures 1 to 3 As shown, a low-power Bluetooth upgrade encryption method is applied to the master end, which includes steps S1 to S4.

[0053] S1, establishes a Bluetooth connection with the slave, obtains the upgrade data, key information and initial vector after passing the identity authentication.

[0054] Specifically, in this embodiment, the system includes a master end and a slave end. Generally, the master end includes a collection unit or a mobile end of a Bluetooth device; the slave end is a collection unit of a Bluetooth device. The master end and the slave end are connected and authenticated via a Bluetooth communication protocol.

[0055] In this embodiment, the communication protocol format includes: a protocol header, a packet sequence number, length information, encrypted data, a message authentication code MAC and a CRC16 check code.

[0056] The protocol header is mainly used to identify the product type and data source. The data sources include aggregation unit, collection unit, mobile terminal and third-party equipment; the packet number indicates the serial number of each packet, ranging from 0-65535, which is used to generate a dynamic initial vector (IV); the length information is the length of the encrypted data, MAC and CRC16; the encrypted data is the current valid data and needs to be decrypted by the key information (encryption key and additional message AAD) and the message authentication code MAC and IV; the message authentication code MAC is the key message encrypted by the sender and is a component of the sent packet for decryption; the CRC16 checksum is generated by calculating the protocol header, packet number, length, encrypted data and message authentication code MAC.

[0057] Specifically, the master end obtains the upgrade data from the server and stores it. Figure 4 As shown, the key information includes an additional message AAD and an encryption key, which is generated by obtaining the mobile terminal configuration information (including the key date, security key and private key) and integrating the current device type and device ID through hash algorithm calculation.

[0058] The initial vector is generated by the data packet sequence number, device type and device ID.

[0059] Specifically, a hash algorithm is also called a hash algorithm, which is an algorithm that converts input data of any length (pre-mapping) into a fixed-length output (hash value or hash value) through a specific mathematical operation. This conversion is a compressed mapping, and the space of hash values ​​is usually much smaller than the space of inputs, so different inputs may hash to the same output. In this embodiment, the SHA-256 algorithm is used, and other versions of hash algorithms may also be used.

[0060] S2, dividing the upgrade data into several data packets according to the preset upgrade points.

[0061] Specifically, when setting the upgrade point, the upgrade point is set in combination with the memory size of the Bluetooth communication device and the maximum payload of the Bluetooth communication to achieve the best data packet size, improve Bluetooth transmission efficiency, and realize low-power Bluetooth communication.

[0062] The data packet includes several data blocks.

[0063] In this embodiment, considering that the maximum payload of low-power Bluetooth communication is 240 bytes, the optimal block size under different memory conditions is recommended:

[0064] (1) The memory limit is 64KB, and the recommended block size is 64 bytes. The reason is: when the memory is small, choosing a 64-byte block can effectively manage the memory and avoid excessive data occupation. 64 bytes is 4 times the block size of AES (16 bytes), which can ensure the efficiency of encryption processing while not performing memory operations too frequently.

[0065] (2) The memory limit is 128KB, and the recommended block size is 128 bytes. The reason is that 128-byte blocks can fully utilize the encryption efficiency of AES (8 times the block size) and match the maximum payload of Bluetooth. This size can also guarantee performance when processing large data and is suitable for situations where memory is sufficient.

[0066] (3) The memory limit is 256KB, and the recommended block size is 128 bytes or 240 bytes. The reason is that 128 bytes is still a good choice to maintain efficient encryption performance. 240 bytes is also feasible because there is enough memory to handle the maximum payload of Bluetooth, but it should be noted that additional logic may be required to deal with packet segmentation and authentication tags during processing.

[0067] In this embodiment, the MCU used in the system is MSP430FR6927, and the memory configuration includes 64KB of FRAM and 2KB of SRAM. Therefore, the optimal block size used is 64 bytes.

[0068] S3, combining the secret key information and the initial vector, encrypting the upgrade data in packets, and sending the generated ciphertext and message verification code of each data packet to the slave end.

[0069] Specifically, the process of sub-packaging and encrypting the upgrade data is as follows:

[0070] Read the first data block of the current data packet, use the GCM algorithm, combine the secret key information and the initial vector to encrypt the read data block, and obtain the ciphertext and message verification code corresponding to the first data block;

[0071] Continue to read the next data block for encryption until all data blocks of the current data packet are encrypted and sent.

[0072] In this embodiment, the GCM algorithm, which is called Galois / Counter Mode, is an algorithm for authenticated encryption of associated data. It is composed of the Galois / Counter mode and the universal hash function GHASH. It is constructed using a symmetric key cipher with an approved block length of 128 bits. GCM can be regarded as an operation mode of the AES (Advanced Encryption Standard) algorithm. AES-GCM can not only provide efficient encryption protection for data and ensure the confidentiality of data, but also verify the integrity and source authentication of data by generating a message authentication code (MAC), thereby comprehensively enhancing the security of data transmission and storage.

[0073] like Figure 5 As shown in the figure, during the encryption process, the plaintext is encrypted by GCM through the key information (additional message (AAD) and encryption key) and the initial vector (IV) to obtain the message authentication code (MAC) and ciphertext.

[0074] The message authentication code (MAC) is generated by encryption and is used for comparison and verification during decryption.

[0075] S4, after each data packet is sent, the key information and the initial vector are updated, and feedback from the slave end is received to continue encrypting the next data packet until the encryption and sending of all data packets of the upgrade data are completed.

[0076] In this embodiment, the key information is updated by comparing components, such as mobile terminal configuration information (security key, private key, key date), device type and other data with the data of the current time. If they are inconsistent, new key information is regenerated through a hash algorithm, otherwise it remains unchanged.

[0077] Updating the initial vector IV is to generate dynamic initial vectors using the received packet sequence number and the sent packet sequence number respectively.

[0078] In another preferred embodiment, steps S5 to S6 are also included.

[0079] S5, the slave enters the upgrade mode through the communication protocol and receives the ciphertext and message authentication code of a data packet for decryption.

[0080] Specifically, the process of receiving the ciphertext and message verification code from the end for decryption is as follows:

[0081] Identify the secret key information and initial vector of the current data packet through the communication protocol, and verify the message authentication code;

[0082] If the verification is successful, the GCM algorithm is used to decrypt the first data block of the ciphertext of the current data packet to obtain the plaintext of the first data block;

[0083] Continue to read the next data block for decryption; until all data blocks of the current data packet are decrypted, thereby obtaining the plaintext of the current data packet.

[0084] like Figure 6 As shown, during the decryption process, the ciphertext is converted into plaintext through the key information (additional message (AAD), encryption key), initial vector (IV) and message authentication code (MAC).

[0085] S6, when the decryption of a data packet is completed, the slave end sends a response command to the master end, and updates the secret key information and initial vector, and continues to receive the ciphertext and message verification code of the next data packet until the decryption of all data packets of the upgrade data is completed, and the data upgrade is completed.

[0086] Specifically, in another preferred embodiment, during the encryption and decryption process, the crystal oscillator frequency of Bluetooth is dynamically adjusted, such as Figure 3 In the decryption flow chart shown, the crystal oscillator frequency of Bluetooth is dynamically adjusted, specifically:

[0087] In normal mode, the crystal oscillator frequency of Bluetooth is set to low power consumption mode, i.e. the first gear; when the device is in the encryption and decryption process, the crystal oscillator frequency of Bluetooth is set to the second gear; when the device is in the upgrade process, the crystal oscillator frequency of Bluetooth is set to the highest gear, i.e. the third gear, to improve the upgrade efficiency and success rate of Bluetooth devices.

[0088] Specifically, in a preferred embodiment, a 128-bit AES key K and an initialization vector IV are provided. The encryption process of each data block D_i is as follows:

[0089] Step 1: Define counter Cnt1 and initialize it to IV||1, where “||” represents the connection operation and the initialization value is “1”.

[0090] Step 2: Perform AES encryption on the counter Cnt1 to generate the encrypted block “E(K, IV || 1)”.

[0091] Step 3: Perform an XOR operation on the encrypted block “E(K, IV || 1)” and the first data block “D_1” to generate the ciphertext block “C_1 = D_1 E(K, IV || 1)".

[0092] Step 4: Counter Cnt1 increments, processes the next data block "D_2", and generates "C_2 = D_2 E(K, IV || 2)".

[0093] Step 5: Repeat the above process until all data blocks in the data packet are processed (i.e., the key upgrade point is reached).

[0094] In each step, the ciphertext block “C_i” is generated immediately and can be output, so this encryption process is suitable for streaming processing.

[0095] in," " indicates an exclusive OR operation.

[0096] GHASH certification label calculation process:

[0097] Assuming that the ciphertext blocks “C_1, C_2, .., C_n” are generated by AES-GCM mode and there is an additional message “AAD” to attach authentication data, the specific steps are as follows:

[0098] Step 1: Initialize a 128-bit hash state "H=0".

[0099] Step 2: For each ciphertext block "C_i", perform GF(2^128) multiplication and XOR operation to update the hash state:

[0100] H = (H H) C_1;

[0101] in," " indicates a multiplication operation of GF(2^128).

[0102] H = (H H) C_2;

[0103] This process is repeated until all ciphertext blocks are processed.

[0104] Step 3: After processing all ciphertext blocks, continue processing AAD and include it into the hash state through a similar process.

[0105] Step 4: After all data blocks and AAD in the current data packet are processed, GHASH outputs a 128-bit hash value, which is the authentication tag (i.e., ciphertext and message authentication code MAC).

[0106] Then, after sending the authentication tag corresponding to the current data packet, update the secret key information and IV, and repeat the above operation to continue the subsequent data packet encryption processing until the upgrade data is complete and then decrypted.

[0107] In this embodiment, the crystal oscillator frequency of the Bluetooth device is divided into three gears. The first gear is 32768KHz for low power consumption mode and is used in normal mode. The second gear is 1MHz and is used when the encryption and decryption data is large and used frequently. Because the upgrade process is resource-consuming and requires efficient communication, the third gear is 2MHz during the upgrade process.

[0108] The crystal oscillator frequency of the Bluetooth device can also be set to other numerical values ​​according to actual conditions, which is not limited here.

[0109] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0110] The method of the present invention adopts a packet stream processing method for encryption and decryption. In the encryption and decryption process, by reasonably setting the upgrade point, the large data block is split and processed in small blocks until the transmission length is reached or the parsing is completed. Compared with the method of directly encrypting and decrypting the entire large data packet in the existing encryption method, the processing method of the small data packet reduces the memory occupation of the Bluetooth device. In the case of extremely limited MCU memory, the method of the present invention can save about 75% of the memory cache, improve the upgrade efficiency of the device, and effectively solve the problem of small size of Bluetooth devices, limited memory and computing resources in actual situations, and achieve low power consumption of the device.

[0111] The method of the present invention improves the encryption and decryption speed and the upgrade success rate of the Bluetooth device by dynamically adjusting the crystal oscillator frequency of the Bluetooth device.

[0112] The present invention adopts the GCM encryption algorithm to encrypt data and uses the HASH algorithm to calculate the secret key, which further improves the security of the data, prevents the data from being cracked by attackers, and ensures that the data can be transmitted and processed in real time.

[0113] Embodiment 2

[0114] The second embodiment of the present invention further provides a low-power Bluetooth upgrade encryption system, including a master end and a slave end; wherein:

[0115] The master end is used to establish a Bluetooth connection with the slave end, obtain the upgrade data, secret key information and initial vector after identity authentication; divide the upgrade data into several data packets according to the preset upgrade point; combine the secret key information and the initial vector to encrypt the upgrade data in packets, and then send the generated ciphertext and message verification code to the slave end; after each data packet is sent, update the secret key information and initial vector, receive feedback from the slave end, and continue to encrypt the next data packet until the encryption and sending of all data packets of the upgrade data are completed;

[0116] The slave end is used to connect to the master end through Bluetooth, enter the upgrade mode through the communication protocol, and receive the ciphertext and message verification code of a data packet for decryption; when the decryption of a data packet is completed, the slave end sends a response command to the master end, and updates the secret key information and initial vector, and continues to receive the ciphertext and message verification code of the next data packet until the decryption of all data packets of the upgrade data is completed, and the data upgrade is completed.

[0117] Embodiment 3

[0118] The third embodiment of the present invention further provides a low-power Bluetooth upgrade encryption device, which includes a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement the upgrade encryption method of the Bluetooth communication device as described above.

[0119] Embodiment 4

[0120] The fourth embodiment of the present invention further provides a computer-readable storage medium, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of the device where the computer-readable storage medium is located, the upgrade encryption method of the Bluetooth communication device as described above is implemented.

[0121] In several embodiments provided in the embodiments of the present invention, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus and method embodiments described above are merely schematic. For example, the flowcharts in the accompanying drawings show the possible architecture, functions and operations of the apparatus, method and computer program product according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0122] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0123] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code. It should be noted that in this article, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0124] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0125] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0126] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0127] The "first\second" mentioned in the embodiments is only to distinguish similar objects, and does not represent a specific order for the objects. It is understandable that the "first\second" can be interchanged with the specific order or sequence where permitted. It should be understood that the objects distinguished by "first\second" can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than those illustrated or described herein.

[0128] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A low-power Bluetooth upgrade encryption method, characterized in that: Applied to the master side, including: S1, establishes a Bluetooth connection with the slave end, obtains the upgrade data, key information and initial vector after passing the identity authentication; S2, dividing the upgrade data into a plurality of data packets according to a preset upgrade point; when setting the upgrade point, the upgrade point is set in combination with the memory size of the Bluetooth communication device and the maximum payload of the Bluetooth communication to achieve an optimal data packet size, improve Bluetooth transmission efficiency, and realize the upgrade of low-power Bluetooth devices; S3, combining the secret key information and the initial vector, encrypting the upgrade data in packets, and sending the generated ciphertext and message verification code of each data packet to the slave end; S4, after each data packet is sent, the key information and the initial vector are updated, and feedback from the slave is received, and the next data packet is continued to be encrypted until the encryption and sending of all data packets of the upgrade data are completed; S5, the slave enters the upgrade mode through the communication protocol and receives the ciphertext and message authentication code of a data packet for decryption; S6, when the decryption of a data packet is completed, the slave terminal sends a response command to the master terminal, updates the secret key information and the initial vector, and continues to receive the ciphertext and message verification code of the next data packet until the decryption of all data packets of the upgrade data is completed, and the data upgrade is completed; It also includes: during the encryption and decryption process, dynamically adjusting the crystal oscillator frequency of Bluetooth, specifically: in normal mode, the crystal oscillator frequency of Bluetooth is set to low power consumption mode, i.e. the first gear; when the device is in the encryption and decryption process, the crystal oscillator frequency of Bluetooth is set to the second gear; when the device is in the upgrade process, the crystal oscillator frequency of Bluetooth is set to the highest gear, i.e. the third gear, to improve the upgrade efficiency and success rate.

2. A low-power Bluetooth upgrade encryption method according to claim 1, characterized in that ,The key information includes the additional message AAD and the encryption key, which is generated by obtaining the mobile terminal configuration information, integrating the current device type and device ID, and calculating through a hash algorithm; the initial vector is generated by the data packet number, the device type and the device ID.

3. A low-power Bluetooth upgrade encryption method according to claim 2, characterized in that ,The data packet contains several data blocks. Combining the key information and the initial vector, the process of ,subpacketizing and encrypting the upgrade data is as follows: Read the first data block of the current data packet, use the GCM algorithm, combine the secret key information and the initial vector to encrypt the read data block, and obtain the ciphertext and message verification code corresponding to the first data block; Continue to read the next data block for encryption until all data blocks of the current data packet are encrypted and sent, and the secret key information and initial vector are updated.

4. A low-power Bluetooth upgrade encryption method according to claim 3, characterized in that ,The process of receiving ciphertext and message authentication code from the end for decryption is as follows: Identify the secret key information and initial vector of the current data packet through the communication protocol, and verify the message authentication code; If the verification is successful, the GCM algorithm is used to decrypt the first data block of the ciphertext of the current data packet to obtain the plaintext of the first data block; Continue to read the next data block for decryption; Until all data blocks of the current data packet are decrypted, thus obtaining the plaintext of the current data packet, the slave sends a response command to the master and updates the current secret key information and initial vector.

5. A low-power Bluetooth upgrade encryption system, characterized in that: It includes a master end and a slave end; wherein, The master end is used to establish a Bluetooth connection with the slave end, and after identity authentication, obtain the upgrade data, secret key information and initial vector; divide the upgrade data into several data packets according to the preset upgrade point; combine the secret key information and initial vector to encrypt the upgrade data, and then send the generated ciphertext and message verification code to the slave end; after each data packet is sent, update the secret key information and initial vector, receive feedback from the slave end, and continue to encrypt the next data packet until all data packets of the upgrade data are encrypted and sent; when setting the upgrade point, set it in combination with the memory size of the Bluetooth communication device and the maximum payload of the Bluetooth communication to achieve the optimal data packet size, improve the Bluetooth transmission efficiency, and realize the upgrade of low-power Bluetooth devices; The slave end is used to connect to the master end Bluetooth, enter the upgrade mode through the communication protocol, and receive the ciphertext and message verification code of a data packet for decryption; when the decryption of a data packet is completed, the slave end sends a response command to the master end, and updates the secret key information and the initial vector, and continues to receive the ciphertext and message verification code of the next data packet until the decryption of all data packets of the upgrade data is completed, and the data upgrade is completed; during the encryption and decryption process, the crystal oscillator frequency of Bluetooth is dynamically adjusted, specifically: in normal mode, the crystal oscillator frequency of Bluetooth is set to low power consumption mode, that is, the first gear; when the device is in the encryption and decryption process, the crystal oscillator frequency of Bluetooth is set to the second gear; when the device is in the upgrade process, the crystal oscillator frequency of Bluetooth is set to the highest gear, that is, the third gear, to improve the upgrade efficiency and success rate.

6. A low-power Bluetooth upgrade encryption device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement a low-power Bluetooth upgrade encryption method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor of a device where the computer-readable storage medium is located, a low-power Bluetooth upgrade encryption method as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Bluetooth terminal upgrading method and device, storage medium and electronic equipment

    CN111752579A

  • Calibration method and device of wireless communication system

    CN115499809A