Certificate filling method and device based on CANFD
By extending the CANFD message data segment length and using a special negative response code, the security and reliability problems of certificate filling in the existing technology are solved, achieving higher security and reliability, and supporting the transmission of longer files. .
Patent Information
- Application Number
- CN202411072869.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-06
AI Technical Summary
The existing CANFD message data segment length is insufficient, making it difficult to transmit longer data files, and is easily tampered with by external parties during the security access verification process. The security and reliability are low, and the normal diagnosis process cannot be guaranteed.
Through the secure access service of the unified diagnostic service, the data segment length of the CANFD message is extended to 64 bytes, and the diagnostic process is maintained by combining the special negative response code to improve the security and reliability of certificate filling and ensure that the certificate file is not easily accessed by external parties. tampering, and can transfer longer files.
It improves the security and reliability of certificate filling, ensures the normal progress of the diagnostic process, enhances the protection of certificate files, and supports the transmission of longer data files.
Smart Images

Figure CN118827221A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of intelligent connected vehicles, and more specifically, to a certificate filling method and device based on CANFD. Background Art
[0002] With the rapid development of intelligent connected car technology and the continuous upgrading and application of Internet, AI, cloud computing and other technologies, cars are also developing towards intelligent terminals in the era of the Internet of Everything. On the vehicle-mounted ECU (Electronic Control Unit), with the development and update of software and networks, the hidden dangers of vehicle information data and network security are also increasing.
[0003] Currently, the 27 service (Security Access) in the UDS service (Unified Diagnostic Services) is mainly used to verify the security access to vehicle information data to prevent data leakage, network attacks and other problems.
[0004] However, the data segment length of the CAN (Controller Area Network) CANFD message supported by the existing method is only 8 bytes, which makes it difficult to transmit longer data files. It is also easily tampered with by the outside during the security access verification process, and its security and reliability are generally average. In addition, since the UDS service requires real-time response, the long data transmission in the certificate filling and the certificate reading, writing and verification require a certain amount of time, and the normal progress of the diagnostic process cannot be guaranteed. Summary of the invention
[0005] In view of this, the purpose of this application is to provide a certificate filling method and device based on CANFD, which verifies the secure access of ECU through the secure access service of the unified diagnostic service, and executes the certificate filling process based on the unified diagnostic service of CANFD, thereby improving the security and reliability of certificate filling, making it difficult for the certificate file to be tampered with externally, and the data segment length of the CANFD message can reach 64 bytes, increasing the data segment length of the supported message, and being able to transmit longer files. At the same time, the diagnostic process is maintained through a special negative response code to ensure the normal progress of the diagnostic process.
[0006] In a first aspect, an embodiment of the present application provides a certificate filling method based on CANFD, which is applied to an electronic control unit ECU; the certificate filling method includes:
[0007] After passing the secure access service of the unified diagnostic service, in response to receiving a first CANFD message sent by the electrical inspection device as a certificate application request, calling a certificate application interface to obtain a corresponding certificate request file;
[0008] Returning a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and polling the certificate application interface at a preset first cycle to determine whether the ECU has completed receiving the certificate request file;
[0009] If yes, fill the data stream of the certificate request file into the first CAN FD message, and return the filled first CAN FD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU;
[0010] In response to receiving the second CANFD message sent by the electrical inspection device as a certificate writing request, calling the corresponding certificate writing interface, and transmitting the security certificate to the vehicle system based on the certificate writing interface;
[0011] A special negative response code is returned to the electrical inspection device to start the waiting process of the electrical inspection device, and the certificate writing interface is polled in a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, a successful write response is returned to the electrical inspection device.
[0012] In a possible implementation, the secure access service through the unified diagnostic service includes:
[0013] In response to receiving a security access request sent by a diagnostic device, generating a corresponding random number seed, and returning the random number seed to the diagnostic device, so that the diagnostic device calculates an authentication key factor according to the random number seed and then sends the authentication key factor;
[0014] In response to receiving the authentication key factor sent by the diagnostic device, performing calculation based on the random number seed and a preset hash algorithm to obtain a corresponding hash code;
[0015] Obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed;
[0016] In response to the decrypted random number seed being consistent with the random number seed, a secure access service through the unified diagnostic service is determined.
[0017] In a possible implementation manner, obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed includes:
[0018] Concatenating the hash code and the authentication key factor to obtain a corresponding concatenated value, and calculating the concatenated value based on the hash algorithm to obtain a corresponding hash value;
[0019] The hash value is intercepted to obtain a key, and the authentication key factor is decrypted based on a preset encryption and decryption algorithm and the key to obtain a decrypted random number seed.
[0020] In a possible implementation, the method further includes:
[0021] If the ECU fails to complete receiving the certificate request file, the ECU returns the special negative response code to the electrical inspection device to start a waiting process of the electrical inspection device;
[0022] In response to the first waiting number being greater than a preset first waiting number threshold, a negative response is returned to the electrical inspection device.
[0023] In a possible implementation manner, the first CANFD message received from the electrical inspection device is a certificate application request, and calling a certificate application interface for obtaining a corresponding certificate request file includes:
[0024] In response to receiving a first CANFD message sent by the electrical inspection device, determining whether the routine control identity of the first CANFD message is a certificate application request;
[0025] If so, it is determined that the first CANFD message is a certificate file request instruction, and an interface for obtaining the corresponding certificate request file is called.
[0026] In a possible implementation, the method further includes:
[0027] If the vehicle system has not completed the storage of the security certificate, determining whether the second waiting number is greater than a preset second waiting number threshold;
[0028] In response to the second waiting times being greater than the second waiting times threshold, a write failure response is returned to the electrical inspection device.
[0029] In a possible implementation, the method further includes:
[0030] In response to receiving a third CANFD message sent by the diagnostic device as a certificate update process request, calling a corresponding certificate clearing interface;
[0031] The certificate request file stored in the vehicle system is deleted based on the certificate clearing interface.
[0032] In a second aspect, the embodiment of the present application further provides a certificate filling device based on CANFD, which is applied to an electronic control unit ECU; the certificate filling device includes:
[0033] A security module, configured to, after passing the security access service of the unified diagnostic service, call a certificate application interface to obtain a corresponding certificate request file in response to receiving a first CANFD message sent by the electrical inspection device as a certificate application request;
[0034] A first judgment module is used to return a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and poll the certificate application interface at a preset first period to determine whether the ECU has completed receiving the certificate request file;
[0035] a sending module, configured to fill the data stream of the certificate request file into the first CANFD message, and return the filled first CANFD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU;
[0036] A transmission module, configured to call a corresponding certificate writing interface in response to receiving a second CANFD message sent by the electrical inspection device as a certificate writing request, and transmit the security certificate to the vehicle system based on the certificate writing interface;
[0037] A return module is used to return a special negative response code to the electrical inspection device to activate the waiting process of the electrical inspection device, and poll the certificate writing interface with a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, a successful write response is returned to the electrical inspection device.
[0038] In a possible implementation manner, the security module is specifically used to:
[0039] In response to receiving a security access request sent by a diagnostic device, generating a corresponding random number seed, and returning the random number seed to the diagnostic device, so that the diagnostic device calculates an authentication key factor according to the random number seed and then sends the authentication key factor;
[0040] In response to receiving the authentication key factor sent by the diagnostic device, performing calculation based on the random number seed and a preset hash algorithm to obtain a corresponding hash code;
[0041] Obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed;
[0042] In response to the decrypted random number seed being consistent with the random number seed, a secure access service through the unified diagnostic service is determined.
[0043] In a possible implementation manner, the security module is specifically used to:
[0044] Concatenating the hash code and the authentication key factor to obtain a corresponding concatenated value, and calculating the concatenated value based on the hash algorithm to obtain a corresponding hash value;
[0045] The hash value is intercepted to obtain a key, and the authentication key factor is decrypted based on a preset encryption and decryption algorithm and the key to obtain a decrypted random number seed.
[0046] In a possible implementation manner, the CANFD-based certificate filling device further includes:
[0047] A second judgment module is used for returning the special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device if the ECU fails to complete the reception of the certificate request file;
[0048] The third judgment module is used to return a negative response to the electrical inspection device in response to the first waiting number being greater than a preset first waiting number threshold.
[0049] In a possible implementation manner, the security module is specifically used to:
[0050] A fourth judgment module, configured to respond to receiving a first CANFD message sent by the electrical inspection device and judge whether the routine control identity of the first CANFD message is a certificate application request;
[0051] The determination module is used to determine that if so, the first CANFD message is a certificate file request instruction, and call an interface to obtain the corresponding certificate request file.
[0052] In a possible implementation manner, the CANFD-based certificate filling further includes:
[0053] a fifth judgment module, configured to judge whether the second waiting number is greater than a preset second waiting number threshold if the vehicle system has not completed the storage of the security certificate;
[0054] The sixth judgment module is configured to return a write failure response to the electrical inspection device in response to the second waiting times being greater than the second waiting times threshold.
[0055] In a possible implementation manner, the CANFD-based certificate filling device further includes:
[0056] A calling module, configured to call a corresponding certificate clearing interface in response to receiving a third CANFD message sent by the diagnostic device as a certificate update process request;
[0057] A deletion module is used to delete the certificate request file stored in the vehicle system based on the certificate clearing interface.
[0058] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the CANFD-based certificate filling method as described in any one of the first aspects.
[0059] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the CANFD-based certificate filling method described in any one of the first aspects are executed.
[0060] The embodiment of the present application provides a CANFD-based certificate filling method and device. After passing the security access service of the unified diagnostic service, in response to receiving a first CANFD message sent by an electronic inspection device as a certificate application request, calling a certificate application interface to obtain a corresponding certificate request file, returning a special negative response code to the electronic inspection device to call up a waiting process of the electronic inspection device, and polling the certificate application interface with a preset first cycle to determine whether the ECU has completed the reception of the certificate request file. If so, filling the data stream of the certificate request file into the first CANFD message, returning the filled first CANFD message to the electronic inspection device, so that the electronic inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU. In response to receiving a second CANFD message sent by the electronic inspection device as a certificate write request, calling the corresponding certificate write interface, and transmitting the security certificate to the vehicle system based on the certificate write interface, returning a special negative response code to the electronic inspection device to call up the waiting process of the electronic inspection device, and polling the certificate write interface with a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, returning a successful write response to the electronic inspection device. This application verifies the secure access to the ECU through the secure access service of the unified diagnostic service, and executes the certificate filling process based on the unified diagnostic service of CANFD, which improves the security and reliability of the certificate filling, making the certificate file not easily tampered with by the outside world, and the data segment length of the CANFD message can reach 64 bytes, increasing the data segment length of the supported message, and can transmit longer files. At the same time, the diagnostic process is maintained through a special negative response code to ensure the normal progress of the diagnostic process.
[0061] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0063] Figure 1 It is a flow chart of a certificate filling method based on CANFD provided in an embodiment of the present application;
[0064] Figure 2 It is a schematic diagram of the certificate application process;
[0065] Figure 3 This is a schematic diagram of the certificate response process;
[0066] Figure 4 is a flow chart of a CANFD-based certificate filling method provided according to another embodiment of the present application;
[0067] Figure 5 It is a schematic diagram of the secure access service verification process;
[0068] Figure 6 This is a schematic diagram of the certificate renewal process;
[0069] Figure 7 It is a structural schematic diagram of a certificate filling device based on CANFD provided according to an embodiment of the present application;
[0070] Figure 8 It is a structural schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0071] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0072] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0073] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0074] With the rapid development of intelligent connected car technology and the continuous upgrading and application of Internet, AI, cloud computing and other technologies, cars are also developing towards intelligent terminals in the era of the Internet of Everything. On the vehicle ECU (Electronic Control Unit), with the development and update of software and networks, the hidden dangers of vehicle information data and network security are also increasing.
[0075] Currently, the 27 service (Security Access) in the UDS service (Unified Diagnostic Services) is mainly used to verify the security access to vehicle information data to prevent data leakage, network attacks and other problems.
[0076] However, the data segment length of the CAN (Controller Area Network) CANFD message supported by the existing method is only 8 bytes, which makes it difficult to transmit longer data files. It is also easily tampered with by the outside during the security access verification process, and its security and reliability are generally average. In addition, since the UDS service requires real-time response, the long data transmission in the certificate filling and the certificate reading, writing and verification require a certain amount of time, and the normal progress of the diagnostic process cannot be guaranteed.
[0077] In response to this problem, this application provides a certificate filling method and device based on CANFD, which verifies the secure access to the ECU through the secure access service of the unified diagnostic service, and executes the certificate filling process based on the unified diagnostic service of CANFD, thereby improving the security and reliability of the certificate filling, making it difficult for the certificate file to be tampered with externally, and the data segment length of the CANFD message can reach 64 bytes, increasing the data segment length of the supported message, and being able to transmit longer files. At the same time, the diagnostic process is maintained through a special negative response code to ensure the normal progress of the diagnostic process.
[0078] Figure 1 This is a flow chart of a CANFD-based certificate filling method provided in an embodiment of the present application, which is applied to an electronic control unit ECU. Figure 1 As shown, the certificate filling method based on CANFD in the embodiment of the present application may specifically include:
[0079] S101 . After passing the secure access service of the unified diagnostic service, in response to receiving a first CANFD message sent by an electrical inspection device as a certificate application request, calling a certificate application interface to obtain a corresponding certificate request file.
[0080] S102, returning a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and polling the certificate application interface in a preset first cycle to determine whether the ECU has completed receiving the certificate request file.
[0081] S103. If yes, fill the data stream of the certificate request file into the first CAN FD message, and return the filled first CAN FD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU.
[0082] S104: In response to receiving the second CAN FD message sent by the electrical inspection device as a certificate writing request, calling the corresponding certificate writing interface, and transmitting the security certificate to the vehicle system based on the certificate writing interface.
[0083] S105, returning a special negative response code to the electrical inspection device to start the waiting process of the electrical inspection device, and polling the certificate writing interface in a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, returning a successful write response to the electrical inspection device.
[0084] In the above-mentioned certificate filling method based on CANFD, the ECU is verified for secure access through the secure access service of the unified diagnostic service, and the certificate filling process is executed based on the unified diagnostic service of CANFD, which improves the security and reliability of certificate filling, making the certificate file not easily tampered with by the outside, and the data segment length of the CANFD message can reach 64 bytes, increasing the data segment length of the supported message, and can transmit longer files. At the same time, the diagnostic process is maintained through a special negative response code to ensure the normal progress of the diagnostic process.
[0085] Combine the following Figure 1-Figure 6 , the above exemplary steps of the embodiment of the present application are described with reference to specific examples:
[0086] S101, after passing the secure access service of the unified diagnostic service, in response to receiving a first CANFD message sent by an electrical inspection device as a certificate application request, calling a certificate application interface to obtain a corresponding certificate request file.
[0087] In the embodiment of the present application, the secure access service is the 27 service in the UDS service (unified diagnostic service) based on CAN FD (CAN with Flexible Data rate, variable rate CAN), the first CAN FD message is the CAN FD message sent by the electric inspection device, that is, the electric inspection diagnostic process instruction, the certificate request file is the file for applying for the certificate corresponding to the certificate application request, that is, the P10 file (this application is described by the P10 file), and the certificate application interface is the interface for obtaining the certificate request file. After the ECU passes the secure access service of the unified diagnostic service, the ECU receives the first CAN FD message sent by the electric inspection device and judges the first CAN FD message. When the first CAN FD message is a certificate application request, the certificate application interface for obtaining the certificate request file is called at this time for subsequent processing.
[0088] As a possible implementation mode, when the first CANFD message sent by the electrical inspection device is received as a certificate application request and the certificate application interface for obtaining the corresponding certificate request file is called, in response to receiving the first CANFD message sent by the electrical inspection device, it is determined whether the routine control identifier of the first CANFD message is a certificate application request; if so, it is determined that the first CANFD message is a certificate application request, and the interface for obtaining the corresponding certificate request file is called.
[0089] For example, Figure 2 As shown, the ECU determines whether to receive the electric inspection diagnostic process instruction, that is, the first CANFD message, through the first CANFD message analysis. When the corresponding received RID (Routine Control ID) is a certificate application, it means that the first CANFD message is a certificate application request, that is, the P10 file request instruction sent by the electric inspection equipment is received. At this time, it is necessary to call the interface for obtaining the P10 file, that is, call the certificate application interface for obtaining the certificate request file.
[0090] It can be understood by those in this field that CANFD is an upgraded version of the traditional CAN bus; UDS's 27 services, also known as security access services, are mainly used to ensure data security during data transmission, involving access control to sensitive or important data in the ECU to prevent unauthorized data access or modification; the P10 file is a file format for applying for a certificate, also known as a certificate request file, and the P10 file is a PKCS (Public-Key Cryptography Standards) #10 file.
[0091] It should be noted that the CANFD-based certificate filling method of the present application needs to be executed under the secure access service, i.e., the 27 service, that is, the certificate filling process can only be carried out after passing the secure access service, which ensures the security and reliability of the process.
[0092] It can be added here that the ECU needs to be pre-injected with the first and second level root certificates on the production line and generate the public and private keys of the ECU. Among them, the public key is used to encrypt data or verify the signature, while the private key is used to decrypt data or generate a signature. Generating a public and private key pair in the ECU can ensure that the ECU can participate in secure encrypted communication and data signing processes. The generated public and private key pairs will be saved in the secure storage area of the ECU. When the car factory is first filled with certificates, the electronic inspection equipment executes the certificate filling process for new parts. The filling process uses the 31 service (Routine Control) in the unified diagnostic service based on CANFD. In order to ensure the security and reliability of the diagnostic process, the 31 service needs to be executed normally under the 27 service. It should be noted that the car system (usually the Android system of the car) generates a certificate request file, namely the P10 file, based on the pre-injected public and private keys.
[0093] Further, in response to the ECU not passing the security access service of the unified diagnostic service, a negative response is sent to the diagnostic device. Specifically, if the security access service is not correctly passed 27, a negative response is directly replied, and the process cannot be continued at this time.
[0094] Therefore, using the unified diagnostic service based on CANFD, CANFD has expanded CAN. The maximum size of a CANFD single frame is 64 bytes, and a single multi-frame supports data stream interaction of up to 4k bytes. The data segment length of the supported message is increased, and longer certificate request files can be transmitted.
[0095] S102, returning a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and polling the certificate application interface in a preset first cycle to determine whether the ECU has completed receiving the certificate request file.
[0096] It should be noted that since the generation of the certificate request file, namely the P10 file, and the internal data interaction require a certain amount of waiting time, the diagnosis process needs to be maintained at this time to ensure the normal progress of the diagnosis process.
[0097] In the embodiment of the present application, the special negative response code is a special negative response code NRC78 in the UDS protocol, and the first cycle is a preset cycle of polling the certificate application interface, for example, 1S. This application is described as an example; after calling the certificate application interface to obtain the certificate request file, the special negative response code is returned to the electric inspection device to call up the waiting process of the electric inspection device, and the certificate application interface is polled in the preset first cycle to determine whether the ECU has completed the reception of the certificate request file. For example, Figure 2 As shown, after calling the interface to obtain the P10 file, wait for the P10 file to be transmitted and respond to NRC78, and call up the waiting process of the electrical inspection equipment. Specifically, the ECU first returns to NRC78 to request the waiting process of the electrical inspection equipment, and polls the P10 file interface with a 1-second period to determine whether the electrical inspection equipment has obtained the P10 file.
[0098] S103: If yes, fill the data stream of the certificate request file into the first CAN FD message, and return the filled first CAN FD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU.
[0099] In the embodiment of the present application, the data stream is the data corresponding to the certificate request file, and the security certificate is the security certificate requested by the certificate request file. After determining whether the ECU has completed the reception of the certificate request file in step S102, if the ECU has completed the reception of the certificate request file, the data stream of the certificate request file is filled into the first CANFD message, and the filled first CANFD message is returned to the electrical inspection device, so that the electrical inspection device generates the corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU. It should be noted that the electrical inspection device sends the security certificate to the ECU by sending a second CANFD message. For example, Figure 2As shown in the figure, if the electronic inspection device obtains the P10 file, the data stream is filled into the CANFD message and returned to the electronic inspection device, that is, the P10 file is responded to the electronic inspection device. After the electronic inspection device receives the P10 file responded by the ECU, it will generate the corresponding security certificate and send it to the ECU through the 31 service of UDS.
[0100] It should be noted that if the ECU fails to complete the reception of the certificate request file, it returns a special negative response code to the electrical inspection device to start the waiting process of the electrical inspection device; in response to the first waiting number being greater than the preset first waiting number threshold, a negative response is returned to the electrical inspection device. Among them, the first waiting number is the number of times the waiting process of the electrical inspection device occurs when the ECU receives the certificate request file, that is, the number of times the certificate application interface is polled. For example, if the first cycle is 1 second and the poll is performed 10 times, the first waiting number is 10 times, and the corresponding waiting time is 10 seconds. The first waiting number threshold is the pre-set waiting number threshold, that is, the threshold of the number of times the certificate application interface is polled, and the corresponding waiting time threshold. For example, the first waiting number threshold is 20 times, indicating that the number of times the certificate application interface is polled cannot exceed 20 times, that is, the waiting time cannot exceed 20 seconds. For example, if Figure 2 As shown, if the electrical inspection device has not yet obtained the P10 file, it will return to NRC78 to continue waiting. In order to avoid the electrical inspection process being in a suspended state for a long time, it is necessary to determine whether the first waiting number is greater than 20 times. If the first waiting number is greater than 20 times, it means that the P10 file has not been obtained after the waiting time exceeds 20 seconds. At this time, a negative response is returned to the electrical inspection device to end the process. If the first waiting number is not greater than 20 times, the loop will continue to execute the waiting for P10 file transmission and respond to NRC78, calling up the electrical inspection device waiting process to receive the P10 file.
[0101] Therefore, the diagnosis process is maintained through the special negative response code NRC78, and the waiting time (number of waiting times) can be flexibly configured, and the waiting time can be adjusted according to different scenarios and needs, ensuring the normal progress of the diagnosis process.
[0102] S104, in response to receiving the second CAN FD message sent by the electrical inspection device as a certificate writing request, calling the corresponding certificate writing interface, and transmitting the security certificate to the vehicle system based on the certificate writing interface.
[0103] In the embodiment of the present application, the second CANFD message is the CANFD message when the electric inspection device sends the security certificate. When the ECU receives the second CANFD message sent by the electric inspection device as a certificate write request, it calls the corresponding certificate write interface and transmits the security certificate to the vehicle system based on the certificate write interface. Figure 3As shown, when the ECU receives the second CANFD message sent by the electric inspection device, it parses the second CANFD message. When it is determined that the RID of the second CANFD message is a certificate write request, that is, a certificate write instruction, the certificate write interface is called to transfer the complete security certificate to the vehicle system for internal storage. It should be noted that when the electric inspection device receives the second CANFD message with the RID as a certificate write request, it receives the complete security certificate data through the CANTP layer and stores it in a temporary cache area, calls the certificate write request, and transmits the complete security certificate data to the system side, that is, the vehicle system, through the serial port data stream.
[0104] S105, returns a special negative response code to the electrical inspection device to call up the waiting process of the electrical inspection device, and polls the certificate writing interface in a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, returns a successful write response to the electrical inspection device.
[0105] It should be noted that since certificate transmission and data storage and verification require a certain amount of time, the ECU also needs to first feedback NRC78 to the electronic inspection device to wait for the process, and periodically poll the certificate write interface. If valid feedback data is obtained, it means that the vehicle system has completed the storage of the security certificate, and the write result will be successfully fed back to the electronic inspection device. Similarly, if valid feedback data is obtained, it means that the vehicle system has not completed the storage of the security certificate, and the write result failure will be fed back to the electronic inspection device.
[0106] In the embodiment of the present application, the second cycle is a preset cycle of the polling certificate writing interface, for example, 1S, and the present application is described as an example; after calling the certificate writing interface and transmitting the security certificate to the vehicle system based on the certificate writing interface, a special negative response code is returned to the electric inspection device to call up the waiting process of the electric inspection device, and the certificate application interface is polled in the preset second cycle to determine whether the vehicle system has completed the storage of the security certificate. If so, a successful write response is returned to the electric inspection device. For example, Figure 3 As shown, after calling the certificate write interface to transfer the certificate to the system's internal storage, wait for the certificate transmission process and respond to NRC78, and call up the electrical inspection equipment waiting process. Specifically, the ECU first returns to NRC78 to request the electrical inspection equipment to wait for the process, and polls the certificate write interface with a 1-second period to determine whether the vehicle system has completed the storage of the security certificate. If so, it returns the write success to the electrical inspection equipment.
[0107] It should be noted that if the vehicle system has not completed the storage of the security certificate, it determines whether the second waiting number is greater than the preset second waiting number threshold; in response to the second waiting number being greater than the second waiting number threshold, a write failure response is returned to the electrical inspection device. Among them, the second waiting number is the number of times the waiting process of the electrical inspection device occurs when the vehicle system completes the storage of the security certificate, that is, the number of times the certificate write interface is polled. For example, the second cycle is 1 second, and the polling is 10 times, then the second waiting number is 10 times, and the corresponding waiting time is 10 seconds. The second waiting number threshold is the pre-set waiting number threshold, that is, the threshold of the number of times the certificate write interface is polled, and the corresponding waiting time threshold. For example, the second waiting number threshold is 20 times, indicating that the number of times the certificate write interface is polled cannot exceed 20 times, that is, the waiting time cannot exceed 20 seconds.
[0108] For example, Figure 3 As shown, if the vehicle system has not completed the storage of the security certificate, it will return to NRC78 to continue waiting. In order to avoid the electrical inspection process being in a suspended state for a long time, it is necessary to determine whether the second waiting number is greater than 20 times. If the second waiting number is greater than 20 times, it means that the waiting time exceeds 20 seconds and the vehicle system has not completed the storage of the security certificate. At this time, a negative response is replied to the electrical inspection equipment to end the process. If the second waiting number is not greater than 20 times, the loop will continue to execute the waiting certificate file transmission and respond to NRC78, calling up the electrical inspection equipment waiting process to enable the vehicle system to complete the storage of the security certificate.
[0109] Therefore, the filling process is executed using the UDS diagnostic service based on the CANFD bus. Since physical device connection is required and the UDS diagnostic service needs to go through the secure access service to execute the filling process, it is safer and more reliable, and will not be injected with wrong certificates from the outside, nor will existing certificates be destroyed or erased, thus ensuring the safety and reliability of the filling process. In addition, the certificate can be filled using the factory's offline electrical inspection equipment or diagnostic instruments, making it convenient for after-sales service to execute certificate updates and read certificate status, thus ensuring the simplicity and flexibility of the filling process.
[0110] The CANFD-based certificate filling method provided in the embodiment of the present application, after passing the security access service of the unified diagnostic service, in response to receiving the first CANFD message sent by the electronic inspection device as a certificate application request, calling the certificate application interface for obtaining the corresponding certificate request file, returning a special negative response code to the electronic inspection device to call up the waiting process of the electronic inspection device, and polling the certificate application interface with a preset first cycle to determine whether the ECU has completed the reception of the certificate request file. If so, filling the data stream of the certificate request file into the first CANFD message, returning the filled first CANFD message to the electronic inspection device, so that the electronic inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU, in response to receiving the second CANFD message sent by the electronic inspection device as a certificate write request, calling the corresponding certificate write interface, and transmitting the security certificate to the vehicle system based on the certificate write interface, returning a special negative response code to the electronic inspection device to call up the waiting process of the electronic inspection device, and polling the certificate write interface with a preset second cycle, in response to the vehicle system having completed the storage of the security certificate, returning a successful write response to the electronic inspection device. The certificate filling method based on CANFD of this application verifies the secure access of ECU through the secure access service of the unified diagnostic service, and executes the certificate filling process based on the unified diagnostic service of CANFD, which improves the security and reliability of certificate filling, making the certificate file not easily tampered with by the outside, and the data segment length of the CANFD message can reach 64 bytes, increasing the data segment length of the supported message, and can transmit longer files. At the same time, the diagnostic process is maintained through a special negative response code to ensure the normal progress of the diagnostic process.
[0111] Further, such as Figure 4 As shown, the “secure access service through unified diagnostic service” in step S101 in the above embodiment may specifically include the following steps:
[0112] S401, in response to receiving a security access request sent by a diagnostic device, generating a corresponding random number seed, and returning the random number seed to the diagnostic device, so that the diagnostic device calculates an authentication key factor according to the random number seed and then sends the authentication key factor.
[0113] In the embodiment of the present application, the security access request is the UDS security access request sent by the diagnostic device, the random number seed is the random number Seed corresponding to the security access request, and the present application takes a 4-byte random number Seed as an example for description; the authentication key factor is the key factor required for authentication in the security access authentication, and the present application takes a 16-byte authentication Key as an example for description; the ECU receives the UDS security access request sent by the diagnostic device, generates the corresponding random number seed, and returns the random number seed to the diagnostic device, so that the diagnostic device calculates the authentication key factor based on the random number seed and then sends the authentication key factor. For example, Figure 5 As shown, the ECU receives the UDS security access request sent by the diagnostic device, generates a corresponding 4-byte random number Seed, and returns the 4-byte random number Seed to the diagnostic device. The diagnostic device calculates a 16-byte authentication Key based on the 4-byte random number Seed.
[0114] It is understandable to those skilled in the art that the ECU needs to securely protect the authentication key factor for secure access to diagnosis or flashing, which is used for encryption and decryption calculations during the secure access authentication process.
[0115] S402 , in response to receiving the authentication key factor sent by the diagnostic device, performing calculation based on a random number seed and a preset hash algorithm to obtain a corresponding hash code.
[0116] In the embodiment of the present application, the hash algorithm is a preset hash algorithm. For example, the present application takes SHA256 (Secure Hash Algorithm 256) as an example of a hash algorithm. The ECU receives the authentication key factor sent by the diagnostic device, calculates based on the random number seed and the preset hash algorithm, and obtains the corresponding hash code. For example, Figure 5 As shown, the ECU receives the 16-byte authentication Key sent by the diagnostic device, uses the 4-byte random number Seed to perform SHA256 calculation, and obtains a 32-byte hash code (HashCode).
[0117] S403, obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed.
[0118] In the embodiment of the present application, the corresponding key is obtained by the authentication key factor and the hash code, and the authentication key factor is decrypted based on the key to obtain the decrypted random number seed. Figure 5 As shown, the corresponding key K is obtained using the 16-byte authentication Key and the 4-byte random number Seed, and the 16-byte authentication Key is decrypted using the key K to obtain the decrypted 4-byte random number Seed'.
[0119] As a possible implementation method, the hash code and the authentication key factor are concatenated to obtain a corresponding concatenated value, and the concatenated value is calculated based on the hash algorithm to obtain a corresponding hash value; the hash value is intercepted to obtain a key, and the authentication key factor is decrypted based on a preset encryption and decryption algorithm and key to obtain a decrypted random number seed. The encryption and decryption algorithm is a pre-set encryption and decryption algorithm. This application takes the AES128 (Advanced Encryption Standard) algorithm as an example for description. For example, Figure 5 As shown, the 32-byte HashCode and the 16-byte key factor are concatenated, and the concatenated value is calculated by SHA256 to generate a 32-byte Hash value. 16 bytes are intercepted as the key K. The key K is used to decrypt the 16-byte authentication key factor Key through the AES128 encryption and decryption algorithm to obtain a 4-byte random number Seed`.
[0120] S404: In response to the decrypted random number seed being consistent with the random number seed, determining to access the service through the secure unified diagnostic service.
[0121] In the embodiment of the present application, the decrypted random number seed is compared with the initially generated random number seed. When the decrypted random number seed is consistent with the initially generated random number seed, it is determined that the ECU has passed the secure access service of the unified diagnostic service, and the corresponding feedback result is sent to the diagnostic device. Figure 5 As shown, the decrypted Seed` is compared with the generated Seed. When the two are consistent, it is determined that the security access is successful, and the result of the successful security access is fed back to the diagnostic device to end the process. If the two are inconsistent, it is determined that the security access has failed, and the result of the failed security access is fed back to the diagnostic device to end the process.
[0122] Therefore, when performing secure access services, the authentication key factor is used as a parameter in the encryption and decryption calculations. Each ECU maintains a fixed and unique authentication key factor. The authentication key factor is written in the MCU's FLASH firmware along with the MCU (Microcontroller Unit) software and cannot be tampered with externally. At the same time, the random number seed generated by the ECU uses the random number generation function srand(), with the system timer as a parameter to ensure that the data is truly random and there is no possibility of pseudo-randomness, making the certificate filling process more secure and reliable.
[0123] Further, in response to receiving the third CANFD message sent by the diagnostic device as a certificate update process request, the corresponding certificate clearing interface is called; based on the certificate clearing interface, the certificate request file stored inside the vehicle system is deleted. Among them, the third CANFD message is the CANFD message sent by the diagnostic device when updating the certificate. It should be noted that the certificate update process is to re-apply for the certificate for the ECU that already has a certificate. This process is applied to the ECU, which has applied for the certificate and needs to clear the old certificate and related information or ensure full coverage and re-apply for the private key corresponding to the certificate in the ECU, or the certificate is lost or damaged, and the ECU needs to clear the old certificate and related information or ensure full coverage and re-apply. The certificate update process uses different RIDs for distinction. When the ECU receives the CANFD message corresponding to the RID, it must first perform the operation of clearing the existing certificate. It only needs to call the certificate clearing interface and clear the certificate storage status. The subsequent process is consistent with the certificate filling process described in the above embodiment. For example, if Figure 6 As shown, after receiving the certificate update process instruction sent by the diagnostic instrument, the system internal certificate deletion interface is called to delete the certificate and execute the certificate application process.
[0124] Therefore, this application aims at the filling process of the security certificate, through the offline electrical inspection process of the vehicle factory, and realizes the sending of the P10 file generated by the public and private keys and the receiving and storage of the certificate based on the unified diagnostic service of CANFD.
[0125] It should be noted that the certificate filling method based on CANFD of the present application, that is, the certificate filling method using the unified diagnostic service based on CANFD, is also a certificate filling method based on the unified diagnostic service based on CANFD.
[0126] Figure 7 Schematic diagram of the structure of the certificate filling device based on CANFD provided in the embodiment of the present application; applied to the electronic control unit ECU; Figure 7 As shown, the CANFD-based certificate filling device 700 of the embodiment of the present application may specifically include:
[0127] The security module 701 is used to call a certificate application interface to obtain a corresponding certificate request file in response to receiving a first CANFD message sent by the electrical inspection device as a certificate application request after passing the security access service of the unified diagnostic service.
[0128] The first judgment module 702 is used to return a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and poll the certificate application interface in a preset first period to determine whether the ECU has completed receiving the certificate request file.
[0129] The sending module 703 is used to fill the data stream of the certificate request file into the first CANFD message, and return the filled first CANFD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU.
[0130] The transmission module 704 is used to call the corresponding certificate writing interface in response to receiving the second CANFD message sent by the electrical inspection device as a certificate writing request, and transmit the security certificate to the vehicle system based on the certificate writing interface.
[0131] Return module 705 is used to return a special negative response code to the electrical inspection device to activate the waiting process of the electrical inspection device, and poll the certificate writing interface in a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, a successful write response is returned to the electrical inspection device.
[0132] In a possible implementation manner, the security module is specifically used to:
[0133] In response to receiving a security access request sent by the diagnostic device, generating a corresponding random number seed, and returning the random number seed to the diagnostic device, so that the diagnostic device calculates the authentication key factor according to the random number seed and then sends the authentication key factor;
[0134] In response to receiving the authentication key factor sent by the diagnostic device, performing calculation based on a random number seed and a preset hash algorithm to obtain a corresponding hash code;
[0135] Obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed;
[0136] In response to the decrypted random number seed being consistent with the random number seed, a secure access service through the unified diagnostic service is determined.
[0137] In a possible implementation manner, the security module is specifically used to:
[0138] Concatenate the hash code and the authentication key factor to obtain a corresponding concatenation value, and calculate the concatenation value based on a hash algorithm to obtain a corresponding hash value;
[0139] The key is obtained by intercepting the hash value, and the authentication key factor is decrypted based on the preset encryption and decryption algorithm and key to obtain the decrypted random number seed.
[0140] In a possible implementation, the CANFD-based certificate filling device further includes:
[0141] The second judgment module is used for returning a special negative response code to the electric inspection device to start a waiting process of the electric inspection device if the ECU fails to complete the reception of the certificate request file;
[0142] The third judgment module is used to return a negative response to the electrical inspection device in response to the first waiting number being greater than a preset first waiting number threshold.
[0143] In a possible implementation manner, the security module is specifically used to:
[0144] A fourth judgment module, configured to respond to receiving a first CANFD message sent by the electrical inspection device and judge whether the routine control identity of the first CANFD message is a certificate application request;
[0145] The determination module is used to determine that if so, the first CANFD message is a certificate file request instruction, and call an interface to obtain a corresponding certificate request file.
[0146] In a possible implementation, the CANFD-based certificate filling further includes:
[0147] A fifth judgment module, used for judging whether the second waiting number is greater than a preset second waiting number threshold value if the vehicle system has not completed the storage of the security certificate;
[0148] The sixth judgment module is used to return a write failure response to the electrical inspection device in response to the second waiting number being greater than the second waiting number threshold.
[0149] In a possible implementation, the CANFD-based certificate filling device further includes:
[0150] A calling module, configured to call a corresponding certificate clearing interface in response to receiving a third CANFD message sent by the diagnostic device as a certificate update process request;
[0151] A deletion module is used to delete the certificate request file stored in the vehicle system based on the certificate clearing interface.
[0152] The CANFD-based certificate filling device provided in the embodiment of the present application, after passing the security access service of the unified diagnostic service, in response to receiving the first CANFD message sent by the electronic inspection device as a certificate application request, calls the certificate application interface for obtaining the corresponding certificate request file, returns a special negative response code to the electronic inspection device to call up the waiting process of the electronic inspection device, and polls the certificate application interface with a preset first cycle to determine whether the ECU has completed the reception of the certificate request file. If so, fill the data stream of the certificate request file into the first CANFD message, and return the filled first CANFD message to the electronic inspection device, so that the electronic inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU. In response to receiving the second CANFD message sent by the electronic inspection device as a certificate write request, the corresponding certificate write interface is called, and the security certificate is transmitted to the vehicle system based on the certificate write interface, and a special negative response code is returned to the electronic inspection device to call up the waiting process of the electronic inspection device, and the certificate write interface is polled with a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, a successful write response is returned to the electronic inspection device. The certificate filling device based on CANFD of this application verifies the secure access of ECU through the secure access service of the unified diagnostic service, and executes the certificate filling process based on the unified diagnostic service of CANFD, which improves the security and reliability of certificate filling, making the certificate file not easily tampered with by the outside, and the data segment length of the CANFD message can reach 64 bytes, increasing the data segment length of the supported message, and can transmit longer files. At the same time, the diagnostic process is maintained through a special negative response code to ensure the normal progress of the diagnostic process.
[0153] like Figure 8 As shown, an electronic device 800 provided in an embodiment of the present application includes: a processor 801, a memory 802 and a bus, wherein the memory 802 stores machine-readable instructions executable by the processor 801. When the electronic device is running, the processor 801 communicates with the memory 802 through the bus, and the processor 801 executes the machine-readable instructions to perform the steps of the certificate filling method based on CANFD as described above.
[0154] Specifically, the above-mentioned memory 802 and processor 801 can be general-purpose memory and processor, which are not specifically limited here. When the processor 801 runs the computer program stored in the memory 802, the above-mentioned certificate filling method based on CANFD can be executed.
[0155] Corresponding to the above-mentioned certificate filling method based on CANFD, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned certificate filling method based on CANFD are executed.
[0156] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the vehicle system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed vehicle system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another vehicle system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0157] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0158] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0159] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the deployment method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0160] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A certificate filling method based on CANFD, applied to an electronic control unit ECU; characterized in that: The certificate filling method includes: After passing the secure access service of the unified diagnostic service, in response to receiving a first CANFD message sent by the electrical inspection device as a certificate application request, calling a certificate application interface to obtain a corresponding certificate request file; Returning a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and polling the certificate application interface at a preset first cycle to determine whether the ECU has completed receiving the certificate request file; If yes, fill the data stream of the certificate request file into the first CAN FD message, and return the filled first CAN FD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU; In response to receiving the second CANFD message sent by the electrical inspection device as a certificate writing request, calling the corresponding certificate writing interface, and transmitting the security certificate to the vehicle system based on the certificate writing interface; A special negative response code is returned to the electrical inspection device to start the waiting process of the electrical inspection device, and the certificate writing interface is polled in a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, a successful write response is returned to the electrical inspection device.
2. The method according to claim 1, characterized in that The secure access service through the unified diagnostic service includes: In response to receiving a security access request sent by a diagnostic device, generating a corresponding random number seed, and returning the random number seed to the diagnostic device, so that the diagnostic device calculates an authentication key factor according to the random number seed and then sends the authentication key factor; In response to receiving the authentication key factor sent by the diagnostic device, performing calculation based on the random number seed and a preset hash algorithm to obtain a corresponding hash code; Obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed; In response to the decrypted random number seed being consistent with the random number seed, a secure access service through the unified diagnostic service is determined.
3. The method according to claim 2, characterized in that The obtaining a corresponding key based on the authentication key factor and the hash code, and decrypting the authentication key factor based on the key to obtain a decrypted random number seed, includes: Concatenating the hash code and the authentication key factor to obtain a corresponding concatenated value, and calculating the concatenated value based on the hash algorithm to obtain a corresponding hash value; The hash value is intercepted to obtain a key, and the authentication key factor is decrypted based on a preset encryption and decryption algorithm and the key to obtain a decrypted random number seed.
4. The method according to claim 1, characterized in that: The method further comprises: If the ECU fails to complete receiving the certificate request file, the ECU returns the special negative response code to the electrical inspection device to start a waiting process of the electrical inspection device; In response to the first waiting number being greater than a preset first waiting number threshold, a negative response is returned to the electrical inspection device.
5. The method according to claim 1, characterized in that: The first CANFD message received from the electrical inspection device is a certificate application request, and the certificate application interface for obtaining the corresponding certificate request file is called, including: In response to receiving a first CANFD message sent by the electrical inspection device, determining whether the routine control identity of the first CANFD message is a certificate application request; If so, it is determined that the first CANFD message is a certificate file request instruction, and an interface for obtaining the corresponding certificate request file is called.
6. The method according to claim 1, characterized in that The method further comprises: If the vehicle system has not completed the storage of the security certificate, determining whether the second waiting number is greater than a preset second waiting number threshold; In response to the second waiting times being greater than the second waiting times threshold, a write failure response is returned to the electrical inspection device.
7. The method according to claim 2, characterized in that The method further comprises: In response to receiving a third CANFD message sent by the diagnostic device as a certificate update process request, calling a corresponding certificate clearing interface; The certificate request file stored in the vehicle system is deleted based on the certificate clearing interface.
8. A certificate filling device based on CANFD, applied to an electronic control unit ECU; characterized in that: The certificate filling device comprises: A security module, configured to, after passing the security access service of the unified diagnostic service, call a certificate application interface to obtain a corresponding certificate request file in response to receiving a first CANFD message sent by the electrical inspection device as a certificate application request; A first judgment module is used to return a special negative response code to the electrical inspection device to call up a waiting process of the electrical inspection device, and poll the certificate application interface at a preset first period to determine whether the ECU has completed receiving the certificate request file; a sending module, configured to fill the data stream of the certificate request file into the first CANFD message, and return the filled first CANFD message to the electrical inspection device, so that the electrical inspection device generates a corresponding security certificate after receiving the certificate request file and sends the security certificate to the ECU; A transmission module, configured to call a corresponding certificate writing interface in response to receiving a second CANFD message sent by the electrical inspection device as a certificate writing request, and transmit the security certificate to the vehicle system based on the certificate writing interface; A return module is used to return a special negative response code to the electrical inspection device to activate the waiting process of the electrical inspection device, and poll the certificate writing interface with a preset second cycle. In response to the vehicle system having completed the storage of the security certificate, a successful write response is returned to the electrical inspection device.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the CANFD-based certificate filling method as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the CANFD-based certificate filling method as described in any one of claims 1 to 7.
