Method, system and smart door lock for wirelessly upgrading firmware of front lock via rear lock

Through the method of wirelessly upgrading firmware to the front lock, the problem of cumbersome firmware upgrade in the split design of smart door lock front and rear locks is solved, and the automated and reliable firmware upgrade process is realized.

CN114461253BActive Publication Date: 2025-02-11SHENZHEN FINGERCHIP IOT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210229804.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-10
Publication Date
2025-02-11
Estimated Expiration
2042-03-10

AI Technical Summary

Technical Problem

The existing smart door locks have insufficient wireless connections in front and rear locks, resulting in cumbersome and inconvenient firmware upgrades.

Method used

The method of wirelessly upgrading firmware through the rear lock to the front lock is used to obtain the upgrade general package from the server, and the subcontract is sent to the rear lock and the front lock, and the integrity of the upgrade package is ensured through hash verification.

Benefits of technology

It realizes the automatic firmware upgrade of the front and rear locks of smart door locks, improving the reliability and convenience of the upgrade, without the need to reserve a burn port or manual operation by users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114461253B_ABST
    Figure CN114461253B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for wirelessly upgrading the firmware of a front lock through a rear lock, comprising the following steps: the front lock is bound to the rear lock, a WIFI module obtains an upgrade package from a server, the WIFI module notifies the rear lock to enter an upgrade mode, the rear lock is upgraded after receiving the rear lock upgrade package, and notifies the WIFI module of successful upgrade after the upgrade is completed; after the WIFI module receives the upgrade success returned by the rear lock, the size of the front lock upgrade package and the hash value of the front lock upgrade package are sent to the rear lock; the rear lock sends the upgrade notification and the size of the front lock upgrade package and the hash value of the front lock upgrade package sent by the WIFI module to the front lock through Bluetooth; after the front lock upgrade is completed, the rear lock is notified, and the rear lock sends it to the WIFI module; the innovative firmware upgrade method of the present application can realize the automatic upgrade of the front lock and the rear lock of the smart door lock, and the method is highly reliable, convenient and fast, does not require the reserved firmware burning interface, and does not require the user to operate personally.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of smart door locks, and more specifically, to a method, system and smart door lock for wirelessly upgrading firmware of a front lock via a rear lock. Background Art

[0002] With the increasing maturity of Internet of Things technology and the popularity of smart door locks, door locks have various forms, including smart door locks with split front and rear locks. Since the front and rear locks are split and have no wired connection to transmit data wirelessly, upgrading the firmware of the front and rear locks has also become a problem.

[0003] At present, the main solutions in the industry are as follows:

[0004] 1. Upgrade via wired flash: The front and rear locks have reserved flashing ports for firmware upgrade. This method does not support remote upgrades, and a flashing port must be reserved;

[0005] Second, through wireless communication, such as Bluetooth, the front lock and the rear lock are upgraded separately. The APP needs to connect to the front lock to complete the upgrade, and then switch to the rear lock to upgrade the rear lock. This method requires manual switching of the front and rear locks, which is cumbersome and inconvenient to operate.

[0006] A more convenient and reliable method for upgrading the firmware of front and rear locks is needed. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide a method, system and smart door lock for wirelessly upgrading the firmware of a front lock through a rear lock in view of the above-mentioned defects of the prior art.

[0008] The technical solution adopted by the present invention to solve its technical problem is:

[0009] Construct a method for wirelessly upgrading the firmware of a front lock through a rear lock, comprising the following steps:

[0010] Step 1: Bind the front lock to the rear lock, and send the router SSID and password used for WIFI network configuration to the WIFI module on the rear lock;

[0011] Step 2: The WIFI module obtains the upgrade package from the server. The upgrade package includes the hash value of the package. The upgrade package includes the front lock upgrade package and the back lock upgrade package. The front lock upgrade package includes the size information of the front lock upgrade package and the corresponding hash value of the front lock upgrade package. The back lock upgrade package includes the size information of the back lock upgrade package and the corresponding hash value of the back lock upgrade package. The WIFI module calculates the hash value of the upgrade package and compares it with the hash value of the package sent by the server. If they are consistent, it is considered that the upgrade package has been sent completely and the next step is carried out.

[0012] Step 3: The WIFI module parses the size of the front lock upgrade package, the size of the back lock upgrade package, the hash value of the front lock upgrade package, and the hash value of the back lock upgrade package according to the packaging rules;

[0013] Step 4: The WIFI module notifies the rear lock to enter the upgrade mode, and notifies the rear lock of the rear lock upgrade package size and rear lock upgrade package hash value through the serial port; after receiving the upgrade instruction, the rear lock records the rear lock upgrade package size and rear lock upgrade package hash value, and returns the maximum sub-packet size that the rear lock can receive at one time to the WIFI module;

[0014] Step 5: The WIFI module sends the rear lock upgrade package to the rear lock in multiple packets according to the maximum packet size returned by the rear lock. The rear lock responds to each packet it receives until the sending is completed. After the rear lock receives the rear lock upgrade package, it calculates whether the hash value of the rear lock upgrade package is consistent with the received hash value of the rear lock upgrade package. If they are consistent, the upgrade is performed and the WIFI module is notified of the upgrade success after the upgrade is completed.

[0015] Step 6: After the WIFI module receives the upgrade success message from the rear lock, it sends the size of the front lock upgrade package and the hash value of the front lock upgrade package to the rear lock; the rear lock sends the upgrade notification and the size of the front lock upgrade package and the hash value of the front lock upgrade package sent by the WIFI module to the front lock via Bluetooth;

[0016] Step 7: After the front lock receives the upgrade notification sent by the rear lock, it records the upgrade package size and hash value of the front lock, and returns the maximum sub-package size received by the front lock at one time to the rear lock;

[0017] Step 8: The rear lock sends the maximum sub-packet size data returned by the front lock to the WIFI module; the WIFI module sends the firmware of the front lock to the rear lock in multiple packets according to the sub-packet size returned by the front lock, and the rear lock sends the data of the WIFI module to the front lock. After receiving each upgrade package, the front lock responds to the rear lock, and the rear lock sends it to the WIFI module until all the upgrade data are sent;

[0018] Step 9: After the front lock receives the front lock upgrade package, it calculates whether the hash value of the front lock upgrade package is consistent with the received hash value of the front lock upgrade package. If they are consistent, the upgrade is performed. After the upgrade is completed, the rear lock is notified, and the rear lock sends it to the WIFI module;

[0019] Step 10: After the WIFI module receives the notification that the front lock has been successfully upgraded, it will inform the server of the upgrade result to complete the upgrade of the front and rear locks.

[0020] The method for wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, wherein, in the first step, the front lock and the rear lock are bound by the following method:

[0021] The front and rear locks of smart door locks are equipped with low-power Bluetooth modules. The APP or applet and the front and rear locks jointly define a set of private security communication protocols.

[0022] When the smart door lock leaves the factory, the MAC barcode is posted on the front lock and the rear lock respectively;

[0023] The APP or mini program scans the MAC barcode of the rear lock, verifies the legitimacy of the rear lock MAC address with the server, establishes a connection with the scanned rear lock via Bluetooth, and uses the default AESkey to communicate with the rear lock, sends a binding instruction, and after the binding is completed, changes the default AESkey to AESkey1, and sends AESKey2 for communicating with the front lock. The modified AESkey1 is used as the AESkey for the next communication with the APP or mini program, and the MAC address of the rear lock, AESkey1, and AESkey2 are reported to the server;

[0024] The APP or mini program scans the MAC barcode of the front lock, verifies the legitimacy of the MAC address of the front lock, uses the default AESkey to communicate with the front lock, and sends the MAC address of the rear lock that the front lock is paired with and the communication AESkey2;

[0025] After the front lock receives the MAC address of the rear lock to be bound and the encryption key AESkey2 for communicating with the rear lock from the APP or mini program, it initiates a Bluetooth connection to the specified rear lock;

[0026] After establishing the Bluetooth connection, the front lock uses AESkey2 to communicate with the rear lock, initiates a binding command, and sends the MAC and other information of the front lock to the rear lock;

[0027] After the rear lock receives the communication data initiated by the front lock, it uses AESkey2 to decrypt the data. After the decryption is correct, it records the MAC address of the front lock bound to it, and also informs the front lock of the MAC address of the rear lock;

[0028] After the front lock receives the binding response from the rear lock, it verifies whether the MAC address returned by the rear lock is consistent with the MAC address sent by the APP or mini program. If they are consistent, the pairing and binding of the front and rear locks is completed.

[0029] In the method for wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, the data format of the secure communication protocol is defined as follows:

[0030] The data includes: packet header, packet identifier, packet length, data area, check bit and packet tail.

[0031] The method for wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, wherein the data area is encrypted data, and the encryption and decryption objects during communication are all the data area;

[0032] The length of the data area is an integer multiple of 16 bytes and includes the effective data length, command cluster ID, sub-command ID and data content.

[0033] In the method for wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, the upgrade package is composed of the format:

[0034] Total packet header information + sub-packet header 1 information + sub-packet header 2 information + … + sub-packet header N information + sub-packet 1 content + sub-packet 2 content + … + sub-packet N content;

[0035] The total packet header information includes: identification, number of sub-packets, total packet size, total packet hash verification value and reserved value;

[0036] The sub-packet header information includes: upgrade package type, Nth upgrade package size, Nth upgrade package version number, and upgrade package hash verification value.

[0037] In the method for wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, the WIFI module obtains the upgrade package from the server using the following method:

[0038] Product providers prepare upgrade packages, upload them to the server backend, and set up notifications for push upgrades at night;

[0039] The smart door lock automatically wakes up between 2 and 4 a.m., pulls tasks from the server, and obtains upgraded tasks;

[0040] The WIFI module goes to the server to obtain the upgrade package requested for upgrade, and the server sends the upgrade package to the WIFI module.

[0041] In the method for wirelessly upgrading the firmware of a front lock through a rear lock described in the present invention, the algorithm used to calculate the hash value according to the upgrade package is the SHA1 Hash algorithm.

[0042] A system for wirelessly upgrading the firmware of a front lock through a rear lock, which is applied to the method for wirelessly upgrading the firmware of a front lock through a rear lock as described above, and includes a server and a smart door lock;

[0043] The smart door lock includes a WIFI module, a front lock and a rear lock; the rear lock is connected to the WIFI module via a serial port, and the rear lock is connected to the front lock via Bluetooth;

[0044] The server is used to provide an upgrade package;

[0045] When the smart door lock performs a firmware upgrade, the method steps from the first step to the tenth step are executed.

[0046] The system for wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, wherein the system also includes an APP or a small program;

[0047] The front lock and rear lock of the smart door lock are both equipped with low-power Bluetooth modules. The APP or applet and the front lock and rear lock jointly define a set of private security communication protocols. When the smart door lock leaves the factory, MAC barcodes are posted on the front lock and rear lock respectively. The APP or applet scans the MAC barcode of the rear lock, verifies the legitimacy of the MAC address of the rear lock with the server, establishes a connection with the scanned rear lock through Bluetooth, and uses the default AESkey to communicate with the rear lock, sends a binding instruction, and after the binding is completed, changes the default AESkey to AESkey1, and sends AESKey2 for communicating with the front lock. The modified AESkey1 is used as the AESkey for the next communication with the APP or applet, and reports the MAC address of the rear lock, AESkey1, and AESkey2 to the server. The APP or applet scans the MAC barcode of the front lock to verify the legitimacy of the MAC address of the front lock. After the lock MAC address is verified to be legal, the default AESkey is used to communicate with the front lock, and the MAC address of the rear lock to which the front lock is paired and bound and the communication AESkey2 are sent; after the front lock receives the MAC address of the rear lock to be bound and the encryption key AESkey2 for communicating with the rear lock issued by the APP or mini program, it initiates a Bluetooth connection to the specified rear lock; after the Bluetooth connection is established, the front lock uses AESkey2 to communicate with the rear lock, initiates a binding instruction, and sends information such as the MAC of the front lock to the rear lock; after the rear lock receives the communication data initiated by the front lock, it uses AESkey2 to decrypt the data. After the decryption is correct, the MAC address of the front lock bound to it is recorded, and the MAC address of the rear lock is also informed to the front lock; after the front lock receives the binding response from the rear lock, it verifies whether the MAC address returned by the rear lock is consistent with the MAC address issued by the APP or mini program. If they are consistent, the pairing and binding of the front and rear locks are completed.

[0048] A smart door lock comprises a front lock and a rear lock, wherein the firmware upgrade of the front lock and the rear lock adopts the above-mentioned method of wirelessly upgrading the firmware of the front lock through the rear lock.

[0049] The beneficial effect of the present invention is that the innovative firmware upgrade method of the present application can realize the automatic upgrade of the front lock and the rear lock of the smart door lock. This method is highly reliable, convenient and fast, does not require the reservation of the firmware burning interface, and does not require the user to operate it personally. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work:

[0051] Figure 1It is a flow chart of a method for wirelessly upgrading the firmware of a front lock through a rear lock in a preferred embodiment of the present invention;

[0052] Figure 2 It is a flow chart of binding the front lock and the rear lock in a method of wirelessly upgrading the firmware of the front lock through the rear lock in a preferred embodiment of the present invention;

[0053] Figure 3 It is a schematic diagram of the data format of the secure communication protocol of the method for wirelessly upgrading the firmware of the front lock through the rear lock in a preferred embodiment of the present invention;

[0054] Figure 4 It is a detailed table of data contents of the security communication protocol of the method for wirelessly upgrading the firmware of the front lock through the rear lock in a preferred embodiment of the present invention;

[0055] Figure 5 It is a total packet header information table of a method for wirelessly upgrading firmware of a front lock through a rear lock in a preferred embodiment of the present invention;

[0056] Figure 6 It is a packet header information table of a method for wirelessly upgrading firmware of a front lock through a rear lock in a preferred embodiment of the present invention;

[0057] Figure 7 It is a system principle block diagram of wirelessly upgrading the firmware of the front lock through the rear lock in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the following will be described clearly and completely in combination with the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are partial embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.

[0059] The method, system and smart door lock of the preferred embodiment of the present invention for wirelessly upgrading the firmware of the front lock through the rear lock are as follows: Figure 1 See also Figure 2-6 , including the following steps:

[0060] S01: The front lock is bound to the rear lock, and the router SSID and password used for WIFI network configuration are sent to the WIFI module on the rear lock;

[0061] S02: The WIFI module obtains the upgrade package from the server. The upgrade package includes the hash value of the package. The upgrade package includes the front lock upgrade package and the back lock upgrade package. The front lock upgrade package includes the size information of the front lock upgrade package and the corresponding hash value of the front lock upgrade package. The back lock upgrade package includes the size information of the back lock upgrade package and the corresponding hash value of the back lock upgrade package. The WIFI module calculates the hash value of the upgrade package and compares it with the hash value of the package sent by the server. If they are consistent, it is considered that the upgrade package has been sent completely and the next step is carried out.

[0062] S03: The WIFI module parses the size of the front lock upgrade package, the size of the back lock upgrade package, the hash value of the front lock upgrade package, and the hash value of the back lock upgrade package according to the packaging rule;

[0063] S04: The WIFI module notifies the rear lock to enter the upgrade mode, and notifies the rear lock of the size of the rear lock upgrade package and the hash value of the rear lock upgrade package through the serial port; after receiving the upgrade instruction, the rear lock records the size of the rear lock upgrade package and the hash value of the rear lock upgrade package, and returns the maximum sub-packet size that the rear lock can receive at one time to the WIFI module;

[0064] S05: The WIFI module sends the rear lock upgrade package to the rear lock in multiple packets according to the maximum packet size returned by the rear lock. The rear lock responds to each packet received until the sending is completed. After the rear lock receives the rear lock upgrade package, it calculates whether the hash value of the rear lock upgrade package is consistent with the received hash value of the rear lock upgrade package. If they are consistent, the upgrade is performed, and after the upgrade is completed, the WIFI module is notified of the upgrade success.

[0065] S06: After receiving the upgrade success notification from the rear lock, the WIFI module sends the size of the front lock upgrade package and the hash value of the front lock upgrade package to the rear lock; the rear lock sends the upgrade notification and the size of the front lock upgrade package and the hash value of the front lock upgrade package received from the WIFI module to the front lock via Bluetooth;

[0066] S07: After receiving the upgrade notification sent by the rear lock, the front lock records the upgrade package size and the hash value of the front lock upgrade package, and returns the maximum sub-package size received by the front lock at one time to the rear lock;

[0067] S08: The rear lock sends the maximum sub-packet size data returned by the front lock to the WIFI module; the WIFI module sends the firmware of the front lock to the rear lock in multiple packets according to the sub-packet size returned by the front lock, and the rear lock sends the data of the WIFI module to the front lock. After receiving each upgrade package, the front lock responds to the rear lock, and the rear lock sends it to the WIFI module until all the upgrade data are sent;

[0068] S09: After the front lock receives the front lock upgrade package, it calculates whether the hash value of the front lock upgrade package is consistent with the received hash value of the front lock upgrade package. If they are consistent, the upgrade is performed. After the upgrade is completed, the rear lock is notified, and the rear lock sends it to the WIFI module;

[0069] S10: After receiving the notification that the front lock has been successfully upgraded, the WIFI module notifies the server of the upgrade result, thus completing the upgrade of the front and rear locks;

[0070] By applying the innovative firmware upgrade method of the present application, the front lock and the rear lock of the smart door lock can be automatically upgraded. This method is highly reliable, convenient and fast, does not require a reserved firmware burning interface, and does not require the user to operate it personally.

[0071] Preferably, the first step adopts the method:

[0072] S100: Both the front and rear locks of the smart door lock have built-in low-power Bluetooth modules. The APP or applet and the front and rear locks jointly define a set of private security communication protocols;

[0073] S101: When the smart door lock leaves the factory, the MAC barcode is posted on the front lock and the rear lock respectively;

[0074] S102: The APP or mini program scans the MAC barcode of the rear lock, verifies the legitimacy of the MAC address of the rear lock with the server, establishes a connection with the scanned rear lock via Bluetooth, and uses the default AESkey to communicate with the rear lock, issues a binding instruction, and after the binding is completed, changes the default AESkey to AESkey1, and issues AESKey2 for communicating with the front lock. The modified AESkey1 is used as the AESkey for the next communication with the APP or mini program, and the MAC address of the rear lock, AESkey1, and AESkey2 are reported to the server;

[0075] S103: The APP or mini program scans the MAC barcode of the front lock, verifies the legitimacy of the MAC address of the front lock, uses the default AESkey to communicate with the front lock, and sends the MAC address of the rear lock that the front lock is paired with and the communication AESkey2;

[0076] S104: After the front lock receives the MAC address of the rear lock to be bound and the encryption key AESkey2 for communicating with the rear lock sent by the APP or mini program, it initiates a Bluetooth connection to the designated rear lock;

[0077] S105: After the Bluetooth connection is established, the front lock communicates with the rear lock using AESkey2, initiates a binding command, and sends information such as the MAC of the front lock to the rear lock;

[0078] S106: After receiving the communication data initiated by the front lock, the rear lock uses AESkey2 to decrypt the data. After the decryption is correct, the MAC address of the front lock bound to it is recorded, and the MAC address of the rear lock is also notified to the front lock;

[0079] S107: After the front lock receives the binding response from the rear lock, it verifies whether the MAC address returned by the rear lock is consistent with the MAC address sent by the APP or mini program. If they are consistent, the pairing and binding of the front and rear locks is completed;

[0080] S108: The APP or applet sends the router SSID and password for WIFI network configuration to the WIFI module on the rear lock;

[0081] Compared with the existing front lock and rear lock binding method, the above binding method of the present application has higher security performance, and the binding direction is clear, and there will be no wrong binding.

[0082] In the method of wirelessly upgrading the firmware of the front lock through the rear lock of the present invention, the data format of the secure communication protocol is defined as follows:

[0083] The data includes: packet header, packet identifier, packet length, data area, check bit and packet tail;

[0084] The data area is the encrypted data, and the encryption and decryption objects during communication are all in the data area;

[0085] The length of the data area is an integer multiple of 16 bytes and includes the valid data length, command cluster ID, sub-command ID and data content; it has better security performance.

[0086] The upgrade package is composed of the following format:

[0087] Total packet header information + sub-packet header 1 information + sub-packet header 2 information + … + sub-packet header N information + sub-packet 1 content + sub-packet 2 content + … + sub-packet N content;

[0088] The total packet header information includes: identification, number of sub-packets, total packet size, total packet hash verification value and reserved value;

[0089] The sub-packet header information includes: upgrade package type, Nth upgrade package size, Nth upgrade package version number, and upgrade package hash verification value.

[0090] A better way for the WIFI module to obtain the upgrade package from the server is:

[0091] Product providers prepare upgrade packages, upload them to the server backend, and set up notifications for push upgrades at night;

[0092] The smart door lock automatically wakes up between 2 and 4 a.m., pulls tasks from the server, and obtains upgraded tasks;

[0093] The WIFI module goes to the server to obtain the upgrade package requested, and the server sends the upgrade package to the WIFI module;

[0094] Avoid the time nodes when the door lock is in use, and the automatic upgrade has good reliability.

[0095] Preferably, the algorithm used to calculate the hash value based on the upgrade package is the SHA1 Hash algorithm. Of course, it is understandable that it can also be replaced by other existing Hash algorithm forms.

[0096] A system for wirelessly upgrading firmware of a front lock through a rear lock is applied to the method for wirelessly upgrading firmware of a front lock through a rear lock as described above, such as Figure 7 As shown, it includes a server 1 and a smart door lock 2;

[0097] The smart door lock 2 includes a WIFI module 20, a front lock 21 and a rear lock 22; the rear lock 22 is connected to the WIFI module 20 via a serial port, and the rear lock 22 is connected to the front lock 21 via Bluetooth;

[0098] Server 1, used to provide the upgrade package;

[0099] When the smart door lock 2 is upgrading its firmware, execute the steps from the first step to the tenth step;

[0100] By applying the innovative firmware upgrade method of the present application, the front lock and the rear lock of the smart door lock can be automatically upgraded. This method is highly reliable, convenient and fast, does not require a reserved firmware burning interface, and does not require the user to operate it personally.

[0101] The system also includes an APP or mini program 3;

[0102] The front lock and rear lock of the smart door lock 2 are both equipped with low-power Bluetooth modules. The APP or applet and the front lock and rear lock jointly define a set of private security communication protocols. When the smart door lock leaves the factory, MAC barcodes are posted on the front lock and rear lock respectively. The APP or applet scans the MAC barcode of the rear lock, verifies the legitimacy of the MAC address of the rear lock with the server, establishes a connection with the scanned rear lock through Bluetooth, and uses the default AESkey to communicate with the rear lock, issues a binding instruction, and after the binding is completed, changes the default AESkey to AESkey1, and issues AESKey2 for communicating with the front lock. The modified AESkey1 is used as the AESkey for the next communication with the APP or applet, and reports the MAC address of the rear lock, AESkey1, and AESkey2 to the server. The APP or applet scans the MAC barcode of the front lock to verify the legitimacy of the MAC address of the front lock. After the lock MAC address is verified to be legal, the default AESkey is used to communicate with the front lock, and the MAC address of the rear lock to which the front lock is paired and bound and the communication AESkey2 are sent; after the front lock receives the MAC address of the rear lock to be bound and the encryption key AESkey2 for communication with the rear lock issued by the APP or mini program, it initiates a Bluetooth connection to the specified rear lock; after the Bluetooth connection is established, the front lock uses AESkey2 to communicate with the rear lock, initiates a binding instruction, and sends the MAC and other information of the front lock to the rear lock; after the rear lock receives the communication data initiated by the front lock, it uses AESkey2 to decrypt the data. After the decryption is correct, the MAC address of the front lock bound to it is recorded, and the MAC address of the rear lock is also informed to the front lock; after the front lock receives the binding response from the rear lock, it verifies whether the MAC address returned by the rear lock is consistent with the MAC address issued by the APP or mini program. If they are consistent, the pairing and binding of the front and rear locks are completed;

[0103] Compared with the existing front lock and rear lock binding method, the above binding method of the present application has higher security performance, and the binding direction is clear, and there will be no wrong binding.

[0104] A smart door lock comprises a front lock and a rear lock, wherein the firmware upgrade of the front lock and the rear lock adopts the above-mentioned method of wirelessly upgrading the firmware of the front lock through the rear lock.

[0105] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.

Claims

1. A method for wirelessly upgrading the firmware of a front lock through a rear lock, characterized in that: The following steps are involved: Step 1: Bind the front lock to the rear lock, and send the router SSID and password used for WIFI network configuration to the WIFI module on the rear lock; Step 2: The WIFI module obtains the upgrade package from the server. The upgrade package includes the hash value of the package. The upgrade package includes the front lock upgrade package and the back lock upgrade package. The front lock upgrade package includes the size information of the front lock upgrade package and the corresponding hash value of the front lock upgrade package. The back lock upgrade package includes the size information of the back lock upgrade package and the corresponding hash value of the back lock upgrade package. The WIFI module calculates the hash value of the upgrade package and compares it with the hash value of the package sent by the server. If they are consistent, it is considered that the upgrade package has been sent completely and proceed to the next step; Step 3: The WIFI module parses the size of the front lock upgrade package, the size of the back lock upgrade package, the hash value of the front lock upgrade package, and the hash value of the back lock upgrade package according to the packaging rules; Step 4: The WIFI module notifies the rear lock to enter the upgrade mode, and notifies the rear lock of the rear lock upgrade package size and rear lock upgrade package hash value through the serial port; after receiving the upgrade instruction, the rear lock records the rear lock upgrade package size and rear lock upgrade package hash value, and returns the maximum sub-packet size received by the rear lock at one time to the WIFI module; Step 5: The WIFI module sends the rear lock upgrade package to the rear lock in multiple packets according to the maximum packet size returned by the rear lock. The rear lock responds to each packet it receives until the sending is completed. After the rear lock receives the rear lock upgrade package, it calculates whether the hash value of the rear lock upgrade package is consistent with the received hash value of the rear lock upgrade package. If they are consistent, the upgrade is performed and the WIFI module is notified of the upgrade success after the upgrade is completed. Step 6: After the WIFI module receives the upgrade success message from the rear lock, it sends the size of the front lock upgrade package and the hash value of the front lock upgrade package to the rear lock; the rear lock sends the upgrade notification and the size of the front lock upgrade package and the hash value of the front lock upgrade package sent by the WIFI module to the front lock via Bluetooth; Step 7: After the front lock receives the upgrade notification sent by the rear lock, it records the upgrade package size and hash value of the front lock, and returns the maximum sub-package size received by the front lock at one time to the rear lock; Step 8: The rear lock sends the maximum sub-packet size data returned by the front lock to the WIFI module; the WIFI module sends the firmware of the front lock to the rear lock in multiple packets according to the sub-packet size returned by the front lock, and the rear lock sends the data of the WIFI module to the front lock. After receiving each upgrade package, the front lock responds to the rear lock, and the rear lock sends it to the WIFI module until all the upgrade data are sent; Step 9: After the front lock receives the front lock upgrade package, it calculates whether the hash value of the front lock upgrade package is consistent with the received hash value of the front lock upgrade package. If they are consistent, the upgrade is performed. After the upgrade is completed, the rear lock is notified, and the rear lock sends it to the WIFI module; Step 10: After the WIFI module receives the notification that the front lock has been successfully upgraded, it will inform the server of the upgrade result to complete the upgrade of the front and rear locks.

2. The method for wirelessly upgrading the firmware of the front lock through the rear lock according to claim 1, characterized in that: In the first step, the front lock and the rear lock are bound using the following method: The front and rear locks of smart door locks are equipped with low-power Bluetooth modules. The APP or applet and the front and rear locks jointly define a set of private security communication protocols. When the smart door lock leaves the factory, the MAC barcode is posted on the front lock and the rear lock respectively; The APP or mini program scans the MAC barcode of the rear lock, verifies the legitimacy of the rear lock MAC address with the server, establishes a connection with the scanned rear lock via Bluetooth, and uses the default AESkey to communicate with the rear lock, sends a binding instruction, and after the binding is completed, changes the default AESkey to AESkey1, and sends AESKey2 for communicating with the front lock. The modified AESkey1 is used as the AESkey for the next communication with the APP or mini program, and the MAC address of the rear lock, AESkey1, and AESkey2 are reported to the server; The APP or mini program scans the MAC barcode of the front lock, verifies the legitimacy of the MAC address of the front lock, uses the default AESkey to communicate with the front lock, and sends the MAC address of the rear lock that the front lock is paired with and the communication AESkey2; After the front lock receives the MAC address of the rear lock to be bound and the encryption key AESkey2 for communicating with the rear lock sent by the APP or mini program, it initiates a Bluetooth connection to the specified rear lock; After establishing the Bluetooth connection, the front lock uses AESkey2 to communicate with the rear lock, initiates a binding command, and sends the front lock's MAC and other information to the rear lock; After the rear lock receives the communication data initiated by the front lock, it uses AESkey2 to decrypt the data. After the decryption is correct, it records the MAC address of the front lock bound to it, and also informs the front lock of the MAC address of the rear lock; After the front lock receives the binding response from the rear lock, it verifies whether the MAC address returned by the rear lock is consistent with the MAC address sent by the APP or mini program. If they are consistent, the pairing and binding of the front and rear locks is completed.

3. The method for wirelessly upgrading the firmware of the front lock through the rear lock according to claim 2, characterized in that: The data format of the secure communication protocol is defined as follows: The data includes: packet header, packet identifier, packet length, data area, check bit and packet tail.

4. The method for wirelessly upgrading the firmware of the front lock through the rear lock according to claim 3, characterized in that: The data area is encrypted data, and the encryption and decryption objects during communication are all the data area; The length of the data area is an integer multiple of 16 bytes and includes the effective data length, command cluster ID, sub-command ID and data content.

5. The method for wirelessly upgrading the firmware of the front lock through the rear lock according to any one of claims 1 to 4, characterized in that: The upgrade package is composed of the following format: Total packet header information + sub-packet header 1 information + sub-packet header 2 information + … + sub-packet header N information + sub-packet 1 content + sub-packet 2 content + … + sub-packet N content; The total packet header information includes: identification, number of sub-packets, total packet size, total packet hash verification value and reserved value; The sub-packet header information includes the following contents: upgrade package type, Nth upgrade package size, Nth upgrade package version number and upgrade package hash verification value.

6. The method for wirelessly upgrading the firmware of the front lock through the rear lock according to claim 5, characterized in that: The method adopted by the WIFI module to obtain the upgrade package from the server is: Product providers prepare upgrade packages, upload them to the server backend, and set up notifications for push upgrades at night; The smart door lock automatically wakes up between 2 and 4 a.m., pulls tasks from the server, and obtains upgraded tasks; The WIFI module goes to the server to obtain the upgrade package requested for upgrade, and the server sends the upgrade package to the WIFI module.

7. The method for wirelessly upgrading the firmware of the front lock through the rear lock according to any one of claims 1 to 4, characterized in that: The algorithm used to calculate the hash value based on the upgrade package is the SHA1 Hash algorithm.

8. A system for wirelessly upgrading the firmware of a front lock through a rear lock, characterized in that: Including servers and smart door locks; The smart door lock includes a WIFI module, a front lock and a rear lock; the rear lock is connected to the WIFI module via a serial port, and the rear lock is connected to the front lock via Bluetooth; The server is used to provide an upgrade package; When the smart door lock performs firmware upgrade, the method for wirelessly upgrading the firmware of the front lock through the rear lock as described in any one of claims 1-7 is executed.

9. The system for wirelessly upgrading the firmware of the front lock through the rear lock according to claim 8, characterized in that: The system also includes an APP or a mini program; The front lock and rear lock of the smart door lock are both equipped with low-power Bluetooth modules. The APP or applet and the front lock and rear lock jointly define a set of private security communication protocols. When the smart door lock leaves the factory, MAC barcodes are posted on the front lock and rear lock respectively. The APP or applet scans the MAC barcode of the rear lock, verifies the legitimacy of the MAC address of the rear lock with the server, establishes a connection with the scanned rear lock through Bluetooth, and uses the default AESkey to communicate with the rear lock, sends a binding instruction, and after the binding is completed, the default AESkey is modified to AESkey1, and AESKey2 for communicating with the front lock is sent. The modified AESkey1 As the AESkey for the next communication with the APP or mini program, and report the MAC address, AESkey1, and AESkey2 of the rear lock to the server; the APP or mini program scans the MAC barcode of the front lock, verifies the legitimacy of the MAC address of the front lock, uses the default AESkey to communicate with the front lock, and sends the MAC address of the rear lock and the communication AESkey2 to which the front lock is paired and bound; after the front lock receives the MAC address of the rear lock to be bound and the encryption key AESkey2 for communicating with the rear lock issued by the APP or mini program, it initiates a Bluetooth connection to the specified rear lock; after the Bluetooth connection is established, the front lock uses AESkey2 to communicate with the rear lock, initiates a binding instruction, and sends the MAC and other information of the front lock to the rear lock; after the rear lock receives the communication data initiated by the front lock, it uses AESkey2 to decrypt the data. After the decryption is correct, it records the MAC address of the front lock bound to it, and also informs the front lock of the MAC address of the rear lock; after the front lock receives the binding response of the rear lock, it verifies whether the MAC address returned by the rear lock is consistent with the MAC address issued by the APP or mini program. If they are consistent, the pairing and binding of the front and rear locks are completed.

10. A smart door lock, comprising a front lock and a rear lock, characterized in that: The firmware upgrade of the front lock and the rear lock adopts the method of wirelessly upgrading the firmware of the front lock through the rear lock as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Intelligent lock, firmware updating method, device and system thereof and updating piece

    CN107832064A

  • Door lock firmware upgrading method and system, door lock, server and storage medium

    CN107888577A