Method and system for activating preset key

By collaborating with pre-defined key distribution agencies and device authentication authorities, and utilizing hash algorithms and XOR operations, hardware-level isolation and logical association of pre-defined keys are achieved. This resolves security risks associated with pre-defined keys during device idle periods and improves the security of key management and the efficiency of device initialization.

CN121333554APending Publication Date: 2026-01-13MATRICTIME DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511433055.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-09
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

In existing technologies, pre-set keys are easily obtained illegally during the time difference between device production and actual deployment, leading to security risks and affecting the efficiency of normal business initialization of the device.

Method used

By employing a pre-configured key distribution agency and a device authentication agency working together, and using hash algorithms and XOR operations, the pre-configured key is ensured to be activated only after the device identity authentication is successful. This achieves hardware-level isolation and logical association of the key, preventing the key from being stolen during idle periods.

Benefits of technology

It effectively prevents the pre-set key from being illegally obtained before the device is first run, improves the security and confidentiality of key management, ensures the security and integrity of the authentication process, and realizes dynamic validity and forward security of the key.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121333554A_ABST
    Figure CN121333554A_ABST
Patent Text Reader

Abstract

The invention discloses a preset key activation method and system. The method comprises the steps that a preset key distribution mechanism distributes a preset key file 1 and an authentication key file 0 to first equipment and second equipment; the device authentication mechanism performs device identity authentication on the first device and the second device based on the authentication key file file0; according to the message that the identity authentication of the device is passed, the first device and the second device respectively execute an activation operation on the preset key file (file1); the first device authenticates the key data with the second device based on the data information of the preset key file file1; and the first device and the second device determine an available preset key file (file2) according to the message that the key authentication is passed. According to the method disclosed by the invention, before the terminal equipment enters a communication network for use, the key storage module of the preset key unit is in a black box state and an inaccessible state and is not interacted or connected with any unit, so that the possibility that bad users steal the preset key is avoided from the source.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of secure communication technology, and in particular to a method and system for activating a pre-set key. Background Technology

[0002] In existing technologies, many terminal devices with encryption / decryption functions or requirements (such as IoT devices, communication modules, security terminals, quantum computers, etc.) typically have a certain number of keys (e.g., symmetric keys, asymmetric key pairs, or key seeds) pre-loaded into their storage media after production and before formal application. This practice aims to avoid delays, network load, and service interruptions caused by the need to download large amounts of key data in real time during the initial activation phase, thereby ensuring that the device can immediately perform secure communication, authentication, data encryption, and other business operations after going online.

[0003] However, this method of pre-setting keys also presents significant security vulnerabilities. Since the keys are written during the device manufacturing stage, there is often a considerable time lag between the actual deployment and initial connection to a secure network (including multiple stages such as warehousing, transportation, sales, and installation / commissioning). During this period, the device is typically inactive, and although the pre-set keys are not actually used, they remain statically stored in non-volatile memory, making them highly vulnerable to malicious attacks. For example, attackers might steal or tamper with the pre-set keys by physically extracting the storage chip, attacking debugging interfaces, or exploiting vulnerabilities before device initialization to gain storage access. Once the keys are leaked, not only will the device's own security functions fail, but the security of the entire related key system may also be compromised, potentially causing large-scale security risks.

[0004] Therefore, how to effectively ensure the security of the pre-set key before the device is first run, and prevent it from being illegally obtained or abused during the idle period, without affecting the efficiency of the device's normal business initialization, has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] Purpose of the invention: This application provides a pre-set key activation method and system to solve the problems existing in the prior art.

[0006] Technical Solution: This invention provides a pre-set key activation method. The participants in the method include a pre-set key distribution agency, a device authentication agency, and multiple terminal devices connected in pairs. The terminal devices include a first device and a second device, which are two corresponding terminal devices pre-set with a symmetric key. The method includes the following steps:

[0007] Step 1: The pre-configured key distribution organization distributes the pre-configured key file file1 and the authentication key file file0 to the first device and the second device;

[0008] Step 2: The device authentication authority performs device identity authentication on the first device and the second device based on the authentication key file file0;

[0009] Step 3: Based on the message indicating successful device authentication, the first device and the second device respectively perform activation operations on the preset key file file1, including: the key storage module in the first device and the second device establish a first connection with the authentication unit and a second connection with the key authentication unit to perform the activation operation;

[0010] Step 4: The first device authenticates the key data with the second device based on the data information in the preset key file file1;

[0011] Step 5: Based on the key authentication success message, the first device and the second device determine the usable preset key file file2.

[0012] As an improvement of the present invention, step 1 includes:

[0013] Step 1-1: The pre-configured key distribution organization obtains the device identity DID1 of the first device and the device identity DID2 of the second device, and generates a set of pre-configured key files file1 locally for the first and second devices. The file identifier of the pre-configured key file file1 is denoted as FILE1. The pre-configured key file file1 is sent to the key storage module in the pre-configured key unit of the first and second devices for storage. The file identifier FILE1 of the pre-configured key file file1, along with the device identity KCID of the pre-configured key distribution organization, is sent to the key identifier module in the pre-configured key unit of the first and second devices for storage.

[0014] Step 1-2: The pre-set key distribution mechanism establishes a correspondence between the device identity DID1 of the first device and the device identity DID2 of the second device and the pre-set key file file1 with file identifier FILE1. The pre-set key distribution mechanism sends the correspondence to the key identifier module in the pre-set key unit of the first device and the second device for storage.

[0015] Steps 1-3: The pre-configured key distribution agency generates a set of authentication key files file0 locally, and sends the authentication key files file0 to the key authentication units and device authentication agencies of the first and second devices for storage;

[0016] Steps 1-4: The pre-configured key distribution agency disconnects from the first and second devices.

[0017] As an improvement to the present invention, the specific process of step 2 includes:

[0018] The equipment certification body performs equipment identity verification on the first piece of equipment:

[0019] Step 2-1: The authentication unit of the first device obtains two random numbers p1 and s1, each with a length of 128 bits, from the authentication key file file0, and records the key index idx-s1 of the random number s1 in the authentication key file file0; it then uses the random number p1 to generate an irreducible polynomial. The irreducible polynomial The string consisting of the coefficients of each term except the highest term is denoted as str1; using irreducible polynomials Generate the first hash function with random number s1 ;

[0020] Step 2-2: The authentication unit of the first device obtains the file identifier FILE1 of the preset key file and the device identity KCID of the preset key distribution organization from the key identifier module of the preset key unit;

[0021] Steps 2-3: The authentication unit of the first device inputs the file identifier FILE1, the device identity KCID, and its own device identity DID1 as parameters into the first hash function. The first hash value H1 is obtained. ;

[0022] Steps 2-4: The identity authentication unit of the first device generates an identity authentication request req and sends it to the device authentication authority. The identity authentication request req includes the string str1, the key index idx-s1, the first hash value H1, the file identifier FILE1, and the device identity KCID.

[0023] Steps 2-5: The device authentication authority parses the identity authentication request req to obtain the string str1', key index idx-s1', hash value H1', ​​file identifier FILE1', and device identity KCID'. Based on the device identity KCID', it addresses the preset key distribution authority, and then uses the file identifier FILE1' as the index to obtain the device identities of the two terminal devices corresponding to the file identifier FILE1' according to the correspondence established in Step 1-2: device identity DID1 and device identity DID2.

[0024] Steps 2-6: The device certification authority generates based on the string str1' Based on the key index idx-s1', a random number s1' is obtained from the authentication key file file0. Generate a second hash function with random number s1' Using the second hash function, calculate the second sub-hash value H2-1 for (FILE1', KCID', DID1) and (FILE1', KCID', DID2) respectively. Second sub-hash value H2-2= These two values ​​are compared with the hash value H1': if either the second sub-hash value H2-1 or the second sub-hash value H2-2 matches the hash value H1', ​​then the authentication of the first device is successful; if neither the second sub-hash value H2-1 nor the second sub-hash value H2-2 matches the hash value H1', ​​then the authentication fails and the process ends.

[0025] Steps 2-7: In response to the device authentication authority determining that the received identity authentication request req comes from the first device based on the sub-hash value that is consistent with the hash value H1' as the second sub-hash value H2-1, the device authentication authority sends the authentication result back to the identity authentication unit of the first device; if the authentication fails, the authentication failure result is sent to both the first device and the second device, and the process ends.

[0026] The equipment certification body performs equipment identity verification for the second device:

[0027] Steps 2-8: The second device performs device authentication using the same method as the first device. If the authentication is successful, the successful authentication result is fed back to the authentication unit of the second device; if the authentication fails, the failure result is sent to both the first and second devices simultaneously, and the process ends.

[0028] As an improvement of the present invention, the specific process of step 3 is as follows:

[0029] Based on the feedback that the device identity authentication of both the first device and the second device has been successful, the identity authentication units of the first device and the second device establish a first connection with the key storage module. The identity authentication unit sends an activation key notification to the key storage module through the first connection. In response to the activation key notification, the key storage module allows the key to be obtained from the preset key file file1 for external use.

[0030] The key authentication unit of the first and second devices establishes a second connection with the key storage module.

[0031] As an improvement to the present invention, the specific process of step 4 is as follows:

[0032] Step 4-1: The key authentication unit of the first device obtains two 128-bit random numbers p3 and s3 from the preset key file file1 based on the second connection, and records the key index idx-s3 of the random number s3 in the preset key file file1; and generates an irreducible polynomial using the random number p3. The irreducible polynomial The string consisting of the coefficients of each term except the highest term is denoted as str3; using irreducible polynomials Generate a third hash function with random number s3. Input the data information from the preset key file file1 into the third hash function. The third hash value H3 is obtained. ;

[0033] Step 4-2: The key authentication unit of the first device obtains a set of encryption keys k1 from the preset key file file1, records its index idx-k1, encrypts (H3, idx-s3, str3) using k1 to obtain the ciphertext MES, and sends MES and idx-k1 to the key authentication unit of the second device.

[0034] Step 4-3: The key authentication unit of the second device obtains the decryption key k1' from the preset key file file1 in the local key storage module based on the key index idx-k1', decrypts the ciphertext MES', and obtains (H3', idx-s3', str3').

[0035] Step 4-4: The key authentication unit of the second device generates an irreducible polynomial based on the string str3'. The random number s3' is obtained from the preset key file file1 based on the key index idx-s3', and is based on the irreducible polynomial. Generate the fourth hash function with random number s3' The local preset key file file1 is input as a parameter into the fourth hash function. The fourth hash value H4 is obtained. Compare the fourth hash value H4 with the hash value H3'. If they match, the key authentication is successful; otherwise, the key authentication fails, and return to step 1.

[0036] As an improvement of the present invention, the specific process of step 5 includes: the key storage module in the preset key unit of the first device obtains the encryption key k1 from the key authentication unit, removes a portion of the encryption key k1 from the local preset key file file1 to obtain a second key file file2 and stores it; at the same time, the key storage module in the preset key unit of the second device removes a portion of the decryption key k1' obtained from the key authentication unit from the preset key file file1 to obtain a second key file file2 and stores it; the second key file file2 serves as a usable preset key file file2.

[0037] As an improvement to the present invention, the specific process of step 5 includes:

[0038] The key storage module in the preset key unit of the first device obtains the encryption key k1 from the key authentication unit, calculates the length L of the encryption key k1, randomly selects a length l, where l satisfies L / 2 < l < L, takes the first part with a length of l from the front of the encryption key k1, and the second part with a length of (L - l) before or after the encryption key k1, combines the first part and the second part, and the key composed of these two parts is denoted as the key k2, and records its key index idx-k2. Perform an exclusive OR operation on the encryption key k1 and the key k2 to obtain the key k3 = k1 ⊕ k2, and use the XORed key k3 to replace the original key k2 part to form a new key file as the available preset key file file2 and store it; the key storage module in the preset key unit of the first device sends the key index idx-k2 of the key k2 to the key authentication unit of the second device via the key authentication unit;

[0039] The key storage module in the preset key unit of the second device obtains the key index idx-k2' from the key authentication unit, obtains the key k2' according to the key index idx-k2', performs an exclusive OR operation on the decryption key k1' and the key k2' to obtain the key k3' = k1' ⊕ k2', and uses the XORed key k3' to replace the original key k2' part to form a new key file as the available preset key file file2 and store it.

[0040] As an improvement of the present invention, a preset key activation system is further provided for performing the preset key activation method described above. The system includes a preset key distribution agency, a device authentication agency, and multiple terminal devices connected to the preset key distribution agency and the device authentication agency. The preset key distribution agency is also communicatively connected to the device authentication agency. The terminal devices include a first device and a second device, and the first device and the second device are two corresponding terminal devices preset with symmetric keys;

[0041] The preset key distribution agency is used to generate a preset key file file1 and an authentication key file file0, send the preset key file file1 to the first device and the second device, and send the authentication key file file0 to the first device, the second device, and the device authentication agency; it is also used to establish a correspondence between the device identity DID1 of the first device and the device identity DID2 of the second device and the preset key file file1 with the file identifier FILE1;

[0042] The device authentication agency is used to authenticate the device identities of the first device and the second device;

[0043] The terminal device is used to perform an activation operation on the preset key file file1 according to the authentication passed message; it is also used to generate a new preset key file file2.

[0044] As an improvement of the present invention, the terminal devices all include an identity authentication unit, a preset key unit, and a key authentication unit, wherein the preset key unit includes a key identification module and a key storage module; the identity authentication unit is communicatively connected to the key identification module, and the identity authentication unit and the key authentication unit are communicatively connected to the key storage module after the device identity authentication is successful;

[0045] The identity authentication unit is used to generate an identity authentication request for the device authentication authority to perform device identity authentication operations, and is also used to send a notification to the key storage module to activate the key based on the identity authentication success message;

[0046] The key identification module is used to store the file identifier FILE1 of the preset key file file1, the device identity KCID of the preset key distribution organization, and the corresponding relationship;

[0047] The key storage module is used to preset key file file1, and to establish a first connection with the identity authentication unit and a second connection with the key authentication unit respectively according to the identity authentication success message, to perform the preset key file activation operation, and to generate and store a new preset key file file2.

[0048] The key authentication unit is used to store the authentication key file file0 and to perform authentication operations on the key data.

[0049] Beneficial effects:

[0050] 1. By storing the pre-set key file itself and its corresponding file identifier separately, the key entity remains isolated and cannot be directly accessed or obtained before device authentication is successful. This fundamentally eliminates the possibility of stealing complete key information through a single storage point, significantly improving the security of key management and enhancing key confidentiality. Only after identity authentication is successful can it establish connections with other modules and be accessed.

[0051] 2. Before the device completes identity authentication and officially connects to the communication network, the key storage module of the pre-set key unit is in a completely closed and isolated state in both hardware and logic (i.e., "black box" state). During this period, the module does not have any physical connection with any other functional unit in the system other than an interactive interface, data connection or power supply. This completely eliminates the possibility of malicious users accessing the module and stealing the pre-set key through software vulnerabilities, debugging interfaces, network links or other existing channels, providing extremely strong static protection for the pre-set key.

[0052] 3. Device authentication is performed using a hash algorithm. The one-way and collision-resistant properties of hash calculations ensure the security and reliability of the authentication process, effectively resisting common threats such as replay attacks and identity forgery, and ensuring the confidentiality and integrity of the authentication process.

[0053] 4. Based on the XOR operation to update the pre-set key file, the basic principle of "one-time key" is realized. The update operation process adopts irreversible bit operations such as XOR, so that even if the update command or transmitted data is listened to or captured by the outside world, the attacker cannot deduce the original key value or the updated new key value. This not only ensures the dynamic validity of the key, but also effectively prevents the key from being leaked in the update process, and realizes the forward security of the key and the security of the update process. Attached Figure Description

[0054] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is a schematic diagram of the system structure of this application;

[0056] Figure 2 This is a flowchart illustrating the method described in this application;

[0057] Figure 3 This is a structural diagram illustrating the correspondence in this application;

[0058] Figure 4 This is a schematic diagram of one embodiment of updating the key file in this application;

[0059] Figure 5 This is a schematic diagram of yet another embodiment of updating the key file in this application. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0061] like Figure 1As shown, this invention provides a pre-set key activation system, which includes a pre-set key distribution agency, a device authentication agency, and multiple terminal devices connected to the pre-set key distribution agency and the device authentication agency. These terminal devices include a first device and a second device, which are two corresponding terminal devices pre-set with a symmetric key. In this application, the terms "first device" and "second device" are used only to distinguish different operating entities or for descriptive convenience, and do not imply any necessary difference in their structure or function. Unless the context clearly indicates otherwise, "first device" and "second device" can refer to devices of the same type or similar function; therefore, in some embodiments, the roles of "first device" and "second device" are interchangeable.

[0062] In embodiments of the present invention, the pre-set key distribution agency, device authentication agency, first device, and second device are able to communicate with each other.

[0063] The pre-set key distribution mechanism is used to generate a pre-set key file file1 and an authentication key file file0, distribute the pre-set key file file1 to the first device and the second device, and distribute the authentication key file file0 to the first device, the second device and the device authentication authority; it is also used to establish a correspondence between the device identity DID1 of the first device and the device identity DID2 of the second device and the pre-set key file file1 with the file identifier FILE1.

[0064] The device certification authority is used to authenticate the identity of the first device and the second device.

[0065] The terminal device is used to perform an activation operation on the preset key file file1 based on the authentication success message; it is also used to generate a new preset key file file2. Each terminal device includes an identity authentication unit, a preset key unit, and a key authentication unit, wherein the preset key unit includes a key identification module and a key storage module. The identity authentication unit is communicatively connected to the key identification module, and the identity authentication unit and the key authentication unit are communicatively connected to the key storage module after the device identity authentication is successful. Figure 1 As shown, solid lines represent direct connections, while dashed lines represent conditional connections. A connection is established only if the conditions are met, such as the first and second connections described below.

[0066] The identity authentication unit is used to generate an identity authentication request for the device authentication authority to perform device identity authentication operations, and is also used to send an activation key notification to the key storage module based on the identity authentication success message.

[0067] The key identification module is used to store the file identifier FILE1 of the preset key file file1, the device identity KCID of the preset key distribution organization, and the corresponding relationship. The key storage module is used to preset the key file file1, and to establish a first connection with the identity authentication unit and a second connection with the key authentication unit according to the identity authentication success message, to perform the preset key file activation operation, and to generate and store a new preset key file file2.

[0068] The key authentication unit is used to store the authentication key file file0 and to perform authentication operations on the key data.

[0069] Based on the above-mentioned pre-set key activation system, such as Figure 2 As shown, the present invention also provides a method for activating a preset key applied to a preset key activation system, the method comprising:

[0070] Step 1: The pre-configured key distribution organization distributes the pre-configured key file file1 and the authentication key file file0 to the first device and the second device.

[0071] Specifically, step 1 includes:

[0072] Step 1-1: The pre-configured key distribution agency obtains the device identity DID1 of the first device and the device identity DID2 of the second device, generates a set of pre-configured key files file1 locally for the first and second devices, and records the file identifier of the pre-configured key file file1 as FILE1. The pre-configured key file file1 is sent to the key storage module in the pre-configured key unit of the first and second devices for file storage. The file identifier FILE1 of the pre-configured key file file1, along with the device identity KCID of the pre-configured key distribution agency, is sent to the key identifier module in the pre-configured key unit of the first and second devices for storage.

[0073] Steps 1-2: The pre-configured key distribution organization establishes a correspondence between the device identity DID1 of the first device and the device identity DID2 of the second device and the pre-configured key file file1 with the file identifier FILE1, such as... Figure 3 As shown; it should be noted that the Device Identity (DID) is a unique identifier for the terminal device in the communication network. This identifier can be used by the device authentication authority to authenticate the device identity; the pre-set key distribution agency sends this correspondence to the key identifier module in the pre-set key unit of the first and second devices for storage;

[0074] Steps 1-3: The pre-configured key distribution agency generates a set of authentication key files file0 locally, and sends the authentication key files file0 to the key authentication units of the first and second devices and the device authentication agency for file storage; as can be seen from the context of the present invention, the authentication key files file0 are used to provide random numbers for device identity authentication, and therefore do not need to be stored in the key storage unit;

[0075] Steps 1-4: The pre-configured key distribution mechanism disconnects from the first and second devices.

[0076] In this step, the purpose of separating the storage of the pre-configured key file file1 and its file identifier FILE1 is to achieve hardware-level security isolation and logical association. The pre-configured key file file1 is securely stored in the key storage module of the pre-configured key unit using hardware isolation. This key storage module prohibits all access before successful authentication of the terminal device, thus ensuring that the key entity, i.e., the pre-configured key file file1 itself, cannot be obtained or leaked. Its non-sensitive file identifier FILE1 is stored independently and used only as a query parameter in the authentication process. This design ensures that even if the file identifier is leaked, the overall system security remains unaffected because the hardware-protected key entity cannot be associated with or accessed.

[0077] Step 2: The equipment certification body performs equipment identity authentication on the first and second equipment.

[0078] In embodiments of the present invention, the second device can also act as the initiator of data transmission, that is, the second device sends a request message to the first device. In this case, the device authentication authority will first perform device identity authentication on the second device. Therefore, the first device and the second device are interchangeable in such operations.

[0079] The specific process of step 2 is as follows:

[0080] Step 2-1: The authentication unit of the first device obtains two random numbers p1 and s1, each with a length of 128 bits, from the authentication key file file0, and records the key index idx-s1 of the random number s1 in the authentication key file file0; it then uses the random number p1 to generate an irreducible polynomial. The irreducible polynomial The string consisting of the coefficients of each term except the highest term is denoted as str1; using irreducible polynomials Generate the first hash function with random number s1 ;

[0081] Step 2-2: The authentication unit of the first device obtains the file identifier FILE1 of the preset key file and the device identity KCID of the preset key distribution organization from the key identifier module of the preset key unit;

[0082] Steps 2-3: The authentication unit of the first device inputs the file identifier FILE1, the device identity KCID, and its own device identity DID1 as parameters into the first hash function. The first hash value H1 is obtained. ;

[0083] Steps 2-4: The identity authentication unit of the first device generates an identity authentication request req and sends it to the device authentication authority. The identity authentication request req includes information such as string str1, key index idx-s1, first hash value H1, file identifier FILE1, and device identity KCID.

[0084] Steps 2-5: The device authentication authority parses the identity authentication request req to obtain information such as string str1', key index idx-s1', hash value H1', ​​file identifier FILE1', and device identity KCID'. Based on the device identity KCID', it addresses the pre-set key distribution authority, and then uses the file identifier FILE1' as an index to obtain the device identities of the two terminal devices corresponding to the file identifier FILE1' according to the correspondence established in Step 1-2: device identity DID1 and device identity DID2.

[0085] Steps 2-6: The device certification authority generates based on the string str1' Based on the key index idx-s1', a random number s1' is obtained from the authentication key file file0. Generate a second hash function with random number s1' Using the second hash function, calculate the second sub-hash value H2-1 for (FILE1',KCID',DID1) and (FILE1',KCID',DID2) respectively. Second sub-hash value H2-2= These two values ​​are compared with the parsed hash value H1': if either the second sub-hash value H2-1 or the second sub-hash value H2-2 matches the hash value H1', ​​then the authentication of the first device is successful. Here, the second sub-hash value H2-1 matches the first hash value H1, and the terminal device ID calculated corresponding to the second sub-hash value H2-1 is denoted as ID1; if neither the second sub-hash value H2-1 nor the second sub-hash value H2-2 matches the hash value H1', ​​then authentication fails, and the activation process ends.

[0086] Steps 2-7: In response to the device authentication authority determining that the received authentication request req comes from the first device based on the sub-hash value that is consistent with the hash value H1' as the second sub-hash value H2-1, the device authentication authority feeds back the authentication result to the authentication unit of the first device; if the authentication fails, the authentication failure result is sent to both the first device and the second device. That is, if one of the two corresponding devices with the pre-set symmetric key fails the authentication, the other will also consider the authentication to have failed, and neither of them can activate the pre-set key for use, thus ending the activation process.

[0087] In step 2, the reason why sub-hash values ​​need to be calculated for the two device IDs in steps 2-5 and 2-6 is that the device authentication authority obtains two device IDs from the pre-set key distribution authority based on the received identity authentication request req, according to the file identifier FILE1 and the device identity KCID. The device authentication authority cannot know whether the request comes from the first device or the second device, so it calculates for both. As long as one of the hash values ​​matches, the identity authentication is successful, and at this time it is determined that the corresponding identity authentication request is from the first device with device ID DID1.

[0088] In embodiments of the present invention, the certification method used by the device certification authority for the second device is the same as the certification method used for the first device, that is:

[0089] Step 2 further includes steps 2-8: The second device performs device authentication using the same method as the first device. If the authentication is successful, the authentication result is fed back to the authentication unit of the second device; if the authentication fails, the authentication failure result is sent to both the first device and the second device to end the activation process.

[0090] Step 3: Based on the successful authentication message, the first device and the second device respectively perform an activation operation on the preset key file file1. This includes: establishing a first connection between the key storage module in the first device and the identity authentication unit, and establishing a second connection between the key storage module and the key authentication unit to perform the activation operation.

[0091] Specifically, based on the feedback that the device identity authentication of both the first device and the second device has been passed, the identity authentication units of the first device and the second device establish a first connection with the key storage module. The identity authentication units send an activation key notification to the key storage module through the first connection. In response to the activation key notification, the key storage module allows the key to be obtained from the preset key file file1 for external use.

[0092] The key authentication units of the first and second devices also establish a second connection with the key storage module.

[0093] Step 4: The first device authenticates the key data with the second device based on the data information in the preset key file file1.

[0094] Specifically, the key authentication unit calculates a hash value based on the data information of the preset key file file1 obtained from the second connection, and authenticates the key data with the second device.

[0095] The specific process of step 4 is as follows:

[0096] Step 4-1: The key authentication unit of the first device obtains two random numbers p3 and s3, each with a length of 128 bits, from the preset key file file1, and records the key index idx-s3 of the random number s3 in the preset key file file1; it then uses the random number p3 to generate an irreducible polynomial. The irreducible polynomial The string consisting of the coefficients of each term except the highest term is denoted as str3; using irreducible polynomials Generate a third hash function with random number s3. Input the data information from the preset key file file1 into the third hash function. The third hash value H3 is obtained. ;

[0097] Step 4-2: The key authentication unit of the first device obtains a set of encryption keys k1 from the preset key file file1, records its index idx-k1, encrypts (H3, idx-s3, str3) using k1 to obtain the ciphertext MES, and sends MES and idx-k1 to the key authentication unit of the second device.

[0098] Step 4-3: The key authentication unit of the second device obtains the decryption key k1' from the preset key file file1 in the local key storage module based on the key index idx-k1', decrypts the ciphertext MES', and obtains (H3', idx-s3', str3').

[0099] Step 4-4: The key authentication unit of the second device generates an irreducible polynomial based on the string str3'. The random number s3' is obtained from the preset key file file1 based on the key index idx-s3', and is based on the irreducible polynomial. Generate the fourth hash function with random number s3' The local preset key file file1 is input as a parameter into the fourth hash function. The fourth hash value H4 is obtained. , compare the fourth hash value H4 with the hash value H3'. If they are the same, the key authentication passes. If they are different, the key authentication fails, and the preset keys of both the first device and the second device become invalid. Return to step 1.

[0100] In this way, as long as the key files in the first device and the second device are inconsistent, or the decryption fails in step 4-3, or the hash comparison fails in step 4-4, double authentication is achieved to ensure the consistency of the key files.

[0101] Step 5: Based on the message that the key authentication passes, the first device and the second device determine the available preset key file file2:

[0102] Since the encryption key k1 is used in step 4, to ensure the principle of one-time pad, the used key cannot be used again. Therefore, the key storage module in the preset key unit of the first device needs to obtain the encryption key k1 from the key authentication unit, remove the part of the encryption key k1 from the local preset key file file1, obtain the second key file file2 and store it. At the same time, the key storage module in the preset key unit of the second device removes the part of the decryption key k1' obtained from the key authentication unit from the preset key file file1, and obtains the same second key file file2; this second key file file2 is used as the subsequent available preset key file file2.

[0103] Alternatively, the key storage module in the preset key unit of the first device obtains the encryption key k1 from the key authentication unit, calculates the length L of the encryption key k1, and arbitrarily selects a length l, where l satisfies L / 2 < l < L. As Figure 4 shown, take the first part with a length of l from the front of the encryption key k1, and the second part with a length of (L - l) before the encryption key k1. Combine the first part and the second part. The key composed of these two parts is denoted as the key k2, and its key index idx-k2 is recorded. Perform an exclusive OR operation on the encryption key k1 and the key k2 to obtain the key k3 = k1 ⊕ k2. Use the exclusive ORed key k3 to replace the original key k2 part, and form a new key file file2 as the available preset key file file2 and store it. It can be understood that as Figure 5 shown, the key k2 can also be the part with a length of l from the back of the encryption key k1 as the first part, and the part with a length of (L - l) after the end of the encryption key k1 as the second part.

[0104] The key storage module in the preset key unit of the first device sends the key index idx-k2 of the key k2 to the key authentication unit of the second device via the key authentication unit.

[0105] The key storage module in the preset key unit of the second device obtains the key index idx-k2' from the key authentication unit, obtains the key k2' based on the key index idx-k2', performs an XOR operation on the decryption key k1' and the key k2' to obtain the key k3'=k1'⊕k2', replaces the original key k2' part with the XORed key k3', and forms a new key file as the usable preset key file file2 and stores it.

[0106] Furthermore, the preset key file file2 can be updated by checking the key file, for example, by calculating and comparing hash values ​​to ensure the alignment of the updated preset key file.

Claims

1. A method for activating a preset key, characterized in that, The participants in the method include a pre-connected key distribution agency, a device authentication agency, and multiple terminal devices, wherein the terminal devices include a first device and a second device, which are two corresponding terminal devices with pre-set symmetric keys; the method includes the following steps: Step 1: The pre-configured key distribution organization distributes the pre-configured key file file1 and the authentication key file file0 to the first device and the second device; Step 2: The device authentication authority performs device identity authentication on the first device and the second device based on the authentication key file file0; Step 3: Based on the message indicating successful device authentication, the first device and the second device respectively perform activation operations on the preset key file file1, including: the key storage module in the first device and the second device establish a first connection with the authentication unit and a second connection with the key authentication unit to perform the activation operation; Step 4: The first device authenticates the key data with the second device based on the data information in the preset key file file1; Step 5: Based on the key authentication success message, the first device and the second device determine the usable preset key file file2.

2. The preset key activation method according to claim 1, characterized in that, Step 1 includes: Step 1-1: The pre-configured key distribution organization obtains the device identity DID1 of the first device and the device identity DID2 of the second device, and generates a set of pre-configured key files file1 locally for the first and second devices. The file identifier of the pre-configured key file file1 is denoted as FILE1. The pre-configured key file file1 is sent to the key storage module in the pre-configured key unit of the first and second devices for storage. The file identifier FILE1 of the pre-configured key file file1, along with the device identity KCID of the pre-configured key distribution organization, is sent to the key identifier module in the pre-configured key unit of the first and second devices for storage. Step 1-2: The pre-set key distribution mechanism establishes a correspondence between the device identity DID1 of the first device and the device identity DID2 of the second device and the pre-set key file file1 with file identifier FILE1. The pre-set key distribution mechanism sends the correspondence to the key identifier module in the pre-set key unit of the first device and the second device for storage. Steps 1-3: The pre-configured key distribution agency generates a set of authentication key files file0 locally, and sends the authentication key files file0 to the key authentication units and device authentication agencies of the first and second devices for storage; Steps 1-4: The pre-configured key distribution agency disconnects from the first and second devices.

3. The preset key activation method according to claim 2, characterized in that, The specific process of step 2 includes: The equipment certification body performs equipment identity verification on the first piece of equipment: Step 2-1: The authentication unit of the first device obtains two random numbers p1 and s1, each with a length of 128 bits, from the authentication key file file0, and records the key index idx-s1 of the random number s1 in the authentication key file file0; it then uses the random number p1 to generate an irreducible polynomial. The irreducible polynomial The string consisting of the coefficients of each term except the highest term is denoted as str1; using irreducible polynomials Generate the first hash function with random number s1 ; Step 2-2: The authentication unit of the first device obtains the file identifier FILE1 of the preset key file and the device identity KCID of the preset key distribution organization from the key identifier module of the preset key unit; Steps 2-3: The authentication unit of the first device inputs the file identifier FILE1, the device identity KCID, and its own device identity DID1 as parameters into the first hash function. The first hash value H1 is obtained. ; Steps 2-4: The identity authentication unit of the first device generates an identity authentication request req and sends it to the device authentication authority. The identity authentication request req includes the string str1, the key index idx-s1, the first hash value H1, the file identifier FILE1, and the device identity KCID. Steps 2-5: The device authentication authority parses the identity authentication request req to obtain the string str1', key index idx-s1', hash value H1', ​​file identifier FILE1', and device identity KCID'. Based on the device identity KCID', it addresses the preset key distribution authority, and then uses the file identifier FILE1' as the index to obtain the device identities of the two terminal devices corresponding to the file identifier FILE1' according to the correspondence established in Step 1-2: device identity DID1 and device identity DID2. Steps 2-6: The device certification authority generates based on the string str1' Based on the key index idx-s1', a random number s1' is obtained from the authentication key file file0. Generate a second hash function with random number s1' Using the second hash function, calculate the second sub-hash value H2-1 for (FILE1', KCID', DID1) and (FILE1', KCID', DID2) respectively. Second sub-hash value H2-2= These two values ​​are compared with the hash value H1': if either the second sub-hash value H2-1 or the second sub-hash value H2-2 matches the hash value H1', ​​then the authentication of the first device is successful; if neither the second sub-hash value H2-1 nor the second sub-hash value H2-2 matches the hash value H1', ​​then the authentication fails and the process ends. Steps 2-7: In response to the device authentication authority determining that the received identity authentication request req comes from the first device based on the sub-hash value that is consistent with the hash value H1' as the second sub-hash value H2-1, the device authentication authority sends the authentication result back to the identity authentication unit of the first device; if the authentication fails, the authentication failure result is sent to both the first device and the second device, and the process ends. The equipment certification body performs equipment identity verification for the second device: Steps 2-8: The second device performs device authentication using the same method as the first device. If the authentication is successful, the successful authentication result is fed back to the authentication unit of the second device; if the authentication fails, the failure result is sent to both the first and second devices simultaneously, and the process ends.

4. The preset key activation method according to claim 3, characterized in that, The specific process of step 3 is as follows: Based on the feedback that the device identity authentication of both the first device and the second device has been successful, the identity authentication units of the first device and the second device establish a first connection with the key storage module. The identity authentication unit sends an activation key notification to the key storage module through the first connection. In response to the activation key notification, the key storage module allows the key to be obtained from the preset key file file1 for external use. The key authentication unit of the first and second devices establishes a second connection with the key storage module.

5. The preset key activation method according to claim 4, characterized in that, The specific process of step 4 is as follows: Step 4-1: The key authentication unit of the first device obtains two random numbers p3 and s3 with a length of 128 bits from the preset key file file1 based on the second connection, and records the key index idx-s3 of the random number s3 in the preset key file file1; Generate irreducible polynomials using random number p3 The irreducible polynomial The string consisting of the coefficients of each term except the highest term is denoted as str3; using irreducible polynomials Generate a third hash function with random number s3. ; Input the data information from the preset key file file1 into the third hash function. The third hash value H3 is obtained. ; Step 4-2: The key authentication unit of the first device obtains a set of encryption keys k1 from the preset key file file1, records its index idx-k1, encrypts (H3, idx-s3, str3) using k1 to obtain the ciphertext MES, and sends MES and idx-k1 to the key authentication unit of the second device. Step 4-3: The key authentication unit of the second device obtains the decryption key k1' from the preset key file file1 in the local key storage module based on the key index idx-k1', decrypts the ciphertext MES', and obtains (H3', idx-s3', str3'). Step 4-4: The key authentication unit of the second device generates an irreducible polynomial based on the string str3'. The random number s3' is obtained from the preset key file file1 based on the key index idx-s3', and is based on the irreducible polynomial. Generate the fourth hash function with random number s3' The local preset key file file1 is input as a parameter into the fourth hash function. The fourth hash value H4 is obtained. Compare the fourth hash value H4 with the hash value H3'. If they match, the key authentication is successful; otherwise, the key authentication fails, and return to step 1.

6. The preset key activation method according to claim 5, characterized in that, The specific process of step 5 includes: The key storage module in the preset key unit of the first device obtains the encryption key k1 from the key authentication unit, removes the part of the encryption key k1 from the local preset key file file1, obtains the second key file file2 and stores it. At the same time, the key storage module in the preset key unit of the second device removes the part of the decryption key k1' obtained from the key authentication unit from the preset key file file1, obtains the second key file file2 and stores it; The second key file file2 is used as the available preset key file file2.

7. The preset key activation method according to claim 5, characterized in that, The specific process of step 5 includes: The key storage module in the preset key unit of the first device obtains the encryption key k1 from the key authentication unit, calculates the length L of the encryption key k1, arbitrarily takes a length l, where l satisfies L / 2 < l < L, takes the first part with a length of l from the front of the encryption key k1, and the second part with a length of (L - l) before or after the encryption key k1, combines the first part and the second part, the key composed of these two parts is denoted as the key k2, and records its key index idx-k2. Perform an exclusive OR operation on the encryption key k1 and the key k2 to obtain the key k3 = k1 ⊕ k2, use the exclusive ORed key k3 to replace the original key k2 part, form a new key file as the available preset key file file2 and store it; The key storage module in the preset key unit of the first device sends the key index idx-k2 of the key k2 to the key authentication unit of the second device via the key authentication unit; The key storage module in the preset key unit of the second device obtains the key index idx-k2' from the key authentication unit, obtains the key k2' according to the key index idx-k2', performs an exclusive OR operation on the decryption key k1' and the key k2' to obtain the key k3' = k1' ⊕ k2', uses the exclusive ORed key k3' to replace the original key k2' part, forms a new key file as the available preset key file file2 and stores it.

8. A preset key activation system for executing the preset key activation method according to any one of claims 1 to 7, characterized in that, The system includes a preset key distribution institution, a device authentication institution, and multiple terminal devices connected to the preset key distribution institution and the device authentication institution. The preset key distribution institution is also communicatively connected to the device authentication institution. The terminal devices include a first device and a second device, and the first device and the second device are two corresponding terminal devices preset with symmetric keys; The preset key distribution institution is used to generate a preset key file file1 and an authentication key file file0, send the preset key file file1 to the first device and the second device, send the authentication key file file0 to the first device, the second device and the device authentication institution; and is also used to establish a correspondence between the device identity DID1 of the first device and the device identity DID2 of the second device and the preset key file file1 with the file identifier FILE1; The device authentication institution is used to perform device identity authentication on the first device and the second device; The terminal device is used to perform an activation operation on the preset key file file1 according to the authentication success message; it is also used to generate a new preset key file file2.

9. The preset key activation system according to claim 8, characterized in that, Each terminal device includes an identity authentication unit, a preset key unit, and a key authentication unit. The preset key unit includes a key identification module and a key storage module. The identity authentication unit is communicatively connected to the key identification module. After the device identity authentication is successful, the identity authentication unit and the key authentication unit are communicatively connected to the key storage module. The identity authentication unit is used to generate an identity authentication request for the device authentication authority to perform device identity authentication operations, and is also used to send a notification to the key storage module to activate the key based on the identity authentication success message; The key identification module is used to store the file identifier FILE1 of the preset key file file1, the device identity KCID of the preset key distribution organization, and the corresponding relationship; The key storage module is used to preset key file file1, and to establish a first connection with the identity authentication unit and a second connection with the key authentication unit respectively according to the identity authentication success message, to perform the preset key file activation operation, and to generate and store a new preset key file file2. The key authentication unit is used to store the authentication key file file0 and to perform authentication operations on the key data.