Communication security authentication method for smart home equipment

By combining fixed and dynamic key codes, the information of the central gateway is encrypted and authenticated, thus solving the weakness of communication security authentication for home devices and achieving higher security and effectiveness.

CN121530723AInactive Publication Date: 2026-02-13AITE (SHENZHEN) COMMUNICATIONS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511876226.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-12
Publication Date
2026-02-13
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing home device communication security authentication technologies suffer from weak security authentication and encryption algorithms, resulting in insufficient protection for communication security between home devices.

Method used

A fixed key code is generated based on the hardware information of smart home devices, and a dynamic key code is generated by combining the communication time. A dynamic encryption key is then generated to encrypt the control information of the central gateway, resulting in secure ciphertext. Authentication is then performed through an authentication matrix, and finally, secure authentication is achieved.

Benefits of technology

It improves the security and effectiveness of communication security authentication for home devices, avoids the problem of hash values ​​being easily identified and corrupted, and hides ciphertext by converting a matrix into a grayscale image, thus enhancing communication security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121530723A_ABST
    Figure CN121530723A_ABST
Patent Text Reader

Abstract

The invention discloses a communication security authentication method for smart home equipment, and relates to the technical field of communication security authentication of home equipment, and the method comprises the following steps: generating a fixed key code for the smart home equipment based on the hardware information of the smart home equipment; generating a dynamic key code for the central gateway based on the communication time; generating a dynamic encryption key for the communication based on the fixed key code and the dynamic key code; performing data encryption processing on the control information of the central gateway through the dynamic encryption key to obtain a security ciphertext; performing authentication calculation on the security ciphertext to obtain an authentication ciphertext of the security ciphertext; performing communication transmission on the authentication ciphertext and performing security authentication; the method is used for solving the problem that the communication security between home devices cannot be powerfully guaranteed due to the fact that the security authentication algorithm and the encryption protection algorithm are weak in the existing home device communication security authentication technology.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of home equipment communication security authentication, in particular to a communication security authentication method of smart home equipment. BACKGROUND

[0002] The home equipment communication security authentication technology refers to a series of technologies, protocols and processes for verifying the legitimacy of the identity of devices, users or services in a smart home system and establishing a secure communication channel. The core goal is to ensure that each interaction occurs between trusted subjects, preventing unauthorized access, data tampering or malicious control.

[0003] The existing home equipment communication security authentication technology usually uses a hash calculation method to authenticate the security of the ciphertext of the communication transmission. However, the hash calculation method is too obvious and can be easily targeted and destroyed. In addition, the control of smart home equipment involves personal habits and is considered private data, which needs to be encrypted for protection. However, the existing home equipment communication security authentication technology is relatively weak in encryption protection. The communication between smart home equipment has a lower real-time requirement, which means that the transmission efficiency can be appropriately reduced to provide the most important prerequisite for more complex encryption protection algorithms. For example, in the patent application with the publication number CN111092717A, a "secure and reliable communication method based on group authentication in a smart home environment" is disclosed. This scheme uses a hash value calculation method to authenticate communication security. The hash calculation method is too obvious and can be easily targeted and destroyed. The existing home equipment communication security authentication technology has weak security authentication algorithms and encryption protection algorithms, which leads to the problem that the communication security between home equipment cannot be strongly guaranteed. SUMMARY

[0004] The present application aims to at least solve one of the technical problems in the prior art. A fixed key code is generated for a smart home device based on the hardware information of the smart home device. Then, a dynamic key code is generated for a hub gateway based on the time of communication. A dynamic encryption key is generated for this communication based on the fixed key code and the dynamic key code. The control information of the hub gateway is preliminarily encrypted by the dynamic encryption key to obtain a preliminary encrypted code. The preliminary encrypted code is further calculated to output a secure ciphertext. The secure ciphertext is authenticated to obtain an authentication ciphertext of the secure ciphertext. Finally, the authentication ciphertext is transmitted and authenticated to solve the problem that the existing home equipment communication security authentication technology has weak security authentication algorithms and encryption protection algorithms, which leads to the problem that the communication security between home equipment cannot be strongly guaranteed.

[0005] To achieve the above-mentioned purpose, the present application provides a communication security authentication method of smart home equipment, comprising the following steps: generating a fixed key code for the smart home device based on hardware information of the smart home device; generating a dynamic key code for the hub gateway based on time of communication; generating a dynamic encryption key for the current communication based on the fixed key code and the dynamic key code; performing data encryption processing on control information of the hub gateway through the dynamic encryption key to obtain secure ciphertext; performing authentication calculation on the secure ciphertext to obtain authentication ciphertext of the secure ciphertext; performing communication transmission and security authentication on the authentication ciphertext.

[0006] Further, the generating of the fixed key code for the smart home device based on the hardware information of the smart home device comprises the following sub-steps: The hardware information comprises a device identification code and an IP address; Converting the device identification code and the IP address into binary format codes based on ASCII encoding, and naming them as device code and IP code respectively; Counting the number of bits of the device code and the IP code, and naming them as device bit number and IP bit number respectively, if the device bit number is greater than the IP bit number, the last digit of the device code is removed so that the device bit number is equal to the IP bit number, if the IP bit number is greater than the device bit number, the last digit of the IP code is removed so that the IP bit number is equal to the device bit number; Performing XOR calculation on the device code and the IP code to obtain the fixed key code.

[0007] Further, the generating of the dynamic key code for the hub gateway based on the time of communication comprises the following sub-steps: When the hub gateway needs to send control information to the smart home device, the current time is named as encryption time, and the smart home device receiving the control information is named as receiving device; Converting the encryption time into binary format code based on ASCII encoding, and naming it as time code; The hub gateway records the fixed key codes of different smart home devices, and the fixed key code of the receiving device is named as receiving fixed code; Counting the number of bits of the time code and the receiving fixed code, and naming them as time bit number and fixed code bit number respectively, if the time bit number is greater than the fixed code bit number, the last digit of the time bit number is removed so that the time bit number is equal to the fixed code bit number, if the time bit number is less than the fixed code bit number, zeros are added at the beginning of the time bit number so that the time bit number is equal to the fixed code bit number, to obtain the dynamic key code.

[0008] Further, the generating of the dynamic encryption key for the current communication based on the fixed key code and the dynamic key code comprises the following sub-steps: The numbers in the fixed key code and the dynamic key code are numbered in the order from left to right, and are represented by symbols GP n and DP n respectively, wherein n is a non-zero natural number and n is the serial number of GP and DP; A constant N is set, and the N ∈ n. If the numbers between GP n and GP N are all equal, the number of bits of the numbers between GP n and GP N is counted and named as the fixed equal adjacent bit number; if the numbers between DP n and DP N are all equal, the number of bits of the numbers between DP n and DP N is counted and named as the dynamic equal adjacent bit number; The dynamic equal adjacent bit numbers are numbered in the order from small to large according to N, and are represented by symbols GM i and DM j respectively, wherein i and j are both non-zero natural numbers and i is the serial number of GM and j is the serial number of DM; Starting with i = j = 1, GM i + DM j is calculated, and the calculation result is marked as MP i . During the calculation, if GM i does not exist, GM i is regarded as 0; if DM j does not exist, DM j is regarded as 0; i and j are synchronously increased by one and MP i is recalculated until the maximum value in i and j is reached, and finally different MP i are obtained; MP i are combined in the order from small to large according to i, and the dynamic encryption key is obtained.

[0009] Further, the control information of the hub gateway is subjected to data encryption processing through the dynamic encryption key to obtain secure ciphertext, including the following sub-steps: The control information of the hub gateway is subjected to preliminary encryption processing through the dynamic encryption key to obtain a preliminary encryption code; The preliminary encryption code is further calculated to output secure ciphertext.

[0010] Further, the control information of the hub gateway is subjected to preliminary encryption processing through the dynamic encryption key to obtain a preliminary encryption code, including the following sub-steps: The control information corresponding to the decimal code is obtained, which is named as information code. The numbers in the information code are numbered in the order from left to right, and are represented by symbol Rm This indicates that m is a non-zero natural number and m is the index of R; The numbers in the dynamic encryption key are numbered from left to right, using the symbol W. h This indicates that h is a non-zero natural number and h is the index of W; Starting with m=1 and h=1, obtain W. h and W h+1 Determine W h+1 The parity of W, if W h+1 If it is odd, then calculate R. m ×W h The calculation result is marked as T. m If W h+1 If it is even, then calculate R. m / W h The calculation result is kept in its simplest fraction and labeled as T. m Add one to m and two to h, then recalculate T. m ; If T m If it is not a fraction, then calculate T. m / 10 and T m %10, mark the integer digits of the calculation result as FA. m and FB m , where % is the modulo operator, if T m If it is a fraction, then the molecule is labeled FA. m The denominator is marked as FB m , the FA m and FB m This is the initial encryption encoding.

[0011] Furthermore, the initial encryption code is further calculated to output secure ciphertext, including the following sub-steps: If m is odd, then according to FA m Previously, FB m The order of FA m and FB m By combining the results, we obtain Q. m ; If m is even, then follow FB. m Previously, FA m The order of FA m and FB m By combining the results, we obtain Q. m Q is sorted in ascending order of m. m By combining the data, a secure ciphertext is finally obtained.

[0012] Further, the authentication calculation on the secure ciphertext to obtain the authentication ciphertext of the secure ciphertext includes the following sub-steps: Obtain the dynamic encryption key, convert the dynamic encryption key from decimal format to binary format, name it as binary key, count the number of digits in the binary key, name it as encoding bit number; Calculate the factor of the encoding bit number, name it as encoding factor, obtain two encoding factors with the smallest difference, mark them as H1 and H2 respectively, that is, |H1-H2| is the smallest; Construct the matrix of H1xH2, name it as authentication matrix, and record the binary key into the authentication matrix, the recording order is from the top left to the bottom right; Generate authentication ciphertext for secure ciphertext based on authentication matrix.

[0013] Further, generating authentication ciphertext for secure ciphertext based on authentication matrix includes the following sub-steps: Obtain Q m in the secure ciphertext; Start with m=t=k=1, judge whether C(t,k) is 1, if C(t,k) is 1, replace C(t,k) with Q m , replace any one of the adjacent digits of C(t,k) with Q m times, then add 1 to m and k at the same time and re-analyze, if C(t,k) is 0, add 1 to k and re-analyze, if k reaches the maximum value during the analysis process, reset k to 1 and add 1 to t; loop until all Q m have been recorded in different C(t,k); Obtain the encryption time, convert the encryption time into the encoding of decimal format according to ASCII encoding, mark the bits as Z x from left to right, where x is a non-zero natural number and x is the serial number of Z; Obtain the maximum value of x, mark it as Y, replace the last Y C(t,k) in the authentication matrix with Z x ; Randomly replace the remaining un-replaced C(t,k) with any number between 1 and 255 to obtain a secure matrix; Convert each element grid in the secure matrix into a gray value according to the number in it to obtain a gray image, name it as authentication ciphertext.

[0014] Further, the communication transmission and security authentication of the authentication ciphertext includes the following sub-steps: Transmit the authentication ciphertext through the communication channel, extract Z xIt is then restored to the encryption time, and the dynamic encryption key is obtained by analyzing the encryption time and the fixed key. The authentication ciphertext is converted into a security matrix, and an authentication matrix is ​​generated using a dynamic encryption key. The cells in the security matrix and the authentication matrix that are in the same position are named as corresponding cells. The corresponding cells of the cells in the authentication matrix that are 1 are named as authentication cells. It is determined whether the number in the authentication cell is a two-digit number. At the same time, it is checked whether there is a multiple of the number in the authentication cell in the cell adjacent to the authentication cell. If both are true, the authentication is successful; otherwise, the authentication fails. If authentication fails, the control information is resent. If authentication succeeds, the two-digit numbers in the security matrix are extracted in a left-to-right and top-to-bottom order to obtain Q. m And based on the dynamic encryption key pair Q m The signal is then decrypted and ultimately restored to its original form as a control signal.

[0015] The beneficial effects of this invention are as follows: This invention generates a fixed key code for smart home devices based on their hardware information, then generates a dynamic key code for the central gateway based on the communication time, and finally generates a dynamic encryption key for this communication based on the fixed key code and the dynamic key code. The advantage is that smart home devices usually operate under the same IP address, so when generating the dynamic encryption key required for encryption, the IP address is included in the reference range. At the same time, a unique dynamic encryption key is generated for each information transmission based on the time. Moreover, the information transmission frequency between smart home devices is low, so generating a unique dynamic encryption key for each information transmission will not affect the information transmission efficiency, thus improving the security and effectiveness of home device communication security authentication. This invention uses a dynamic encryption key to initially encrypt the control information of the central gateway, obtaining an initial encryption code. This initial encryption code is then further calculated to output a secure ciphertext. The secure ciphertext is then used for authentication calculations to obtain an authenticated ciphertext. Finally, the authenticated ciphertext is transmitted for communication and security authentication. The advantage lies in authenticating the integrity of the secure ciphertext using an authentication matrix instead of a hash value, distinguishing it from traditional methods and making it less susceptible to identification and corruption. Furthermore, the ciphertext is hidden by converting the matrix into a grayscale image, further improving the security and effectiveness of home device communication security authentication. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the steps of the method of the present invention; Figure 2 This is a flowchart illustrating the communication security authentication steps of the present invention; Figure 3 This is a schematic diagram of the electronic device of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Example 1, please refer to Figure 1 As shown, this application provides a communication security authentication method for smart home devices, including the following steps: Please see Figure 2 As shown, step S1 generates a fixed key code for the smart home device based on its hardware information; step S1 includes the following sub-steps: Step S101, the hardware information includes the device identifier and IP address; Step S102: Convert the device identifier and IP address into binary format encoding based on ASCII encoding, and name them as device encoding and IP encoding respectively; Step S103: Count the number of bits in the device code and IP code, and name them as device number of bits and IP number of bits respectively. If the number of bits in the device code is greater than the number of bits in the IP code, remove the last digit in the device code to make the number of bits in the device code equal to the number of bits in the IP code. If the number of bits in the IP code is greater than the number of bits in the device code, remove the last digit in the IP code to make the number of bits in the IP code equal to the number of bits in the device code. Step S104: Perform an XOR operation on the device code and IP code to obtain a fixed key code; In practice Figure 2This is a flowchart of the communication security authentication process. The device identification code is a unique code assigned by the smart home device manufacturer for anti-counterfeiting verification. While smart home devices typically operate on the same IP address, this IP address remains consistent across different users. Therefore, a unique, fixed key code can be generated for each smart home device using the device identification code and IP address. For example, with a smart curtain, the device identification code is "CL-013," and the IP address is "192.192.0.1." The resulting device code is 0100001101001100001011010011000000110001001100110011, and the IP code is... Given the IP address 0011000100111001001100101110001100010011100100110010001011100011000001011100011000110001, we find that the device bit length is 48 and the IP bit length is 88. Since the device bit length is less than the IP bit length, we remove the last 40 digits from the IP address, resulting in the remaining IP address 001100010011100100110010001011100011000100111001. XORing the device address and the IP address gives us the fixed key code 011100100111010100011111000111100011110000000000001010.

[0019] Step S2: Generate a dynamic key code for the central gateway based on the communication time; Step S2 includes the following sub-steps: Step S201: When the central gateway needs to send control information to the smart home device, the current time is named the encrypted time, and the smart home device receiving the control information is named the receiving device. Step S202: Convert the encrypted time into binary format encoding according to ASCII encoding, and name it time encoding; Step S203: The central gateway records the fixed key codes of different smart home devices, and names the fixed key code of the receiving device as the receiving fixed code. Step S204: Count the number of bits in the time code and the received fixed code, and name them the time bit number and the fixed code bit number, respectively. If the time bit number is greater than the fixed code bit number, remove the last digit of the time bit number to make the time bit number equal to the fixed code bit number. If the time bit number is less than the fixed code bit number, add zeros to the beginning of the time bit number to make the time bit number equal to the fixed code bit number, and obtain the dynamic key code. In practice, smart home devices are typically controlled by a central gateway within the home. These devices only need to receive and execute control signals. For example, if the central gateway needs to change the smart curtains from open to closed at 15:26:38, it needs to send a control message specifically stating "close." The encrypted time is 15:26:38, and the receiving device is the smart curtains. The converted time code is 0011000100110101001110100011001000110110001110100011001100110011100011001110001100111000. The central gateway actually records... These are device identifiers for different smart home devices, not fixed key codes. Since the central network considers smart home devices to be on the same IP address, the fixed key code can be derived from the device identifier. The calculated fixed key code for the smart curtain is 011100100111010100011111000111100000000000001010, a total of 48 bits. The time code has 64 bits, so the last 16 bits are removed, resulting in the dynamic key code: 001100010011010100111010001100100011011000111010.

[0020] Step S3: Generate a dynamic encryption key for this communication based on the fixed key code and the dynamic key code; Step S3 includes the following sub-steps: Step S301: Number the digits in the fixed key code and the dynamic key code from left to right, and use the symbol GP respectively. n and DP n This indicates that n is a non-zero natural number and n is the index of GP and DP; Step S302, set a constant N, N∈n, if GP n To GP N If all the numbers are equal, then the GP is calculated. n To GP N The number of digits between the two numbers is named the fixed number of adjacent digits; if DP n To DP N If all the numbers are equal, then calculate the DP. n To DP N The number of digits between them is named the dynamic adjacent digits. Step S303: Number the dynamically adjacent bits in ascending order of N, and use the symbol GM to represent each bit. i and DM j This indicates that i and j are both non-zero natural numbers, and i is the index of GM and j is the index of DM; In practice, the numbering is obtained as GP n and DPn For example, 1 ≤ n ≤ 48, taking the dynamic key code 001100010011010100111010001100100011011000111010 as an example, where GP1 to GP2 are all 0, the dynamic equivalent number is 2; GP3 to GP4 are all 1, the dynamic equivalent number is 2; GP5 to GP7 are all 0, the dynamic equivalent number is 3, and so on, finally extracting GM1 to GM... 19 The sequence is 1, 3, 2, 1, 2, 3, 1, 1, 1, 1, 3, 5, 3, 4, 13, 1, 1, 1, and 1, DM1 to DM. 27 The sequence is 2, 2, 3, 1, 2, 2, 1, 1, 1, 1, 2, 3, 1, 1, 3, 2, 2, 1, 3, 2, 1, 2, 3, 3, 1, 1 and 1.

[0021] Step S304, starting with i=j=1, calculate GM i +DM j The calculation result is labeled as MP. i During the calculation process, if GM i If it does not exist, then GM will be... i If DM is considered 0, then... j If it does not exist, then DM will be... j Treat it as 0, increment i and j simultaneously and recalculate MP. i This continues until the maximum value between i and j is reached, ultimately yielding different MP values. i ; Step S305, sort MP in ascending order of i. i Combine them to obtain a dynamic encryption key; In the specific implementation, starting with i=j=1, at this time GM1 is 1, DM1 is 2, and MP1 is calculated to be 3. Then, i and j are incremented by one simultaneously and MP is recalculated. i When i=j=20, GM 20 If it does not exist, then GM will be... 20 Considered as 0, DM 20 The value is 2, and MP is calculated. 20 The value is 2, and similarly for all MP. i After calculation, the final combination yields the dynamic encryption key 355245222258454532431233111.

[0022] Step S4 involves encrypting the control information of the central gateway using a dynamic encryption key to obtain secure ciphertext. Step S4 includes the following sub-steps: Step S401: The control information of the central gateway is initially encrypted using a dynamic encryption key to obtain an initial encryption code; Step S401 includes the following sub-steps: Step S4011: Obtain the decimal code corresponding to the control information, name it the information code, and number the digits in the information code from left to right, using the symbol R. m This indicates that m is a non-zero natural number and m is the index of R; Step S4012: Number the digits in the dynamic encryption key from left to right, using the symbol W. h This indicates that h is a non-zero natural number and h is the index of W; Step S4013, starting with m=1 and h=1, obtain W. h and W h+1 Determine W h+1 The parity of W, if W h+1 If it is odd, then calculate R. m ×W h The calculation result is marked as T. m If W h+1 If it is even, then calculate R. m / W h The calculation result is kept in its simplest fraction and labeled as T. m Add one to m and two to h, then recalculate T. m ; Step S4014, if T m If it is not a fraction, then calculate T. m / 10 and T m %10, mark the integer digits of the calculation result as FA. m and FB m , where % is the modulo operator, if T m If it is a fraction, then the molecule is labeled FA. m The denominator is marked as FB m FA m and FB m This is the initial encryption encoding; In practice, the control information is "off" (without quotation marks), and the obtained information code is 229133179233151173, which is numbered as R. m 1≤m≤18, the dynamic encryption key is 355245222258454532431233111, and the numbering is W. h 1≤h≤27. Starting with m=1 and h=1, we obtain R1=2, W1=3, W2=5. Since W2 is odd, we calculate R1×W1, which gives T1=6. We then increment m by one and h by two, resulting in R2=2, W3=5, W4=2. Since W4 is even, we calculate R2 / W3, which gives T1=6. mThe value is 2 / 5. If h is greater than 27, then h can be reset to 1. For example, when m=14, h=27, and W is obtained. h+1 W needs to be obtained at that time 28 Since h does not have a value of 28, h is reset to 1. At this point, W1 and W2 are obtained, and W2 is odd, therefore R is calculated. 14 ×W1, ultimately yielding T 14 And so on, until T1 to T are finally calculated. 18 The fractions are 6, 2 / 5, 36, 1 / 2, 3 / 2, 3 / 5, 4, 28, 3 / 1, 8, 3 / 1, 9, 1, 15, 1 / 5, 4, 7 / 2, and 3 / 2. Taking T1 and T2 as examples, T1 and T2 are 6 and 2 / 5 respectively. T1 is not a fraction, so we calculate T1 / 10 and T1%10, which are 6 / 10 and 6%10. The integer part of 6 / 10 is 0, and the integer part of 6%10 is 6. Thus, FA1 and FB1 are 0 and 6 respectively. T2 is a fraction with a numerator of 2 and a denominator of 5. Thus, FA2 and FB2 are 2 and 5 respectively. And so on, finally obtaining FA1 to FA2. 18 The numbers are 0, 2, 3, 1, 3, 3, 0, 2, 3, 0, 3, 0, 0, 1, 1, 0, 7 and 3, FB1 to FB. 18 The numbers are 6, 5, 6, 2, 2, 5, 4, 8, 1, 8, 1, 9, 1, 5, 5, 4, 2, and 2.

[0023] Step S402: Perform further calculations on the initial encryption code and output secure ciphertext; Step S402 includes the following sub-steps: Step S4021, if m is odd, then follow FA. m Previously, FB m The order of FA m and FB m By combining the results, we obtain Q. m ; Step S4022, if m is even, then follow FB. m Previously, FA m The order of FA m and FB m By combining the results, we obtain Q. m Q is sorted in ascending order of m. m By combining the data, the secure ciphertext is finally obtained. In practical implementation, taking m=1 as an example, FA1 and FB1 are 0 and 6 respectively. At this time, m is an odd number, so according to FA... m Previously, FB m Combining FA1 and FB1 in the following order yields Q1 as 06. Similarly, all possible Q values ​​can be obtained.m The final combination yields the secure ciphertext 065236243253048231803190015115407223.

[0024] Step S5 involves performing authentication calculations on the secure ciphertext to obtain the authenticated ciphertext. Step S5 includes the following sub-steps: Step S501: Obtain the dynamic encryption key, convert the dynamic encryption key from decimal format to binary format, name it the binary key, count the number of digits in the binary key, and name it the encoding digits; Step S502: Calculate the factor of the number of bits of the code, name it the coding factor, and obtain the two coding factors with the smallest difference, which are labeled as H1 and H2 respectively, i.e., |H1-H2| is the smallest; Step S503: Construct an H1×H2 matrix, named the authentication matrix, and enter the binary key into the authentication matrix in the order of entering from the top left to the bottom right. In practice, the converted binary key is 1001001011101101000011010000101100011111000100010101101101001111011111110100000001010111. The calculated encoding length is 89. Factors of 89 include 1 and 89. Typically, if the factors of the encoding length only contain 1 and itself, a 0 is added to the beginning of the binary key to ensure that the number of factors is not more than 2. This is to prevent the difference in the number of rows and columns in the authentication matrix from becoming too large. The resulting binary key is 01001001011101101000011010000101100011111000100010101101101001111011111110100000001010111. Its encoding factors include 1, 2, 3, 5, 6, 9, 10, 15, 18, 30, 45, and 90. When H1 is 9 and H2 is 10, |H1-H2| is minimized. Therefore, H1 is 9 and H2 is 10. Typically, the smaller number is chosen as H1. The resulting authentication matrix is... .

[0025] Step S504: Generate authentication ciphertext based on the authentication matrix for the secure ciphertext; Step S504 includes the following sub-steps: Step S5041, obtain Q from the secure ciphertext. m Meanwhile, the number in the t-th row and k-th column of the authentication matrix is ​​labeled as C(t,k); Step S5042: Starting with m=t=k=1, determine if C(t,k) is 1. If C(t,k) is 1, replace C(t,k) with Q. m At the same time, replace any 0 adjacent to C(t,k) with Q. m The algorithm iterates through the numbers Q, incrementing both m and k by one and re-analyzing. If C(t,k) is 0, it increments k by one and re-analyzes. If k reaches its maximum value during the analysis, it resets k to 1 and increments t by one. This process is repeated until all Q values ​​are obtained. m All have been entered into different C(t,k); In practice, Q1 to Q 18 The numbers are 06, 52, 36, 24, 32, 53, 04, 82, 31, 80, 31, 90, 01, 51, 15, 40, 72, and 23, starting with m=t=k=1. At this point, C(1,1) is 0. Randomly replacing C(1,1) with any number between 0 and 255, we get C(1,1) as 201. This is for later conversion of the matrix into a grayscale image; 0 to 255 are essentially grayscale values. If a number in C(t,k) is 0, it means that the grayscale value at that point is meaningless. We increment k by 1 and reanalyze. Now C(1,2) is 1. We replace C(1,2) with Q1, which is 06. Then, we select any number adjacent to C(t,k) and replace 0 with Q. m When choosing multiples of Q1, prioritize C(t-1,k-1). If C(t,k+1) is 1 or does not exist, then select the C(t,k) adjacent to C(t,k) and equal to 0 in a clockwise direction. Since C(1,2) is 1 at this point, and C(0,1), C(0,2), and C(0,3) do not exist, we need to choose C(1,3). C(1,3) is 0, which meets the condition. Therefore, replace C(1,3) with any multiple of Q1, but not exceeding 255. Since C(1,2) is 06, which is actually 6, replace C(1,3) with any multiple of 6 not exceeding 255, resulting in C(1,3) being 120. Then, add one to both m and k and re-analyze. Continue this process until all Q1 values ​​are obtained. m All data has been entered into different C(t,k). Furthermore, the last number in the modified C(t,k) is replaced with 0 to distinguish valid data, resulting in the altered authentication matrix. In this context, the letter A represents the number 0 required to segment the valid data, while the other numbers 0 in the authentication matrix are useless data and can be replaced at will. Step S5043: Obtain the encryption time. Based on ASCII encoding, convert the encryption time bit by bit into decimal format encoding, and mark the bits Z in left-to-right order. x Let x be a non-zero natural number and x be the index of Z; Step S5044: Obtain the maximum value of x, mark it as Y, and replace the last Y C(t,k) values ​​in the authentication matrix with Z. x ; Step S5045: Randomly replace the remaining unreplaced C(t,k) with any number between 1 and 255 to finally obtain the security matrix; Step S5046: Convert each element cell in the security matrix into a grayscale value according to the number in it to obtain a grayscale image, which is named the authentication ciphertext. In the specific implementation, the encryption time is obtained as 15:26:38. Based on ASCII encoding, the encryption time is converted bit by bit into decimal format, and only the digits of the encryption time are converted. Z1 to Z6 are 49, 53, 50, 54, 51, and 56 respectively. Since rows 6 to 9 of the authentication matrix have not been replaced, row 6 is considered the last row. Rows 7 to 9 are removed to improve computational efficiency. 49, 53, 50, 54, 51, and 56 are entered at the end of row 6, that is, C(6,5), C(6,6), C(6,7), C(6,8), C(6,9), and C(6,10) are replaced with 49, 53, 50, 54, 51, and 56 respectively. The final authentication matrix is ​​as follows: The remaining unreplaced C(t,k) are randomly replaced with any number between 1 and 255, resulting in the final security matrix. Each element in the security matrix is ​​converted to a grayscale value according to the number in it. For example, if C(1,1) is 64, then the grayscale value of the pixel in the first row and first column is set to 64, and a grayscale image with a resolution of 6×10 is obtained, which is the authentication ciphertext.

[0026] Step S6 involves transmitting the authentication ciphertext via communication and performing security authentication; Step S6 includes the following sub-steps: Step S601: Transmit the authentication ciphertext through the communication channel and extract Z from the authentication ciphertext. x It is then restored to the encryption time, and the dynamic encryption key is obtained by analyzing the encryption time and the fixed key. Step S602: Convert the authentication ciphertext into a security matrix, and generate an authentication matrix using a dynamic encryption key. Name the cells in the security matrix and authentication matrix that are in the same position as the corresponding cells. Query the corresponding cells of the cells in the authentication matrix that are 1 and name them as authentication cells. Determine whether the number in the authentication cell is a two-digit number. At the same time, query whether there is a multiple of the number in the authentication cell in the cell adjacent to the authentication cell. If both are true, the authentication is successful; otherwise, the authentication fails. Step S603: If authentication fails, resend the control information; if authentication succeeds, extract the two-digit numbers from the security matrix in a left-to-right and top-to-bottom order to obtain Q.m And based on the dynamic encryption key pair Q m The signal is then decrypted and ultimately restored to its original form as a control signal. In practice, Z x Z is obtained by fixing the grayscale values ​​of the last 6 pixels in the authentication ciphertext. x The numbers are 49, 53, 50, 54, 51, and 56 in sequence. The encryption time is then restored to 15:26:38. Based on the smart curtain's device identifier and the encryption time, the dynamic encryption key can be obtained. The authentication ciphertext is then converted into a security matrix. Simultaneously, an authentication matrix is ​​generated using a dynamic encryption key. In the authentication matrix, the number in the first row and second column is 1, which means the number in the first row and second column is Q. m At this point, the number in the first row and second column of the security matrix is ​​6, and there are multiples of 6 in its adjacent cells, so we get Q1. We extract Q in order from left to right and from top to bottom. m If no authentication failure occurs until the number 0, it means that no error occurred in this communication. If any Q is entered... m If the removal fails authentication, it indicates an error occurred in this communication. This applies to all Q... m After extraction, decryption can be performed by reversing the encryption process. Since the decryption process can be derived from the encryption process, this embodiment will not provide a specific explanation.

[0027] Example 2, please refer to Figure 3 As shown, Figure 3 A schematic diagram of an electronic device is provided, which may include a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call these instructions. When the processor executes a computer-readable instruction, it performs steps as described in a communication security authentication method for a smart home device, to achieve the following functions: generating a fixed key code for the smart home device based on its hardware information; generating a dynamic key code for the central gateway based on the communication time; generating a dynamic encryption key for this communication based on the fixed key code and the dynamic key code; encrypting the control information of the central gateway using the dynamic encryption key to obtain secure ciphertext; performing authentication calculations on the secure ciphertext to obtain authenticated ciphertext; and transmitting the authenticated ciphertext via communication and performing security authentication.

[0028] Furthermore, when the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0029] Example 3: This application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a communication security authentication method for smart home devices provided by the above methods. The method includes: generating a fixed key code for the smart home device based on the hardware information of the smart home device; generating a dynamic key code for the central gateway based on the communication time; generating a dynamic encryption key for this communication based on the fixed key code and the dynamic key code; encrypting the control information of the central gateway using the dynamic encryption key to obtain secure ciphertext; performing authentication calculation on the secure ciphertext to obtain authenticated ciphertext; and transmitting the authenticated ciphertext via communication and performing security authentication.

[0030] Example 4: This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it performs the steps of the above-described communication security authentication method for smart home devices to achieve the following functions: generating a fixed key code for the smart home device based on its hardware information; generating a dynamic key code for the central gateway based on the communication time; generating a dynamic encryption key for this communication based on the fixed key code and the dynamic key code; encrypting the control information of the central gateway using the dynamic encryption key to obtain secure ciphertext; performing authentication calculations on the secure ciphertext to obtain authenticated ciphertext; and transmitting the authenticated ciphertext via communication and performing security authentication.

[0031] Based on the above description of the embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the above technical solutions, in essence or in terms of their contribution to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or certain parts of the embodiments.

[0032] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces. The indirect coupling or communication connection between systems, modules, and units may be electrical, mechanical, or other forms.

[0033] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A communication security authentication method for smart home devices, characterized in that, Includes the following steps: Generate a fixed key code for the smart home device based on its hardware information; Dynamic key codes are generated for the central gateway based on the communication time. A dynamic encryption key is generated for this communication based on a fixed key code and a dynamic key code. The control information of the central gateway is encrypted using a dynamic encryption key to obtain secure ciphertext. The authentication ciphertext is obtained by performing authentication calculations on the secure ciphertext. The encrypted authentication message is transmitted via communication and then securely authenticated.

2. The communication security authentication method for smart home devices according to claim 1, characterized in that, Generating a fixed key code for smart home devices based on their hardware information includes the following sub-steps: The hardware information includes the device identification code and IP address; The device identifier and IP address are converted into binary format based on ASCII encoding, and are named device encoding and IP encoding respectively. The number of bits in the device code and IP code are counted and named as device number of bits and IP number of bits, respectively. If the number of bits in the device code is greater than the number of bits in the IP code, the last digit of the device code is removed so that the number of bits in the device code is equal to the number of bits in the IP code. If the number of bits in the IP code is greater than the number of bits in the device code, the last digit of the IP code is removed so that the number of bits in the IP code is equal to the number of bits in the device code. The device code and IP code are XORed to obtain the fixed key code.

3. The communication security authentication method for smart home devices according to claim 2, characterized in that, Generating a dynamic key code for the central gateway based on communication time includes the following sub-steps: When the central gateway needs to send control information to smart home devices, the current time is named the encrypted time, and the smart home device receiving the control information is named the receiving device. The encrypted time is converted into binary format according to ASCII encoding and named time encoding; The central gateway records fixed key codes for different smart home devices, and the fixed key code of the receiving device is named the receiving fixed code. The number of bits in the time-encoded and received fixed codes are named the time bit length and the fixed code bit length, respectively. If the time bit length is greater than the fixed code bit length, the last digit of the time bit length is removed so that the time bit length is equal to the fixed code bit length. If the time bit length is less than the fixed code bit length, zeros are added to the beginning of the time bit length so that the time bit length is equal to the fixed code bit length, thus obtaining the dynamic key code.

4. The communication security authentication method for smart home devices according to claim 3, characterized in that, Generating a dynamic encryption key for this communication based on a fixed key code and a dynamic key code includes the following sub-steps: The numbers in the fixed key code and the dynamic key code are numbered from left to right, and then represented by the symbols GP. n and DP n This indicates that n is a non-zero natural number and n is the index of GP and DP; Let a constant N be set, where N∈n, if GP n To GP N If all the numbers are equal, then the GP is calculated. n To GP N The number of digits between the two numbers is named the fixed number of adjacent digits; if DP n To DP N If all the numbers are equal, then calculate the DP. n To DP N The number of digits between them is named the dynamic adjacent digits. The dynamically adjacent bits are numbered in ascending order of N, and are respectively identified by the symbol GM. i and DM j This indicates that i and j are both non-zero natural numbers, and i is the index of GM and j is the index of DM; Starting with i=j=1, calculate GM i +DM j The calculation result is labeled as MP. i During the calculation process, if GM i If it does not exist, then GM will be... i If DM is considered 0, then... j If it does not exist, then DM will be... j Treat it as 0, increment i and j simultaneously and recalculate MP. i This continues until the maximum value between i and j is reached, ultimately yielding different MP values. i ; MP are sorted in ascending order of i. i By combining these elements, a dynamic encryption key is obtained.

5. The communication security authentication method for smart home devices according to claim 4, characterized in that, The process of encrypting the control information of the central gateway using a dynamic encryption key to obtain secure ciphertext includes the following sub-steps: The control information of the central gateway is initially encrypted using a dynamic encryption key to obtain an initial encryption code. Further calculations are performed on the initial encryption code to output secure ciphertext.

6. The communication security authentication method for smart home devices according to claim 5, characterized in that, The control information of the central gateway is initially encrypted using a dynamic encryption key to obtain the initial encryption code, which includes the following sub-steps: Obtain the decimal code corresponding to the control information, name it the information code, and number the digits in the information code from left to right, using the symbol R. m This indicates that m is a non-zero natural number and m is the index of R; The numbers in the dynamic encryption key are numbered from left to right, using the symbol W. h This indicates that h is a non-zero natural number and h is the index of W; Starting with m=1 and h=1, obtain W. h and W h+1 Determine W h+1 The parity of W, if W h+1 If it is odd, then calculate R. m ×W h The calculation result is marked as T. m If W h+1 If it is even, then calculate R. m / W h The calculation result is kept in its simplest fraction and labeled as T. m Add one to m and two to h, then recalculate T. m ; If T m If it is not a fraction, then calculate T. m / 10 and T m %10, mark the integer digits of the calculation result as FA. m and FB m , where % is the modulo operator, if T m If it is a fraction, then the molecule is labeled FA. m The denominator is marked as FB m , the FA m and FB m This is the initial encryption encoding.

7. The communication security authentication method for smart home devices according to claim 6, characterized in that, Further calculations are performed on the initial encryption code to output secure ciphertext, including the following sub-steps: If m is odd, then according to FA m Previously, FB m The order of FA m and FB m By combining the results, we obtain Q. m ; If m is even, then follow FB. m Previously, FA m The order of FA m and FB m By combining the results, we obtain Q. m Q is sorted in ascending order of m. m By combining the data, a secure ciphertext is finally obtained.

8. The communication security authentication method for smart home devices according to claim 7, characterized in that, The authentication calculation of the secure ciphertext to obtain the authenticated ciphertext includes the following sub-steps: Obtain the dynamic encryption key, convert the dynamic encryption key from decimal format to binary format, name it the binary key, and count the number of digits in the binary key, name it the encoding bits; Calculate the factor of the number of bits in the code and name it the coding factor. Find the two coding factors with the smallest difference and label them H1 and H2 respectively, that is, the minimum |H1-H2|. Construct an H1×H2 matrix and name it the authentication matrix. Enter the binary key into the authentication matrix in the order from top left to bottom right. Generate authenticated ciphertext from secure ciphertext based on the authentication matrix.

9. A communication security authentication method for smart home devices according to claim 8, characterized in that, Generating authenticated ciphertext from secure ciphertext based on the authentication matrix includes the following sub-steps: Retrieving Q from secure ciphertext m Meanwhile, the number in the t-th row and k-th column of the authentication matrix is ​​labeled as C(t,k); Starting with m=t=k=1, check if C(t,k) is 1. If C(t,k) is 1, replace C(t,k) with Q. m At the same time, replace any 0 adjacent to C(t,k) with Q. m The algorithm iterates through the numbers Q, incrementing both m and k by one and re-analyzing. If C(t,k) is 0, it increments k by one and re-analyzes. If k reaches its maximum value during the analysis, it resets k to 1 and increments t by one. This process is repeated until all Q values ​​are obtained. m All have been entered into different C(t,k); Obtain the encryption time by converting it bit by bit into decimal format based on ASCII encoding, and marking the bits Z in left-to-right order. x Let x be a non-zero natural number and x be the index of Z; Find the maximum value of x, mark it as Y, and replace the last Y C(t,k) values ​​in the authentication matrix with Z. x ; The remaining unreplaced C(t,k) are randomly replaced with any number between 1 and 255 to obtain the security matrix. Each element in the security matrix is ​​converted to a grayscale value according to the number in it, resulting in a grayscale image, which is named the authentication ciphertext.

10. A communication security authentication method for smart home devices according to claim 9, characterized in that, The secure transmission and authentication of the encrypted authentication message includes the following sub-steps: The authentication ciphertext is transmitted via a communication channel, and Z is extracted from the authentication ciphertext. x It is then restored to the encryption time, and the dynamic encryption key is obtained by analyzing the encryption time and the fixed key. The authentication ciphertext is converted into a security matrix, and an authentication matrix is ​​generated using a dynamic encryption key. The cells in the security matrix and the authentication matrix that are in the same position are named as corresponding cells. The corresponding cells of the cells in the authentication matrix that are 1 are named as authentication cells. It is determined whether the number in the authentication cell is a two-digit number. At the same time, it is checked whether there is a multiple of the number in the authentication cell in the cell adjacent to the authentication cell. If both are true, the authentication is successful; otherwise, the authentication fails. If authentication fails, the control information is resent. If authentication succeeds, the two-digit numbers in the security matrix are extracted in a left-to-right and top-to-bottom order to obtain Q. m And based on the dynamic encryption key pair Q m The signal is then decrypted and ultimately restored to its original form as a control signal.

Citation Information

Patent Citations

  • Safe and reliable communication method based on group authentication in smart home environment

    CN111092717A