A method and apparatus for communication between an electronic lock controller and a biometric module.

By using SM2 public key exchange and random number matrix encryption, the problem of plaintext key transmission and AES encryption being easily stolen in the communication between the electronic lock controller and the biometric module is solved, thereby improving the security of information transmission and its resistance to cracking.

CN116827617BActive Publication Date: 2025-10-28HANGZHOU ZHIAN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310723252.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-19
Publication Date
2025-10-28
Estimated Expiration
2043-06-19

AI Technical Summary

Technical Problem

In the existing communication between electronic lock controllers and biometric modules, key exchange relies on plaintext transmission, which is easily stolen. Furthermore, the single AES encryption algorithm is vulnerable to brute-force attacks, resulting in insufficient information security.

Method used

The method employs SM2 public key exchange, random number matrix generation and encryption, and selection of elements from the random number matrix as AES keys. Combining asymmetric and symmetric encryption methods, it ensures that all sensitive information is transmitted in ciphertext during the interaction process, and a new AES key is generated before each communication.

Benefits of technology

It effectively avoids the risk of sensitive information being stolen, improves communication security and resistance to brute-force attacks, and ensures the security and reliability of information transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116827617B_ABST
    Figure CN116827617B_ABST
Patent Text Reader

Abstract

This invention relates to a method and apparatus for communication between an electronic lock controller and a biometric module, comprising: the controller and the biometric module sequentially exchanging SM2 public keys, exchanging random number matrices, and exchanging coordinates, and finally transmitting communication commands and response information between the two parties. The beneficial effects of this invention are: during the key exchange phase, plaintext is transmitted only during the SM2 public key exchange; all other processes transmit ciphertext. Furthermore, the ciphertext is encrypted using a combination of asymmetric and symmetric encryption methods. The introduction of two sets of random number matrices and the transmission of encrypted coordinates mitigates the risk of sensitive information being intercepted and directly used by malicious actors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic locks, and more specifically, to a method and apparatus for communication between an electronic lock controller and a biometric module. Background Technology

[0002] Electronic locks are becoming increasingly widespread, providing great convenience to everyday household users. In particular, electronic locks with biometric identification functions utilize the uniqueness of human biometric features such as fingerprints, palm prints, and facial features as input information to identify and control the opening and closing of the electronic lock.

[0003] In conventional solutions for biometric electronic locks, the lock controller typically integrates a fingerprint or facial recognition module to achieve various biometric functions. The lock controller communicates with the biometric module according to predetermined protocols to transmit and interact with each other. In conventional solutions, much of this transmitted information is sensitive data, often transmitted in plaintext, such as images, features, templates, uploaded and downloaded data, and keys collected by the biometric module. To protect this information from external eavesdropping, developers generally use AES encryption to encrypt the communication protocol data. This encryption method avoids transmitting data in plaintext over the line, thus protecting and enhancing the security of sensitive information to a certain extent.

[0004] AES is a common symmetric encryption algorithm known for its fast encryption and decryption speeds. However, because encryption and decryption both use the same single key, both the electronic lock controller and the biometric module must possess this same key. This necessitates key exchange before any communication, and the exchange must be conducted in plaintext. This reliance on the communication line makes it vulnerable to theft by malicious actors. Furthermore, the security of key management and protection by either party is not guaranteed. Additionally, a single AES key is still susceptible to brute-force attacks, and there is no way to prevent this. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method and apparatus for communication between an electronic lock controller and a biometric module.

[0006] Firstly, a method for communication between an electronic lock controller and a biometric module is provided, including:

[0007] S1. Exchange SM2 public keys: The controller and the biometric module generate their own SM2 key pairs and exchange their SM2 public keys for storage;

[0008] S2. Exchange random number matrices: Both the controller and the biometric module generate several sets of random numbers, randomly arrange them into a random number matrix; then, they use the public key generated by the other party to encrypt their own random number matrix and send it to the other party.

[0009] S3. Exchange coordinates: The controller and the biometric module generate random numbers and select elements from the random number matrix as AES key data based on the random numbers, and then exchange the AES keys between the two parties.

[0010] S4. Communication: The controller and the biometric module transmit communication commands and response information between each other.

[0011] Preferably, S1 includes:

[0012] S101, The controller generates a first key pair SM2-M, which includes a first public key SM2-M-PubKey and a first private key SM2-M-PriKey.

[0013] S102, The biometric module generates a second key pair SM2-S, which includes a second public key SM2-S-PubKey and a second private key SM2-S-PriKey;

[0014] S103, The controller and the biometric module exchange and store their public keys.

[0015] Preferably, S2 includes:

[0016] S201, The controller generates a random number matrix RandMat-M on the main control end; the biometric module generates a random number matrix RandMat-S on the device end; both RandMat-M and RandMat-S matrices are of size M rows and N columns;

[0017] S202. The controller uses the second public key SM2-S-PubKey to encrypt the master control terminal's random number matrix RandMat-M to generate ciphertext.<SM2-S-PubKey(RandMat-M)> Send it to the biometric module;

[0018] S203, Biometric module received<SM2-S-PubKey(RandMat-M)> The second private key SM2-S-PriKey is used to decrypt it, restore the plaintext of the master control terminal random number matrix RandMat-M, and store it in the biometric module;

[0019] S204. The biometric module uses the first public key SM2-M-PubKey to encrypt the device-side random number matrix RandMat-S to generate ciphertext.<SM2-M-PubKey(RandMat-S)> It then sends its response to the controller;

[0020] S205, Controller received<SM2-M-PubKey(RandMat-S)> The device is decrypted using the first private key SM2-M-PriKey to restore the plaintext of the device-side random number matrix RandMat-S and store it in the controller.

[0021] Preferably, S3 includes:

[0022] S301. The controller generates a random number mrand1 and calculates the row coordinate mrow0 = mrand1%M; the controller generates a random number mrand2 and calculates the column coordinate mcol0 = mrand2%N; in the random number matrix RandMat-M of the main control terminal, the corresponding position element is selected as a controller command key data according to the coordinate information of mrow0 and mcol0, and the controller command key AES-CMD[0] = RandMat-M[mrow0,mcol0];

[0023] S302. Repeat S301 until the number of selected elements meets the requirements of the controller command key AES-CMD;

[0024] S303. The biometric module generates a random number srand1 and calculates the row coordinate srow0 = srand1%M; the biometric module generates a random number srand2 and calculates the column coordinate scol0 = srand2%N; in the device-side random number matrix RandMat-S, the corresponding position element is selected as a biometric module response key data according to the coordinate information of srow0 and scol0; the biometric module response key AES-RET[0] = RandMat-S[srow0, scol0];

[0025] S304. Repeat S303 until the number of selected elements meets the requirements of the biometric module response key AES-RET.

[0026] S305, the controller and the biometric module exchange AES keys.

[0027] As a preferred embodiment, S305 includes:

[0028] S3051. The controller compresses and packages all row and column coordinates to generate the master control coordinate Coor-M plaintext; it then encrypts the Coor-M plaintext using the second public key SM2-S-PubKey to generate ciphertext.<SM2-S-PubKey(Coor-M)> Send it to the biometric module;

[0029] S3052, Biometric module received<SM2-S-PubKey(Coor-M)> The second private key SM2-S-PriKey is used to decrypt it, restore the plaintext Coor-M, and extract the corresponding elements from the master control random number matrix RandMat-M according to the coordinate information to generate the controller command key AES-CMD.

[0030] S3053: The biometric module compresses and packages all row and column coordinates to generate plaintext Coor-S coordinates for the device side. It then encrypts the plaintext Coor-S using the first public key SM2-M-PubKey to generate ciphertext.<SM2-M-PubKey(Coor-S)> It then sends its response to the controller;

[0031] S3054, Controller received<SM2-M-PubKey(Coor-S)> The device coordinates Coor-S plaintext are decrypted using the first private key SM2-M-PriKey. Then, the corresponding elements are extracted from the device random number matrix RandMat-S according to the coordinate information to generate the biometric module response key AES-RET.

[0032] Preferably, S4 includes:

[0033] S401. The controller uses the controller command key AES-CMD to encrypt the command data to be sent using AES, and sends the encrypted command ciphertext to the biometric module.

[0034] S402. When the biometric module receives the command ciphertext, it decrypts the command ciphertext using the controller command key AES-CMD to restore the plaintext command data. After performing the corresponding operation, it uses the biometric module response key AES-RET to encrypt the response data to be responded to using AES, and sends the encrypted response ciphertext to the controller.

[0035] S403. The controller receives the ciphertext of the response, decrypts it using the biometric module's response key AES-RET to restore the plaintext response data, and completes a send-receive communication process.

[0036] As a preferred embodiment, S4 also includes:

[0037] The system determines whether the current time is within a valid time range. If it is not within a valid time range, the current coordinate information becomes invalid. The controller then initiates a coordinate re-exchange event. After both parties regenerate and exchange coordinates, a new set of controller command key AES-CMD and biometric module response key AES-RET will be generated to continue communication.

[0038] Preferably, in S4, one or more coordinate exchange operations are performed before the controller and the biometric module communicate.

[0039] In a second aspect, an apparatus is provided for communication between an electronic lock controller and a biometric module, for performing the method of communication between the electronic lock controller and the biometric module as described in any of the first aspects, comprising a controller and a biometric module.

[0040] Preferably, the controller is a microcontroller on the electronic lock motherboard, and the biometric module is a fingerprint module inside the electronic lock.

[0041] The beneficial effects of this invention are:

[0042] 1. In the key exchange phase of the present invention, the controller and the biometric module transmit plaintext only during the exchange of the SM2 public key. All other processes transmit ciphertext, which is encrypted using a combination of asymmetric and symmetric encryption methods, thus avoiding the risk of sensitive information being intercepted and directly used by criminals.

[0043] 2. The data stored by the controller and the biometric module of this invention are not the actual communication keys, but only the SM2 private key, the other party's public key and the random number matrix. This information is difficult to obtain and cannot be used to reconstruct the actual communication keys.

[0044] 3. By introducing two sets of random number matrices and transmitting encrypted coordinates, the controller and biometric module indirectly generate two sets of keys, a command key (AES-CMD) and a response key (AES-RET), before each communication, so that each communication between the two parties has a corresponding different key for sending and receiving. At the same time, the addition of a mode that can update the coordinates and generate new keys at any time according to actual needs increases the complexity of brute-force attacks, greatly improving the communication security and reliability between the controller and the biometric module. Attached Figure Description

[0045] Figure 1 Schematic diagram of SM2-M key pair and SM2-S key pair;

[0046] Figure 2 A schematic diagram of the keys stored for the controller and biometric module;

[0047] Figure 3 This is a schematic diagram of a random number matrix;

[0048] Figure 4 This is a schematic diagram of retrieving the AES-CMD command key element from a random number matrix. Detailed Implementation

[0049] The present invention will be further described below with reference to embodiments. The description of the embodiments below is only for the purpose of helping to understand the present invention. It should be noted that those skilled in the art can make several modifications to the present invention without departing from the principle of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

[0050] Example 1:

[0051] A method for communication between an electronic lock controller and a biometric module includes:

[0052] S1. Exchange SM2 public keys: (e.g.) Figure 1 As shown, the controller and the biometric module generate their own SM2 key pairs and exchange their SM2 public keys for storage.

[0053] S1 includes:

[0054] S101, The controller generates a first key pair SM2-M, which includes a first public key SM2-M-PubKey and a first private key SM2-M-PriKey.

[0055] S102, The biometric module generates a second key pair SM2-S, which includes a second public key SM2-S-PubKey and a second private key SM2-S-PriKey;

[0056] S103, The controller and the biometric module exchange and store their public keys.

[0057] like Figure 2 As shown, both the controller and the biometric module store the other's public key and their own private key. Specifically, the controller stores the second public key SM2-S-PubKey and the first private key SM2-M-PriKey, while the biometric module stores the first public key SM2-M-PubKey and the second private key SM2-S-PriKey.

[0058] When the controller and the biometric module establish a connection, they should first exchange SM2 public keys. At this time, plaintext data is transmitted on the line, and the content transmitted is the SM2 public keys of both parties. The SM2 public key is only used by the controller to encrypt the data to be sent to the other party.

[0059] In subsequent interactions (such as S2 and S3), data will be sent according to the following steps and rules:

[0060] 1. The controller uses the second public key SM2-S-PubKey of the biometric module to encrypt the plaintext data data1 to be sent, and then uses the encrypted ciphertext...<SM2-S-PubKey(data1)> Send to the biometric module;

[0061] 2. The biometric module receives encrypted data.<SM2-S-PubKey(data1)> The plaintext data data1 of the controller is decrypted and restored using the second private key SM2-S-PriKey of the biometric module;

[0062] 3. The biometric module uses the controller's first public key SM2-M-PubKey to encrypt the plaintext data data2 to be responded to, and then uses the encrypted ciphertext...<SM2-M-PubKey(data2)> The response is sent to the controller;

[0063] 4. The controller decrypts the received ciphertext data using its first private key, SM2-M-PriKey.<SM2-M-PubKey(data2)> Restore the plaintext data of the biometric module, data2.

[0064] In other words, during the exchange of various keys and sensitive information, both the controller and the biometric module use each other's public key to encrypt the plaintext data to be sent, and use their own private key to decrypt the received ciphertext data.

[0065] S2. Exchange random number matrix: Both the controller and the biometric module generate several sets of random numbers, which are randomly arranged to form a random number matrix. Then, the controller uses the public key generated by the other party to encrypt its own random number matrix and sends it to the other party.

[0066] After exchanging SM2 public keys, the controller and the biometric module should exchange their respective random number matrices. At this time, encrypted data is transmitted on the line, and the transmitted content is the random number matrices of both parties.

[0067] S2 includes:

[0068] S201, The controller generates a main control terminal random number matrix RandMat-M; the biometric module generates a device-side random number matrix RandMat-S; as follows: Figure 3 As shown, both RandMat-M and RandMat-S matrices are of size M rows and N columns;

[0069] S202. The controller uses the second public key SM2-S-PubKey to encrypt the master control terminal's random number matrix RandMat-M to generate ciphertext.<SM2-S-PubKey(RandMat-M)> Send it to the biometric module;

[0070] S203, Biometric module received<SM2-S-PubKey(RandMat-M)> The second private key SM2-S-PriKey is used to decrypt it, restore the plaintext of the master control terminal random number matrix RandMat-M, and store it in the biometric module;

[0071] S204. The biometric module uses the first public key SM2-M-PubKey to encrypt the device-side random number matrix RandMat-S to generate ciphertext.<SM2-M-PubKey(RandMat-S)> It then sends its response to the controller;

[0072] S205, Controller received<SM2-M-PubKey(RandMat-S)> The device is decrypted using the first private key SM2-M-PriKey to restore the plaintext of the device-side random number matrix RandMat-S and store it in the controller.

[0073] Therefore, both the controller and the biometric module store the master-side random number matrix RandMat-M and the device-side random number matrix RandMat-S.

[0074] S3. Exchange coordinates: The controller and the biometric module generate random numbers and select elements from the random number matrix as AES key data based on the random numbers, and then exchange the AES keys between the two parties.

[0075] Specifically, both the controller and the biometric module generate random numbers. They then use these random numbers to calculate the remainder of the number of rows and columns in a pre-set random number matrix. The result is used to select the corresponding element at a specified position within the random number matrix, which becomes part of their respective AES key data. This process is repeated, generating new random numbers, calculating the remainder, and selecting corresponding elements within the matrix until the number of selected elements is sufficient for the AES key. Simultaneously, the coordinate information corresponding to all elements of the AES key is compressed and packaged, encrypted using the other party's SM2 public key, and sent to the other party. Upon receiving the ciphertext, the other party decrypts it using its own SM2 private key to recover all the plaintext coordinate information. Then, based on the coordinate information, the other party sequentially selects corresponding elements from its own random number matrix, combines them to generate the AES key, and completes the exchange of AES keys.

[0076] Before the controller and the biometric module can communicate, they must first exchange the SM2 public key and the random number matrix.

[0077] Before the controller and the biometric module can communicate, they need to perform a coordinate exchange operation at least once, or multiple times, or perform a coordinate exchange operation before each communication.

[0078] When exchanging coordinates, encrypted data is transmitted over the line, and the transmitted content is coordinate information randomly generated by both parties.

[0079] S3 includes:

[0080] S301. The controller generates a random number mrand1 and calculates the row coordinate mrow0 = mrand1 % M; the controller generates a random number mrand2 and calculates the column coordinate mcol0 = mrand2 % N; in the master control terminal random number matrix RandMat-M, the corresponding element is selected as a controller command key data according to the coordinate information of mrow0 and mcol0. Figure 4 As shown, the controller command key AES-CMD[0] = RandMat-M[mrow0,mcol0].

[0081] S302. Repeat S301 until the number of selected elements meets the requirements of the controller command key AES-CMD. In this embodiment, the key AES-CMD contains 16 bytes of data as an example. For example, AES-CMD = {RandMat-M[mrow0,mcol0], RandMat-M[mrow1,mcol1], ..., RandMat-M[mrow15,mcol15]}.

[0082] S303. The biometric module generates a random number srand1 and calculates the row coordinate srow0 = srand1%M; the biometric module generates a random number srand2 and calculates the column coordinate scol0 = srand2%N; in the device-side random number matrix RandMat-S, the corresponding position element is selected as a biometric module response key data according to the coordinate information of srow0 and scol0; the biometric module response key AES-RET[0] = RandMat-S[srow0, scol0];

[0083] S304. Repeat S303 until the number of selected elements meets the requirements of the biometric module response key AES-RET. This application embodiment takes the key AES-RET containing 16 bytes of data as an example for illustration. For example, AES-RET = {RandMat-S[srow0,scol0], RandMat-S[srow1,scol1], ..., RandMat-S[srow15,scol15]}.

[0084] S305, the controller and the biometric module exchange AES keys.

[0085] That is, the controller randomly selects elements in RandMat-M to generate the command key AES-CMD, and uses the command key AES-CMD to encrypt all command data of the communication with AES and then sends the encrypted text to the biometric module.

[0086] The biometric module randomly selects elements in RandMat-S to generate a response key AES-RET, and uses the response key AES-RET to encrypt all response data in the communication before sending the encrypted response to the controller.

[0087] It should be noted that neither the controller nor the biometric module stores the command key AES-CMD and the response key AES-RET. Before each communication begins, the two parties exchange coordinates and regenerate new coordinate information. Based on the new coordinate information, a new command key AES-CMD and a new response key AES-RET are generated.

[0088] S4. Communication: The controller and the biometric module transmit communication commands and response information between each other.

[0089] Before the controller and the biometric module can communicate, they must first exchange the SM2 public key and the random number matrix.

[0090] Before the controller and the biometric module communicate, they perform one or more coordinate exchange operations; this application embodiment describes the operation of performing one coordinate exchange before communication.

[0091] During communication, encrypted data is transmitted over the line, and the transmitted content includes communication commands and response information from both parties.

[0092] S4 includes:

[0093] S401. The controller uses the controller command key AES-CMD to encrypt the command data to be sent using AES, and sends the encrypted command ciphertext to the biometric module.

[0094] S402. When the biometric module receives the command ciphertext, it decrypts the command ciphertext using the controller command key AES-CMD to restore the plaintext command data. After performing the corresponding operation, it uses the biometric module response key AES-RET to encrypt the response data to be responded to using AES, and sends the encrypted response ciphertext to the controller.

[0095] S403. The controller receives the ciphertext of the response, decrypts it using the biometric module's response key AES-RET to restore the plaintext response data, and completes a send-receive communication process.

[0096] During the exchange of SM2 public keys, random number matrices, AES keys, and all communication interactions, no plaintext keys or sensitive data are transmitted over the line. What is transmitted is the SM2 public key or the coordinate information of the key, compressed and packaged into ciphertext encrypted with the SM2 public key.

[0097] The controller and the biometric module only store each other's SM2 public key, their own SM2 private key, and the random number matrix of both parties. This information cannot be used to reconstruct the actual communication key.

[0098] During the initialization of the entire system, both parties need to exchange SM2 public keys, random number matrices, and coordinates in sequence. When exchanging sensitive information, operation permissions must be set to ensure that the process is carried out in a secure and controllable environment. The three steps of exchanging keys only need to be executed once, and subsequent communication steps can be repeated multiple times, with each communication being encrypted.

[0099] Example 2:

[0100] Based on Embodiment 1, Embodiment 2 of this application provides another method for communication between an electronic lock controller and a biometric module, including:

[0101] S1. Exchange SM2 public keys: The controller and the biometric module generate their own SM2 key pairs and exchange their SM2 public keys for storage.

[0102] S2. Exchange random number matrix: Both the controller and the biometric module generate several sets of random numbers, which are randomly arranged to form a random number matrix. Then, the controller uses the public key generated by the other party to encrypt its own random number matrix and sends it to the other party.

[0103] S3. Exchange coordinates: The controller and the biometric module generate random numbers and select elements from the random number matrix as AES key data based on the random numbers, and then exchange the AES keys between the two parties.

[0104] S3 includes:

[0105] S301. The controller generates random numbers to calculate row and column coordinates, and then selects the corresponding element in the random number matrix RandMat-M at the main control end as a controller command key data.

[0106] S302. Repeat S301 until the number of selected elements meets the requirements of the controller command key AES-CMD;

[0107] S303. The biometric module generates random numbers to calculate row and column coordinates, and then selects the corresponding element in the device-side random number matrix RandMat-S as a biometric module response key data.

[0108] S304. Repeat S303 until the number of selected elements meets the requirements of the biometric module response key AES-RET.

[0109] S305, the controller and the biometric module exchange AES keys.

[0110] S305 includes:

[0111] S3051. The controller compresses and packages all row and column coordinates to generate the master control coordinate Coor-M plaintext; it then encrypts the Coor-M plaintext using the second public key SM2-S-PubKey to generate ciphertext.<SM2-S-PubKey(Coor-M)> Send it to the biometric module;

[0112] S3052, Biometric module received<SM2-S-PubKey(Coor-M)> The second private key SM2-S-PriKey is used to decrypt it, restore the plaintext Coor-M, and extract the corresponding elements from the master control random number matrix RandMat-M according to the coordinate information to generate the controller command key AES-CMD.

[0113] S3053: The biometric module compresses and packages all row and column coordinates to generate plaintext Coor-S coordinates for the device side. It then encrypts the plaintext Coor-S using the first public key SM2-M-PubKey to generate ciphertext.<SM2-M-PubKey(Coor-S)> It then sends its response to the controller;

[0114] S3054, Controller received<SM2-M-PubKey(Coor-S)> The device coordinates Coor-S plaintext are decrypted using the first private key SM2-M-PriKey. Then, the corresponding elements are extracted from the device random number matrix RandMat-S according to the coordinate information to generate the biometric module response key AES-RET.

[0115] That is, the controller restores the plaintext of the device coordinates Coor-S, extracts the corresponding coordinate elements from the random number matrix RandMat-S to generate the response key AES-RET, and uses the response key AES-RET to decrypt the encrypted response data of the biometric module.

[0116] The biometric module reconstructs the plaintext coordinates (Coor-M) of the master control unit, extracts the corresponding coordinate elements from the random number matrix (RandMat-M) to generate the command key (AES-CMD), and uses the AES-CMD to decrypt the encrypted command data sent by the biometric controller.

[0117] S4. Communication: The controller and the biometric module transmit communication commands and response information between each other.

[0118] Furthermore, to enhance security, control information such as a valid time range can be incorporated into the communication data. During the communication process, it is first determined whether the current time is within the valid time range from the last execution of S3. If it is not within the valid time range, the current coordinate information becomes invalid, and the controller actively initiates a re-exchange coordinate event. After both parties regenerate and exchange coordinates, a new set of command key AES-CMD and response key AES-RET will be generated to continue communication.

[0119] In addition, to improve security, coordinates are forcibly exchanged between the two parties before each communication step is executed, ensuring one-time encryption; by introducing an effective time range, encryption mechanisms with multiple modes such as one-day encryption, one-week encryption, one-month encryption, and one-year encryption can be realized.

[0120] It should be noted that the parts in this embodiment that are the same as or similar to those in Embodiment 1 can be referred to each other, and will not be repeated in this application.

[0121] Example 3:

[0122] Based on Embodiment 1, Embodiment 3 of this application provides a fingerprint electronic lock device, in which a microcontroller located on the electronic lock motherboard serves as the controller, and a fingerprint module inside the electronic lock serves as the biometric identification module. The communication between the microcontroller and the fingerprint module adopts the communication technology method provided in Embodiment 1 of this invention.

[0123] During the factory reset process of the fingerprint electronic lock, the following steps need to be executed sequentially: S1 Exchange SM2 Public Key, S2 Exchange Random Number Matrix, S3 Exchange Coordinates, and S4 Encrypt Communication Commands. The detailed steps are as follows:

[0124] S1. Exchange SM2 public keys: The microcontroller and the fingerprint module generate their own SM2 key pairs and exchange their SM2 public keys for storage.

[0125] S2. Exchange random number matrix: The microcontroller and the fingerprint module each generate several sets of random numbers, which are randomly arranged to form a random number matrix. Then, the microcontroller uses the public key generated by the other party to encrypt its own random number matrix and sends it to the other party. The matrix is ​​8 rows and 8 columns in size.

[0126] S3. Exchange coordinates: The microcontroller and the fingerprint module generate random numbers and select elements from the random number matrix as AES key data based on the random numbers. Then, they exchange the AES keys of both parties.

[0127] S4. Encryption of communication commands:

[0128] The S401 microcontroller uses the command key AES-CMD to encrypt the command data CMDlearFG for clearing the fingerprint template using AES. The encrypted command ciphertext is then converted to AES-CMD. <cmdclearfg>Send to the fingerprint module;

[0129] S402, The fingerprint module receives the command ciphertext AES-CMD. <cmdclearfg>The command ciphertext is decrypted using the command key AES-CMD to restore the plaintext command data CMDlearFG; after performing the template clearing operation, the response data RETClearFG to be responded to is encrypted using AES using the response key AES-RET, and the encrypted response ciphertext is then AES-RET. <retclearfg>The response is sent to the microcontroller;

[0130] S403, the microcontroller receives the ciphertext AES-RET. <retclearfg>The ciphertext of the response is decrypted using the response key AES-RET to restore the plaintext response data RETClearFG, and the execution result is displayed, thus completing the process of clearing the fingerprint template.

[0131] During the fingerprint search function of the fingerprint electronic lock, the microcontroller needs to send two communication commands to the fingerprint module. The commands are S5 (exchange coordinates), S6 (encrypt communication command 1), and S7 (encrypt communication command 2). The detailed steps are as follows.

[0132] S5. Exchange coordinates:

[0133] The microcontroller and the fingerprint module generate random numbers and select elements from the random number matrix based on the random numbers as the data for the AES key. Then, they exchange the AES keys between the two parties.

[0134] Before the controller and the biometric module communicate, one or more coordinate exchange operations can be performed. Embodiment 3 of this application takes the execution of one coordinate exchange operation as an example for explanation. Subsequently, the communication command 1 and communication command 2 use the same AES key, which is more convenient.

[0135] S6, Encryption of Communication Command 1:

[0136] The S601 microcontroller uses the command key AES-CMD to encrypt the acquired feature command data CMDGetCharFG using AES, and then converts the encrypted command ciphertext AES-CMD. <cmdgetcharfg>Send to the fingerprint module;

[0137] S602, the fingerprint module receives the command ciphertext AES-CMD. <cmdgetcharfg>The command ciphertext is decrypted using the command key AES-CMD to recover the plaintext command data CMDlearFG. After performing the feature acquisition operation, the response data RETGetCharFG to be responded to is encrypted using AES using the response key AES-RET. The encrypted response ciphertext is then converted to AES-RET. <retgetcharfg>The response is sent to the microcontroller;

[0138] S603, the microcontroller receives the ciphertext AES-RET. <retgetcharfg>The ciphertext of the response is decrypted using the response key AES-RET to restore the plaintext response data RETGetCharFG, and the execution result is displayed, thus completing the feature acquisition operation process.

[0139] S7, Communication Command 2 Encryption:

[0140] The S701 microcontroller uses the command key AES-CMD to encrypt the fingerprint template command data CMDSearchFG using AES, and then encrypts the command ciphertext AES-CMD. <cmdsearchfg>Send to the fingerprint module;

[0141] S702, the fingerprint module receives the command ciphertext AES-CMD. <cmdsearchfg>The command ciphertext is decrypted using the command key AES-CMD to restore the plaintext command data CMDlearFG. After performing the template search operation, the response data RETSearchFG to be responded to is encrypted using AES using the response key AES-RET. The encrypted response ciphertext is then converted to AES-RET. <retsearchfg>The response is sent to the microcontroller;

[0142] S703, the microcontroller receives the ciphertext AES-RET. <retsearchfg>The ciphertext of the response is decrypted using the response key AES-RET to restore the plaintext response data RETSearchFG, and the execution result is displayed, thus completing the fingerprint template search operation.

[0143] Specifically, the device provided in this embodiment is the same as the device corresponding to the method provided in embodiment 1. Therefore, the parts in this embodiment that are the same as or similar to those in embodiment 1 can be referred to each other, and will not be described again in this application.

[0144] Example 4:

[0145] Based on Embodiment 3, Embodiment 4 of this application provides another fingerprint electronic lock device, in which a microcontroller located on the electronic lock motherboard serves as the controller, and the fingerprint module inside the electronic lock serves as the biometric identification module. The communication between the microcontroller and the fingerprint module adopts the communication technology method provided in Embodiment 1 of this invention.

[0146] During the factory reset process of the fingerprint electronic lock, the following steps need to be executed sequentially: S1 Exchange SM2 Public Key, S2 Exchange Random Number Matrix, S3 Exchange Coordinates, and S4 Encrypt Communication Commands. The detailed steps are as follows:

[0147] S1. Exchange SM2 public keys: The microcontroller and the fingerprint module generate their own SM2 key pairs and exchange their SM2 public keys for storage.

[0148] S2. Exchange random number matrix: The microcontroller and the fingerprint module each generate several sets of random numbers, which are randomly arranged to form a random number matrix. Then, the microcontroller uses the public key generated by the other party to encrypt its own random number matrix and sends it to the other party. The matrix is ​​8 rows and 8 columns in size.

[0149] S3. Exchange coordinates: The microcontroller and the fingerprint module generate random numbers and select elements from the random number matrix as AES key data based on the random numbers. Then, they exchange the AES keys of both parties.

[0150] S4. Encrypted Communication Commands: The microcontroller and the fingerprint module transmit communication commands and response information between each other. The communication command is the command to clear the fingerprint template.

[0151] During the fingerprint search function of the fingerprint electronic lock, the microcontroller needs to send two communication commands to the fingerprint module. Example 4 of this application illustrates this by mandating a coordinate exchange operation before each communication between the controller and the biometric module. Furthermore, subsequent communication commands 1 and 2 are encrypted using different AES keys for enhanced security. The steps are as follows: S5 coordinate exchange, S6 encryption of communication command 1, S7 coordinate exchange, and S8 encryption of communication command 2.

[0152] S5. Exchange coordinates:

[0153] The microcontroller and the fingerprint module generate random numbers and select elements from the random number matrix based on the random numbers as the data for the AES key. Then, they exchange the AES keys between the two parties.

[0154] S6, Encryption of Communication Command 1:

[0155] This communication command is a feature acquisition command. The microcontroller and the fingerprint module use the AES key generated in step S5 to encrypt and transmit the feature acquisition command and response information between the two parties.

[0156] S7. Exchange coordinates:

[0157] The microcontroller and the fingerprint module generate random numbers again, and select elements from the random number matrix based on the random numbers as the data for the AES key, and then exchange the AES keys between the two parties.

[0158] S8, Communication Command 2 Encryption:

[0159] This communication command is a template search command. The microcontroller and the fingerprint module use the AES key generated in step S7 to encrypt and transmit the template search command and response information between the two parties.

[0160] Compared with Embodiment 3, the fingerprint search function of the fingerprint electronic lock in Embodiment 4 of this application performs multiple coordinate exchange operations. That is, the coordinates are exchanged once before each communication command is transmitted. As a result, the AES key used for encrypting communication command 1 is different from the AES key used for encrypting communication command 2, which improves the security and reliability of communication.

[0161] It should be noted that the parts in this embodiment that are the same as or similar to those in Embodiment 3 can be referred to each other, and will not be repeated in this application.< / retsearchfg> < / retsearchfg> < / cmdsearchfg> < / cmdsearchfg> < / retgetcharfg> < / retgetcharfg> < / cmdgetcharfg> < / cmdgetcharfg> < / retclearfg> < / retclearfg> < / cmdclearfg> < / cmdclearfg>

Claims

1. A method for communication between an electronic lock controller and a biometric module, characterized in that, include: S1. Exchange SM2 public keys: The controller and the biometric module generate their own SM2 key pairs and exchange their SM2 public keys for storage; S2. Exchange random number matrix: The controller and the biometric module each generate several sets of random numbers, which are randomly arranged to form a random number matrix; Then, using the public key generated by the other party, encrypt your own random number matrix and send it to the other party; S3. Exchange coordinates: The controller and the biometric module generate random numbers and select elements from the random number matrix as AES key data based on the random numbers, and then exchange the AES keys between the two parties. S4. Communication: The controller and the biometric module transmit communication commands and response information between each other.

2. The method for communication between the electronic lock controller and the biometric module according to claim 1, characterized in that, S1 includes: S101, The controller generates a first key pair SM2-M, which includes a first public key SM2-M-PubKey and a first private key SM2-M-PriKey. S102, The biometric module generates a second key pair SM2-S, which includes a second public key SM2-S-PubKey and a second private key SM2-S-PriKey; S103, The controller and the biometric module exchange and store their public keys.

3. The method for communication between the electronic lock controller and the biometric module according to claim 2, characterized in that, S2 include: S201, The controller generates the main control terminal random number matrix RandMat-M; The biometric module generates a random number matrix RandMat-S at the device end; both RandMat-M and RandMat-S matrices are of size M rows and N columns. S202. The controller uses the second public key SM2-S-PubKey to encrypt the master control terminal's random number matrix RandMat-M to generate ciphertext.<SM2-S-PubKey(RandMat-M)> Send it to the biometric module; S203, Biometric module received<SM2-S-PubKey(RandMat-M)> The second private key SM2-S-PriKey is used to decrypt it, restore the plaintext of the master control terminal random number matrix RandMat-M, and store it in the biometric module; S204. The biometric module uses the first public key SM2-M-PubKey to encrypt the device-side random number matrix RandMat-S to generate ciphertext.<SM2-M-PubKey(RandMat-S)> It then sends its response to the controller; S205, Controller received<SM2-M-PubKey(RandMat-S)> The device is decrypted using the first private key SM2-M-PriKey to restore the plaintext of the device-side random number matrix RandMat-S and store it in the controller.

4. The method for communication between the electronic lock controller and the biometric module according to claim 3, characterized in that, S3 include: S301. The controller generates a random number mrand1 and calculates the row coordinate mrow0 = mrand1%M; the controller generates a random number mrand2 and calculates the column coordinate mcol0 = mrand2%N; in the random number matrix RandMat-M of the main control terminal, the corresponding position element is selected as a controller command key data according to the coordinate information of mrow0 and mcol0, and the controller command key AES-CMD[0] = RandMat-M[mrow0,mcol0]; S302. Repeat S301 until the number of selected elements meets the requirements of the controller command key AES-CMD; S303. The biometric module generates a random number srand1 and calculates the row coordinate srow0 = srand1%M; the biometric module generates a random number srand2 and calculates the column coordinate scol0 = srand2%N; in the device-side random number matrix RandMat-S, the corresponding position element is selected as a biometric module response key data according to the coordinate information of srow0 and scol0; the biometric module response key AES-RET[0] = RandMat-S[srow0,scol0]; S304. Repeat S303 until the number of selected elements meets the requirements of the biometric module response key AES-RET. S305, the controller and the biometric module exchange AES keys.

5. The method for communication between the electronic lock controller and the biometric module according to claim 4, characterized in that, S305 includes: S3051. The controller compresses and packages all row and column coordinates to generate the master control coordinate Coor-M plaintext; it then encrypts the Coor-M plaintext using the second public key SM2-S-PubKey to generate ciphertext.<SM2-S-PubKey(Coor-M)> Send it to the biometric module; S3052, Biometric module received<SM2-S-PubKey(Coor-M)> The second private key SM2-S-PriKey is used to decrypt it, restore the plaintext Coor-M, and extract the corresponding elements from the master control random number matrix RandMat-M according to the coordinate information to generate the controller command key AES-CMD. S3053: The biometric module compresses and packages all row and column coordinates to generate plaintext Coor-S coordinates on the device side. It then encrypts the plaintext Coor-S using the first public key SM2-M-PubKey to generate ciphertext.<SM2-M-PubKey(Coor-S)> It then sends its response to the controller; S3054, Controller received<SM2-M-PubKey(Coor-S)> The device coordinates Coor-S plaintext are decrypted using the first private key SM2-M-PriKey. Then, the corresponding elements are extracted from the device random number matrix RandMat-S according to the coordinate information to generate the biometric module response key AES-RET.

6. The method for communication between the electronic lock controller and the biometric module according to claim 5, characterized in that, S4 include: S401. The controller uses the controller command key AES-CMD to encrypt the command data to be sent using AES, and sends the encrypted command ciphertext to the biometric module. S402. When the biometric module receives the command ciphertext, it decrypts the command ciphertext using the controller command key AES-CMD to restore the plaintext command data. After performing the corresponding operation, it uses the biometric module response key AES-RET to encrypt the response data to be responded to using AES, and sends the encrypted response ciphertext to the controller. S403. The controller receives the ciphertext of the response, decrypts it using the biometric module's response key AES-RET to restore the plaintext response data, and completes a send-receive communication process.

7. The method for communication between the electronic lock controller and the biometric module according to claim 6, characterized in that, S4 also includes: The system determines whether the current time is within a valid time range. If it is not within a valid time range, the current coordinate information becomes invalid. The controller then initiates a coordinate re-exchange event. After both parties regenerate and exchange coordinates, a new set of controller command key AES-CMD and biometric module response key AES-RET will be generated to continue communication.

8. The method for communication between the electronic lock controller and the biometric module according to claim 7, characterized in that, In S4, one or more coordinate exchange operations are performed before the controller and the biometric module communicate.

9. A device for communication between an electronic lock controller and a biometric module, characterized in that, A method for performing communication between an electronic lock controller and a biometric module as described in any one of claims 1 to 8, comprising a controller and a biometric module.

10. The device for communication between the electronic lock controller and the biometric module according to claim 9, characterized in that, The controller is a microcontroller on the electronic lock motherboard, and the biometric module is a fingerprint module inside the electronic lock.

Citation Information

Patent Citations

  • Key generation method and system, encryption and decryption method and encryption communication system

    CN110958112A

  • Method and apparatus for data encryption and decryption, device, and storage medium

    WO2021208690A1