Locking and unlocking management method and device, computer equipment and storage medium
By generating unlocking instructions and executing the locking or unlocking process, the problem of inability to debug after the ECU JTAG port is disabled is solved, effective access control and unauthorized access protection for the ECU are achieved, and production and debugging efficiency is improved.
Patent Information
- Application Number
- CN202510448078.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the JTAG port of the on-board ECU cannot be debugged after being disabled, resulting in the problem being unable to be fixed and the unauthorized access cannot be effectively prevented.
By obtaining the ECU's identification and bound random key, an additional unlocking instruction is generated, and after the first verification is passed, the locking or unlocking process is performed according to the unlocking flag bit, including writing the random key and switching the unlocking state, and access control is performed using software logic.
It realizes effective access restrictions on the ECU, avoids unauthorized access, and only affects a single vehicle when the key is leaked, improving production and debugging efficiency and reducing the risk of key exposure.
Smart Images

Figure CN120408728A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of control technology, and particularly to a method and device for unlocking and locking management, a computer device, and a storage medium. Background Art
[0002] In an automobile, in-vehicle ECU (Electronic Control Unit) should be protected by access control to prohibit unauthorized access. Therefore, it is necessary to restrict access to the ECU.
[0003] In related technologies, the external interface JTAG (Joint Test Action Group) of the in-vehicle ECU is controlled to avoid unauthorized access. The control methods include setting a one-time fuse hardware and fusing the interface hardware after the factory offline; and completely canceling this interface on the mass-produced version circuit board. However, in this way, the safe disabling of the JTAG port will cause the vehicle after-sales service to be unable to find the root cause of the problem through JTAG debugging, resulting in the problem being unable to be repaired. Summary of the Invention
[0004] Based on this, a method and device for unlocking and locking management, a computer device, and a storage medium are provided to improve the problem in the prior art that the external interface of the ECU needs to be fused or canceled after mass production to be safely controlled.
[0005] On the one hand, a method for unlocking and locking management is provided. The method includes:
[0006] Obtain the identifier of the electronic control unit and the random key bound to the identifier;
[0007] Obtain an unlocking and locking instruction according to the unlocking and locking flag bit, the identifier, and the random key;
[0008] Inject the unlocking and locking instruction into the electronic control unit for the electronic control unit to first verify the unlocking and locking instruction according to the identifier, and in the case of successful first verification, determine to execute a locking process or an unlocking process according to the unlocking and locking flag bit;
[0009] Wherein, the execution of the locking process includes writing the random key and switching the unlocking and locking state; the execution of the unlocking process includes secondarily verifying the unlocking and locking instruction according to the random key, and switching the unlocking and locking state in the case of successful second verification.
[0010] In one embodiment, obtaining an unlocking and locking instruction according to the unlocking and locking flag bit, the identifier, and the random key includes:
[0011] Perform encoding conversion according to the identifier to obtain the conversion value corresponding to the identifier;
[0012] Encrypt according to the conversion value and the random key to obtain a ciphertext, so as to obtain the unlocking instruction according to the unlocking flag bit and the ciphertext.
[0013] In one embodiment, obtaining the unlocking instruction according to the unlocking flag bit, the identifier, and the random key further includes:
[0014] Based on the unlocking flag bit and the ciphertext, obtain a checksum;
[0015] Obtain the unlocking instruction according to the combination of the unlocking flag bit, the ciphertext, and the checksum;
[0016] Before the electronic control unit first verifies the unlocking instruction according to the identifier, it further includes:
[0017] The electronic control unit calculates a new checksum according to the unlocking flag bit and the ciphertext in the unlocking instruction;
[0018] Compare the new checksum with the checksum in the unlocking instruction to judge the integrity of data transmission, so as to perform the first verification according to the identifier when the data transmission is complete.
[0019] In one embodiment, the execution of the unlocking process further includes:
[0020] When the secondary verification fails, record the number of key comparison errors;
[0021] When the number of key comparison errors is greater than a preset limit value, suspend the execution of the secondary verification and execute the secondary verification after the delay time ends.
[0022] In one embodiment, after injecting the unlocking instruction into the electronic control unit, it further includes:
[0023] Obtain the status code of the first verification, the locking process, or the unlocking process;
[0024] Execute corresponding processing measures according to the status code, wherein the electronic control unit is configured to determine the status code according to the result of the first verification, the result of the locking process, and the result of the unlocking process.
[0025] In one embodiment, after the execution of the locking process, it further includes:
[0026] Upload the binding relationship between the identifier and the random key for storage, so as to query and obtain the random key according to the identifier during unlocking.
[0027] In one embodiment, before the electronic control unit first verifies the unlocking instruction according to the identifier, it further includes:
[0028] Determine whether the first verification condition is satisfied according to the lock / unlock flag bit and the current lock / unlock state of the electronic control unit, so as to perform the first verification when the lock / unlock flag bit is inconsistent with the current lock / unlock state.
[0029] On the other hand, a lock / unlock management device is provided, and the device includes:
[0030] An acquisition module, configured to acquire the identifier of the electronic control unit and the random key bound to the identifier;
[0031] An instruction generation module, configured to obtain a lock / unlock instruction according to the lock / unlock flag bit, the identifier, and the random key;
[0032] A programming module, configured to inject the lock / unlock instruction into the electronic control unit, so that the electronic control unit first verifies the lock / unlock instruction according to the identifier, and determines to execute a locking process or an unlocking process according to the lock / unlock flag bit when the first verification is passed;
[0033] Wherein, the execution of the locking process includes writing the random key and switching the lock / unlock state; the execution of the unlocking process includes secondarily verifying the lock / unlock instruction according to the random key, and switching the lock / unlock state when the secondary verification is passed.
[0034] On yet another aspect, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the method is implemented.
[0035] A computer-readable storage medium is further provided, on which a computer program is stored, and when the computer program is executed by a processor, the method is implemented.
[0036] The above lock / unlock management method, device, computer device, and storage medium obtain a lock / unlock instruction through the lock / unlock flag bit, the identifier, and the random key. The electronic control unit first verifies the lock / unlock instruction according to the identifier, and determines to execute a locking process or an unlocking process according to the lock / unlock flag bit when the first verification is passed. The locking process includes writing the random key, and the unlocking process includes secondary verification according to the random key. The above process locks and unlocks the electronic control unit through software logic, avoiding unauthorized access to the external interface of the electronic control unit. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is an application environment diagram of the lock / unlock management method in an embodiment;
[0038] Figure 2 It is a flowchart of the lock / unlock management method in an embodiment;
[0039] Figure 3 It is a schematic flowchart of the unlocking and locking management method in another embodiment;
[0040] Figure 4 It is the internal execution process of the ECU in another embodiment;
[0041] Figure 5 It is a structural block diagram of the unlocking and locking management device in one embodiment;
[0042] Figure 6 It is the internal structure diagram of a computer device in one embodiment. Specific implementation manners
[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The JTAG port in the ECU can be used for software burning, chip testing, after-sales debugging to find problems, etc. The management method includes setting a one-time fuse hardware and fusing the interface hardware after the factory offline; and completely canceling this interface on the mass production version circuit board. However, in this way, the safe disabling of the JTAG port will cause the vehicle after-sales to be unable to find the root cause of the problem through JTAG debugging, resulting in the problem not being able to be repaired.
[0045] In the present application, the JTAG port of the ECU is controlled by setting the unlocking and locking instructions to avoid unauthorized access.
[0046] The unlocking and locking management method provided by the present application can be applied to an application environment as shown in Figure 1 , including a KMS (Key Management System) system, an MES (Manufacturing Execution System) system, and a burning device. Among them, the KMS system is used to generate and manage JTAG random keys, the MES system is used to bind the random key, SN (Serial Number), bind the SN number to the random key, and return the binding relationship to the KMS, and the burning device is used to inject the JTAG random key and return the injection situation. Which device is specifically used to implement the corresponding function can be adjusted according to the specific situation of the factory.
[0047] In one embodiment, taking the burning device as the execution subject, an unlocking and locking management method is provided to lock or unlock the JTAG port of the ECU. The unlocking and locking management method is as shown in Figure 2 and includes the following steps:
[0048] Step 110: Obtain the identifier of the electronic control unit and the random key bound to the identifier.
[0049] In this embodiment, the identifier is the SN number. The SN number can be selected as the hardware shell number, chip UID (Unique Identifier), PCBA (Printed Circuit Board Assembly) number, etc. As long as it can reflect the unique identifier of the product, there is no limitation here. In this embodiment, the hardware shell number is selected as the identifier, hereinafter referred to as SN.
[0050] In the production line stage, the random key is issued by the KMS system. The MES system completes the binding of the SN and the random key and issues them to the burning device. In the actual implementation process, the requirement of one machine one key is met, that is, a single ECU is only allowed to be bound to one random key, and the same random key is only bound to one ECU.
[0051] In the after-sales stage, the after-sales personnel query the bound random key from the KMS system according to the SN number.
[0052] Step 120: Obtain the locking / unlocking instruction according to the locking / unlocking flag bit, identifier, and random key.
[0053] The locking / unlocking flag bit represents whether this operation needs to lock or unlock the JTAG port, that is, to prohibit or enable the JTAG port. In the relevant fields of the locking / unlocking instruction, the locking / unlocking flag bit indicates locking with "55" and unlocking with "AA". Before the first operation, the ECU is in the unlocked state by default.
[0054] In the relevant fields of the locking / unlocking instruction, for the SN number, it needs to be encoded and converted into a common computer language and written into the chip. Exemplarily, taking the SN number (such as 202503220001) as a control character, the SN number is converted using the ASCII character encoding standard. ASCII is a data encoding widely used in computer and communication systems. After converting the SN number to obtain the corresponding ASCII value, the ASCII value is then converted into the corresponding hexadecimal to obtain the conversion value corresponding to the SN number, and then it can be written into the ECU.
[0055] Among them, the reason for hexadecimal conversion is that the value written using the UDS2E service needs to be in hexadecimal. In the actual implementation process, the encoding method or number system can be selected according to actual needs for conversion.
[0056] During the above process, the SN number and the random key are transmitted in plain text on the production line, which poses a risk of random key exposure. To reduce this risk, in some feasible implementation manners, the random key is encrypted. To ensure that the converted SN number written is consistent with the SN number in the binding relationship, the converted SN number (i.e., the conversion value) and the random key in the binding relationship should be encrypted together to obtain the ciphertext corresponding to the "converted SN number and random key". The unlock flag bit and the ciphertext are combined to form an unlock instruction, which is convenient for subsequent logical judgment inside the ECU.
[0057] Step 130, inject the unlock instruction into the electronic control unit.
[0058] Through the flashing device, inject the unlock instruction into the ECU. In the actual implementation process, use the UDS 31 service to write the above unlock instruction through the RID (Routine Control ID). Execute the unlock operation. UDS is the Unified Diagnostic Services (diagnostic communication protocol), and the UDS 31 service is the RoutineControl (routine control) service. This service allows users to use the RoutineControl (routine control) service to execute a specified sequence of steps and obtain any relevant results. The UDS 31 service can initiate the start, stop, or obtain the result of routine execution through a diagnostic instrument / host computer through relevant diagnostic commands. Its common usage scenarios are to erase memory, reset defined data, or detect refresh conditions during ECU flashing, etc. In this embodiment, it is used to write the above unlock instruction.
[0059] When the ECU responds to the UDS 31 service, it performs logical judgment. The logical judgment at least includes the first verification based on the SN number: the Hardware Security Modules (HSM) in the ECU unlocks the ciphertext of the "converted SN and random key" to obtain the plaintext of the "converted SN and random key", and the main core of the ECU judges whether the SN number is correct.
[0060] It should be noted that the SN number can be pre-stored in the main core non-volatile storage area for calling during the first verification. For example, in the ECU, first use the UDS2E service to write the "converted SN number (i.e., the conversion value)" through the DID. The UDS2E service is the write data service, and the DID is the Data ID (data identifier). Through the DID, data in the ECU can be accurately read or written. In the case of damage to the external SN number, the SN number can be read through the UDS22 service later. The UDS22 service is the read data service.
[0061] In the case of successful first verification, the ECU determines whether to execute the locking process or the unlocking process based on the locking / unlocking flag. The following describes the locking process and the unlocking process:
[0062] Executing the locking process includes: writing a random key and switching the locking / unlocking state. Writing the random key is, for example, storing the plaintext of the random key in the unlocking / locking instruction in the HSM; switching the locking / unlocking state means modifying the current unlocking state "AA" of the ECU to the locking state "55".
[0063] Executing the unlocking process includes: secondarily verifying the unlocking / locking instruction based on the random key, and switching the locking / unlocking state in the case of successful secondary verification. Secondary verification is to determine the consistency between the random key in the unlocking / locking instruction and the key stored in the HSM. If they are consistent, it is considered passed; otherwise, the secondary verification fails; switching the locking / unlocking state means modifying the current locking state "55" of the ECU to the unlocking state "AA".
[0064] In the above process, by injecting the unlocking / locking instruction into the ECU for the ECU to perform the first verification based on the SN number, after the first verification is passed, the ECU is locked or unlocked according to the locking / unlocking flag. Moreover, the factory writes the random key during the locking process, and the after-sales scenario performs secondary verification based on the random key during the unlocking process, effectively restricting access to the ECU through software logic and avoiding unauthorized access.
[0065] On the other hand, the present application adopts the one-device-one-key method, so even if the key is leaked, it will not cause batch network security incidents.
[0066] For the MES, it also includes uploading and storing the binding relationship between the identifier and the random key after the locking process is executed, so as to obtain the random key according to the identifier during unlocking (such as unlocking in the after-sales stage).
[0067] In some feasible embodiments, before the first verification, based on the locking state, the repeated locking or unlocking process is judged, as follows by way of example:
[0068] According to the locking / unlocking flag and the current locking / unlocking state of the electronic control unit, it is determined whether the first verification condition is met, so as to perform the first verification when the locking / unlocking flag is inconsistent with the current locking / unlocking state.
[0069] As described above, the ECU uses "AA" to indicate the current unlocking state and "55" to indicate the current locking state. If the locking / unlocking flag of the injected unlocking / locking instruction is consistent with the current locking / unlocking state of the ECU, for example, both are "AA", it means that the current operation is a repeated unlocking; if both are "55", it means that the current operation is a repeated locking. Only when the two are inconsistent will the first verification based on the SN number be performed.
[0070] In the above judgment process, values other than "55" / "AA" are regarded as illegal instructions.
[0071] By making a consistency judgment on the lock / unlock flag bit and the current lock / unlock state of the ECU, the repeated lock / unlock process is identified, which is convenient for the production line to find common production problems, such as whether to use the original binding relationship to lock after replacing the housing.
[0072] In some embodiments, before the first verification, the integrity of data transmission is also verified. Exemplarily, when generating the lock / unlock instruction, the programming device or after-sales device on the production line also obtains the checksum based on the lock / unlock flag bit and the ciphertext. The calculation method of the checksum is, for example, the CRC32 polynomial; according to the combination of the lock / unlock flag bit, the ciphertext, and the checksum, the lock / unlock instruction is obtained.
[0073] After the lock / unlock instruction is injected into the ECU, the ECU recalculates the new checksum checksum_1 according to the lock / unlock flag bit and the ciphertext, and compares the new checksum checksum_1 with the checksum in the lock / unlock instruction. If the new checksum checksum_1 is consistent with the checksum in the lock / unlock instruction, it is considered that the data transmission is complete; otherwise, it is considered that the lock / unlock instruction has been tampered with or information has been lost during transmission. By verifying the checksum, random bit flips, losses, or repetitions caused by noise and interference during transmission can be detected.
[0074] To prevent brute force cracking, a key verification error limit and a delay mechanism can be set. Exemplarily, when the second verification fails, the number of key comparison errors is recorded; when the number of key comparison errors is greater than the preset limit, the second verification is suspended, and the second verification is performed after the delay time ends. For example, in the current power-on cycle, if the random key verification fails 3 times, the delay is 5000 ms. When the delay time arrives, only 1 verification attempt is allowed.
[0075] In some implementation manners, the ECU responds to the UDS 31 service, runs a logical judgment, and feeds back the corresponding status code based on the judgment result. The programming device receives the status code and transmits the key injection situation back to the MES system. The status code can be a code value indicating the result of the first verification, a code value indicating the result of the locking process, or a code value indicating the result of the unlocking process. The electronic control unit is configured to determine the status code according to the result of the first verification, the result of the locking process, and the result of the unlocking process.
[0076] The production line then performs corresponding handling measures according to the status code. For example, when the first verification fails, check whether the written SN number is consistent with the SN number in the binding relationship; when the second verification fails, check the correctness of the random key in the unlocking step, etc.
[0077] Configuring the response status code can help the production line quickly find production problems.
[0078] like Figure 3 As shown, a schematic diagram of the locking and unlocking process in one embodiment is exemplified. Figure 3 In the diagram, the device names involved in each step are marked on the left side of the step.
[0079] Step 1-1: First, use the SN number as the ECU identifier and convert it into a hexadecimal conversion value;
[0080] Step 1-2: Call the KMS system interface to obtain a random key:
[0081] Step 1-3: Bind the SN number to the random key:
[0082] Step 2-1: Use the AES-128-CBC algorithm to encrypt the converted SN and random key as plain text to obtain the ciphertext of the converted SN and random key.
[0083] Step 2-2: The burning device uses the ciphertext of "encryption and unlocking flag" + "converted SN number and random key" as plaintext and uses CRC32 polynomial to calculate the checksum:
[0084] Step 3: Use the UDS2E service to write the converted SN through DID;
[0085] Step 4: The burning device also uses the UDS 31 service to write "encryption and unlocking flag + ciphertext of 'converted SN number and random key' + checksum" through RID;
[0086] Step 5: The burning device receives the return value of the routine and determines the writing status. In the above process, the "+" sign can be understood as a combination of fields.
[0087] In the above steps, there is no necessary sequential relationship between step 1-1 and step 1-2. Step 1-3 is executed after step 1-1 and step 1-2 are completed. After step 1 is completed as a whole, step 2 is started. Steps 2-1 and 2-2 are completed in sequence. There is no time limit between the entire step 1 and the entire step 2. They can be generated in real time during production or in large batches in advance. Steps 3 / 4 / 5 are executed in sequence and are executed during production.
[0088] Routine return values (i.e., status codes) include 00, 01, 02, 03, 04, and 05. The following describes the meaning of different return values:
[0089] 00: Successfully unlocked;
[0090] 01: The checksum is incorrect;
[0091] 02: It indicates that the lock / unlock instruction is consistent with the current JTAG lock / unlock status, or an illegal instruction is received;
[0092] 03: It indicates that the written SN number does not match the bound SN number;
[0093] 04: It indicates that the random key is incorrect;
[0094] 05: It indicates that the delay has not expired, and try to unlock.
[0095] As Figure 4 shown, it exemplarily illustrates the internal execution process of the ECU. Among them, first use the UDS2E service to write the SN number through the DID, and this process is implemented in the production line; then it is the lock phase for the production line or the unlock phase for after-sales. Use the UDS 31 service to execute the lock / unlock process through the RID. The Routine format is: "3101RID lock / unlock flag bit ("55" for locking / "AA" for unlocking) 'ciphertext checksum of the converted SN number and random key'".
[0096] After injecting the Routine, the main core of the ECU calculates checksum_1 and compares it with the checksum in the Routine to determine whether it is correct. It should be noted that the ECU calculates the checksum in real time and does not need to store it.
[0097] If the checksum verification fails, "3101RID 01" is returned, and the status code is 01
[0098] After the checksum verification passes, it is judged whether the lock / unlock flag bit is consistent with the current lock / unlock status and whether it is illegal (i.e., a value other than "55" / "AA"). If they are consistent or illegal, "3101RID 02" is returned, and the status code is 02.
[0099] In the case of being legal and consistent, the HSM unlocks the ciphertext of "the converted SN number and random key" to obtain the plaintext of "the converted SN and random key". The main core judges whether the SN number written by the DID is consistent with the SN number obtained by unlocking. If they are inconsistent, the ECU returns information to the host computer as "3101RID 03", and the status code is 03. If they are consistent, the locking process or the unlocking process is executed.
[0100] During the locking process, the ECU returns information as "3101RID 00", and the status code is 00. The locking process does not need to execute the random key comparison process. After the above steps are all passed, a new random key can be written into the ECU.
[0101] During the unlocking process, in the HSM, the random key in the Routine is compared with the random key stored in the HSM for consistency. If they are consistent, the returned information is "3101RID 00" and the status code is 00. If they are inconsistent, the main core determines whether the number of random key comparison errors exceeds a preset limit. If it exceeds the preset limit and is still within the delay period, the returned information is "3101RID 05" and the status code is 05. Otherwise, the returned information is "3101RID 04" and the status code is 04.
[0102] The unlocking and locking management method provided by this application uses one key per device to strengthen the control of the exposed interfaces of in-vehicle ECUs. Even if the key is leaked, only a single vehicle faces network security risks. By injecting the key in the Routine method, the reason for unlocking and locking failures can be effectively judged, so that the production line can make a quick response and execute the repair process, improving the production efficiency of the production line and the debugging efficiency of developers. The strategy of injecting both the SN number and the random key into the ECU is designed to effectively avoid the situation where the random key cannot be found when the SN number is damaged. The step of injecting the ciphertext of the key into the ECU can avoid the plaintext transmission of the key on the production line, thus reducing the risk of the key being exposed by production line personnel.
[0103] It should be understood that although Figure 1 the steps in the flowchart of Figure 1 are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover,
[0104] In one embodiment, as Figure 5 shown, a unlocking and locking management device is provided, including: an acquisition module 210, an instruction generation module 220, and a programming module 230, where:
[0105] The acquisition module 210 is used to acquire the identifier of the electronic control unit and the random key bound to the identifier;
[0106] The instruction generation module 220 is used to obtain the unlocking and locking instruction according to the unlocking and locking flag bit, the identifier, and the random key;
[0107] The programming module 230 is used to inject the locking and unlocking instructions into the electronic control unit, so that the electronic control unit can first verify the locking and unlocking instructions according to the identifier, and in the case of successful first verification, determine whether to execute the locking process or the unlocking process according to the locking and unlocking flag bit;
[0108] Among them, executing the locking process includes writing a random key and switching the locking and unlocking state; executing the unlocking process includes secondarily verifying the locking and unlocking instructions according to the random key, and switching the locking and unlocking state in the case of successful second verification.
[0109] The above device obtains the locking and unlocking instructions through the locking and unlocking flag bit, identifier and random key. The electronic control unit first verifies the locking and unlocking instructions according to the identifier, and in the case of successful first verification, determines whether to execute the locking process or the unlocking process according to the locking and unlocking flag bit. The locking process includes writing a random key, and the unlocking process includes secondarily verifying according to the random key. The above process locks and unlocks the electronic control unit through software logic, avoiding unauthorized access to the external interface of the electronic control unit.
[0110] In some embodiments, the instruction generation module 220 performs encoding conversion according to the identifier to obtain a conversion value corresponding to the identifier; encrypts according to the conversion value and the random key to obtain a ciphertext, so as to obtain the locking and unlocking instructions according to the locking and unlocking flag bit and the ciphertext.
[0111] In other embodiments, the instruction generation module 220 is further configured to obtain a checksum based on the locking and unlocking flag bit and the ciphertext; obtain the locking and unlocking instructions according to the combination of the locking and unlocking flag bit, the ciphertext and the checksum.
[0112] Before the electronic control unit first verifies the locking and unlocking instructions according to the identifier, it further includes the electronic control unit calculating a new checksum according to the locking and unlocking flag bit and the ciphertext in the locking and unlocking instructions; comparing the new checksum with the checksum in the locking and unlocking instructions to determine the integrity of data transmission, so as to perform the first verification according to the identifier in the case of complete data transmission.
[0113] When the electronic control unit executes the unlocking process, it further includes recording the number of key comparison errors in the case of failed second verification; when the number of key comparison errors is greater than a preset limit value, suspending the execution of the second verification and executing the second verification after the delay time ends.
[0114] The locking and unlocking management device further includes a status acquisition module 210, which is used to acquire the status code of the first verification, the locking process or the unlocking process; the status acquisition module 210 also executes corresponding processing measures according to the status code, wherein the electronic control unit is configured to determine the status code according to the results of the first verification, the results of the locking process, and the results of the unlocking process.
[0115] The unlocking and locking management device further includes a transmission module, which is used to upload the binding relationship between the identifier and the random key for storage, so that the random key can be obtained by querying according to the identifier during unlocking.
[0116] In some other embodiments, before the electronic control unit first verifies the unlocking and locking instruction according to the identifier, it further includes determining whether the first verification condition is met according to the unlocking and locking flag bit and the current unlocking and locking state of the electronic control unit, so as to perform the first verification when the unlocking and locking flag bit is inconsistent with the current unlocking and locking state.
[0117] For the specific limitations of the unlocking and locking management device, reference can be made to the limitations of the unlocking and locking management method in the above text, which will not be elaborated here. Each module in the above unlocking and locking management device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0118] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 6 shown. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements an unlocking and locking management method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0119] Those skilled in the art can understand that Figure 6 the structure shown in
[0120] is only a block diagram of some parts of the structure related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.
[0121] Obtain the identifier of the electronic control unit and the random key bound to the identifier;
[0122] Obtain the locking / unlocking instruction according to the locking / unlocking flag bit, the identifier, and the random key;
[0123] Inject the locking / unlocking instruction into the electronic control unit for the electronic control unit to first verify the locking / unlocking instruction according to the identifier, and in the case of successful first verification, determine to execute the locking process or the unlocking process according to the locking / unlocking flag bit;
[0124] Among them, executing the locking process includes writing the random key and switching the locking / unlocking state; executing the unlocking process includes secondarily verifying the locking / unlocking instruction according to the random key, and switching the locking / unlocking state in the case of successful second verification.
[0125] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0126] Perform encoding conversion according to the identifier to obtain the conversion value corresponding to the identifier;
[0127] Encrypt according to the conversion value and the random key to obtain the ciphertext, so as to obtain the locking / unlocking instruction according to the locking / unlocking flag bit and the ciphertext.
[0128] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0129] Obtain the checksum based on the locking / unlocking flag bit and the ciphertext;
[0130] Obtain the locking / unlocking instruction according to the combination of the locking / unlocking flag bit, the ciphertext, and the checksum;
[0131] s Before the electronic control unit first verifies the locking / unlocking instruction according to the identifier, it further includes:
[0132] The electronic control unit calculates a new checksum according to the locking / unlocking flag bit and the ciphertext in the locking / unlocking instruction;
[0133] Compare the new checksum with the checksum in the locking / unlocking instruction to judge the integrity of data transmission, so as to perform the first verification according to the identifier in the case of complete data transmission.
[0134] When the second verification by the electronic control unit fails, record the number of key comparison errors; when the number of key comparison errors is greater than the preset limit value, suspend the execution of the second verification, and perform the second verification after the delay time ends.
[0135] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0136] Obtain the status code of the first verification, the locking process, or the unlocking process;
[0137] Execute corresponding processing measures according to the status code, where the electronic control unit is configured to determine the status code based on the results of the first verification, the locking process, and the unlocking process.
[0138] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0139] Upload the binding relationship between the identifier and the random key for storage, so that the random key can be obtained by querying according to the identifier during unlocking.
[0140] In one embodiment, before the electronic control unit first verifies the locking and unlocking instructions according to the identifier, it determines whether the first verification condition is met according to the locking and unlocking flag bit and the current locking and unlocking state of the electronic control unit, so as to perform the first verification when the locking and unlocking flag bit is inconsistent with the current locking and unlocking state.
[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0142] Obtain the identifier of the electronic control unit and the random key bound to the identifier;
[0143] Obtain the locking and unlocking instructions according to the locking and unlocking flag bit, the identifier, and the random key;
[0144] Inject the locking and unlocking instructions into the electronic control unit for the electronic control unit to first verify the locking and unlocking instructions according to the identifier, and in the case of successful first verification, determine to execute the locking process or the unlocking process according to the locking and unlocking flag bit;
[0145] Among them, executing the locking process includes writing the random key and switching the locking and unlocking state; executing the unlocking process includes secondarily verifying the locking and unlocking instructions according to the random key, and switching the locking and unlocking state in the case of successful secondary verification.
[0146] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0147] Perform encoding conversion according to the identifier to obtain the conversion value corresponding to the identifier;
[0148] Encrypt according to the conversion value and the random key to obtain the ciphertext, so as to obtain the locking and unlocking instructions according to the locking and unlocking flag bit and the ciphertext.
[0149] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0150] Obtain the checksum based on the locking and unlocking flag bit and the ciphertext;
[0151] Obtain the unlocking / locking instruction according to the combination of the unlocking / locking flag bit, ciphertext, and checksum.
[0152] Before the electronic control unit first verifies the unlocking / locking instruction according to the identifier, it further includes:
[0153] The electronic control unit calculates a new checksum according to the unlocking / locking flag bit and ciphertext in the unlocking / locking instruction.
[0154] Compare the new checksum with the checksum in the unlocking / locking instruction to determine the integrity of data transmission, so as to perform the first verification according to the identifier when the data transmission is complete.
[0155] In one embodiment, when the secondary verification fails, the electronic control unit records the number of key comparison errors.
[0156] When the number of key comparison errors is greater than the preset limit value, suspend the execution of the secondary verification and perform the secondary verification after the delay time ends.
[0157] In one embodiment, when the computer program is executed by the processor, it further implements the following steps:
[0158] Obtain the status code of the first verification, locking process, or unlocking process.
[0159] Execute the corresponding processing measures according to the status code, where the electronic control unit is configured to determine the status code according to the results of the first verification, locking process, and unlocking process.
[0160] In one embodiment, when the computer program is executed by the processor, it further implements the following steps:
[0161] Upload the binding relationship between the identifier and the random key for storage, so as to obtain the random key according to the identifier during unlocking.
[0162] In one embodiment, before the electronic control unit first verifies the unlocking / locking instruction according to the identifier, it further includes determining whether the first verification condition is met according to the unlocking / locking flag bit and the current unlocking / locking state of the electronic control unit, so as to perform the first verification when the unlocking / locking flag bit is inconsistent with the current unlocking / locking state.
[0163] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0164] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0165] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for unlocking and locking management, characterized in that Including: Obtain the identifier of the electronic control unit and the random key bound to the identifier; Obtain the locking / unlocking instruction according to the locking / unlocking flag bit, the identifier and the random key; Inject the locking / unlocking instruction into the electronic control unit for the electronic control unit to first verify the locking / unlocking instruction according to the identifier, and in the case of successful first verification, determine to execute the locking process or the unlocking process according to the locking / unlocking flag bit; Wherein, the execution of the locking process includes writing the random key and switching the locking / unlocking state; the execution of the unlocking process includes secondarily verifying the locking / unlocking instruction according to the random key, and switching the locking / unlocking state in the case of successful second verification.
2. The unlocking and locking management method according to claim 1, characterized in that Obtaining the locking / unlocking instruction according to the locking / unlocking flag bit, the identifier and the random key includes: Perform encoding conversion according to the identifier to obtain the conversion value corresponding to the identifier; Encrypt according to the conversion value and the random key to obtain the ciphertext, so as to obtain the locking / unlocking instruction according to the locking / unlocking flag bit and the ciphertext.
3. The unlocking and locking management method according to claim 2, wherein Obtaining the locking / unlocking instruction according to the locking / unlocking flag bit, the identifier and the random key further includes: Obtain the checksum based on the locking / unlocking flag bit and the ciphertext; Obtain the locking / unlocking instruction according to the combination of the locking / unlocking flag bit, the ciphertext and the checksum; Before the electronic control unit first verifies the locking / unlocking instruction according to the identifier, it further includes: The electronic control unit calculates a new checksum according to the locking / unlocking flag bit and the ciphertext in the locking / unlocking instruction; Compare the new checksum with the checksum in the locking / unlocking instruction to judge the integrity of data transmission, so as to perform the first verification according to the identifier in the case of complete data transmission.
4. The unlocking and locking management method according to claim 1, wherein, The execution of the unlocking process further includes: Record the number of key comparison errors in the case of failed second verification; When the number of key comparison errors is greater than the preset limit value, suspend the execution of the second verification and execute the second verification after the delay time ends.
5. The unlocking and locking management method according to claim 1, characterized in that After injecting the locking / unlocking instruction into the electronic control unit, it further includes: Obtain the status code of the first verification, the locking process or the unlocking process; Execute the corresponding processing measure according to the status code, wherein the electronic control unit is configured to determine the status code according to the result of the first verification, the result of the locking process and the result of the unlocking process.
6. The unlocking and locking management method according to claim 1, wherein After the execution of the locking process, it further includes: Upload the binding relationship between the identifier and the random key for storage, so as to query and obtain the random key according to the identifier during unlocking.
7. The unlocking and locking management method according to claim 1, wherein Before the electronic control unit first verifies the locking / unlocking instruction according to the identifier, it further includes: Determine whether the first verification condition is met according to the locking / unlocking flag bit and the current locking / unlocking state of the electronic control unit, so as to perform the first verification in the case where the locking / unlocking flag bit is inconsistent with the current locking / unlocking state.
8. An unlocking management device, characterized in that, The device includes: An acquisition module for acquiring the identifier of the electronic control unit and the random key bound to the identifier; An instruction generation module for obtaining the locking / unlocking instruction according to the locking / unlocking flag bit, the identifier and the random key; A programming module, configured to inject the unlocking instruction into the electronic control unit, so that the electronic control unit first verifies the unlocking instruction according to the identifier, and in the case that the first verification is passed, determines to execute a locking process or an unlocking process according to the unlocking flag bit; Wherein, the execution of the locking process includes writing the random key and switching the unlocking state; the execution of the unlocking process includes secondarily verifying the unlocking instruction according to the random key, and switching the unlocking state in the case that the secondary verification is passed.
9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.