A vehicle key processing method, device and storage medium
By encapsulating the key platform interface functions at the ECU's interface layer, parsing and calling the target key platform interface, the application layer and the key platform are decoupled, solving the problem of low ECU development efficiency and improving development efficiency and the reusability of key functions.
Patent Information
- Application Number
- CN202111592877.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2041-12-23
AI Technical Summary
In the prior art, the key function interface of the vehicle electronic control unit (ECU) depends on the hardware platform, which leads to low development efficiency and the failure of the function interface when the hardware platform changes.
By encapsulating the interface functions of multiple key platforms at the interface layer of the ECU, parsing the key processing requests from the application layer, and using the key platform identifier to call the interface function of the target key platform, the application layer and the key platform are decoupled, reducing the maintenance requirements for the interface functions of different key platforms.
It improves the development efficiency of the ECU application layer, reduces the impact of key platform changes on the application layer, simplifies the key platform switching process, and enhances the reusability of the general interface functions of the key function.
Smart Images

Figure CN116340960B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of vehicle electronic control, and in particular to a vehicle key processing method, device and storage medium. BACKGROUND
[0002] In recent years, with the continuous development of automobile technology, the safety problem of automobile communication has become an urgent problem to be solved in the industry. In the prior art, a key is usually used to enhance the security of communication. However, in the development process of the electronic control unit, the function interface function of the key often depends on the hardware platform provided, and the change of the hardware platform may cause the function interface function to fail, thereby reducing the development efficiency of the electronic control unit. Therefore, a solution is urgently needed. SUMMARY
[0003] The embodiments of the present application provide a vehicle key processing method, device and storage medium to improve the development efficiency of the ECU application layer.
[0004] The embodiments of the present application provide a vehicle key processing method, comprising: obtaining a first key processing request transmitted by an application layer through an interface layer; the interface layer encapsulates a key interface function corresponding to each key platform in an ECU; analyzing the first key processing request to obtain a key function type and a key platform identifier carried by the first key processing request; using a key interface function of a target key platform corresponding to the key platform identifier to send a second key processing request corresponding to the key function type to the target key platform.
[0005] Further optionally, after sending the second key processing request corresponding to the key function type to the target key platform, the method further comprises: obtaining an execution result of the second key processing request or fault data corresponding to the key processing request from the target key platform through the interface layer; and sending the execution result of the key processing request or the fault data corresponding to the key processing request to the application layer for use.
[0006] Further optionally, analyzing the first key processing request comprises: obtaining a formal parameter transmitted by the application layer from the first key processing request through the interface layer; the formal parameter comprises a key function type parameter and a key platform type parameter; and analyzing the key function type parameter and the key platform type parameter respectively to obtain the key function type and the key platform identifier.
[0007] Further optionally, the sending of the second key processing request corresponding to the key function type to the target key platform comprises: determining a target function module from the at least one function module of the interface layer according to the key function type, wherein any function module of the at least one function module encapsulates corresponding key processing logic; and calling the key interface function of the target key platform through the target function module to send the key processing request corresponding to the key function type to the target key platform.
[0008] Further optionally, the key processing request further comprises a key index, and the sending of the key processing request corresponding to the key function type to the target key platform through the target function module comprises: if the key function type is a key import type, calling the key interface function of the target key platform through a key import module according to the key index and a specified key to be imported to send a key import request to the target key platform, so that the target key platform imports the specified key and takes the key index as an index of the specified key; if the key function type is a key export type, calling the key interface function of the target key platform through a key export module according to the key index to send a key export request to the target key platform, so that the target key platform exports a key corresponding to the key index; if the key function type is a key deletion type, calling the key interface function of the target key platform through a key deletion module according to the key index to send a key deletion request to the target key platform, so that the target key platform deletes a key corresponding to the key index; if the key function type is a key generation type, calling the key interface function of the target key platform through a key generation module according to the key index to send a key generation request to the target key platform, so that the target key platform generates a key and takes the key index as an index of the generated key; and if the key function type is a key exchange type, calling the key interface function of the target key platform through a key exchange module according to the key index and key exchange material to send a key exchange request to the target key platform, so that the target key platform generates a new key according to the key exchange material and takes the key index as an index of the new key.
[0009] Further optionally, the first key processing request further comprises a public key index; and the method further comprises: calling, by the target function module, a key interface function of the target key platform, and sending, to the target key platform, a key processing request corresponding to the key function type, including: if the key function type is a key exchange type, calling, by a key exchange module, the key interface function of the target key platform according to the public key index and key exchange material, and sending, to the target key platform, a key exchange request, so that the target key platform generates a new public key according to the key exchange material, and takes the public key index as an index of the new public key.
[0010] Further optionally, the first key processing request further comprises a private key index; and the method further comprises: calling, by the target function module, a key interface function of the target key platform, and sending, to the target key platform, a key processing request corresponding to the key function type, including: if the key function type is a key exchange type, calling, by a key exchange module, the key interface function of the target key platform according to the private key index and key exchange material, and sending, to the target key platform, a key exchange request, so that the target key platform generates a new private key according to the key exchange material, and takes the private key index as an index of the new private key.
[0011] Further optionally, the first key processing request further comprises a key type and a key parameter pointer; and the method further comprises: in the process of parsing the first key processing request, parsing, according to the key type, the key parameter pointer to obtain a storage address of a key parameter; and the key parameter comprises at least one of a public key modulus of an asymmetric encryption algorithm, a public key exponent of an asymmetric encryption algorithm, a private key exponent of an asymmetric encryption algorithm, a public key parameter of an elliptic encryption algorithm, a private key parameter of an elliptic encryption algorithm, and a symmetric key.
[0012] Embodiments of the present application also provide an electronic device, comprising: a memory and a processor; wherein the memory is configured to store one or more computer instructions; and the processor is configured to execute the one or more computer instructions to perform the steps in the processing method of the vehicle key.
[0013] Embodiments of the present application also provide a computer readable storage medium storing a computer program, which causes a processor to implement the steps in the processing method of the vehicle key when the computer program is executed by the processor.
[0014] In the vehicle key processing method, device and storage medium provided by the embodiment of the present application, the interface layer of the ECU encapsulates a key interface function corresponding to each key platform, and then the first key processing request transmitted by the application layer can be acquired through the interface layer, the first key processing request is analyzed to obtain the key function type and the key platform identifier carried by the first key processing request, and the key interface function of the target key platform corresponding to the key platform identifier is used to send the second key processing request corresponding to the key function type to the target key platform. Through this implementation, the key platform is accessed through the interface layer, the decoupling between the application layer and the key platform is realized, and then the application layer does not need to maintain the key interface functions of different key platforms, the influence of the change of the key platform on the application layer is reduced, and the development efficiency of the ECU application layer is improved. BRIEF DESCRIPTION OF DRAWINGS
[0015] The accompanying drawings, which are included to provide a further understanding of the present application and constitute a part of this application, illustrate certain illustrative embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0016] Figure 1 A flowchart of a vehicle key processing method provided by an illustrative embodiment of the present application;
[0017] Figure 2 An application scenario diagram of an ECU key processing method provided by an illustrative embodiment of the present application;
[0018] Figure 3 A structure diagram of an electronic device provided by an illustrative embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described below in conjunction with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0020] In some embodiments of the present application, a vehicle key processing method, device and storage medium are provided.
[0021] In the field of intelligent vehicles, the vehicle key can be applied to the inside of the vehicle and the outside of the vehicle. The application to the inside of the vehicle can include application to a single Electronic Control Unit (ECU) in the vehicle and / or multiple ECUs in the vehicle. When applied to a single ECU, the vehicle key can be applied to a secure start ECU, a flashing ECU (also known as data filling), a protection configuration file, etc. When applied to multiple ECUs (inter-ECU), the vehicle key can be applied to identity authentication between multiple ECUs, secure communication, etc.
[0022] The vehicle key can also be applied to chips and control units outside the vehicle. The application of the vehicle key to the outside of the vehicle can include application to identity authentication of the vehicle, access control, and various communications (including but not limited to wireless communication, wired communication, API (Application Programming Interface) interface access, V2X (vehicle to everything) communication, human-computer interaction, etc.) with external devices (such as other vehicles) and remote services, such as remote control and command, subscription to a fee-based service, etc.
[0023] The following will be exemplarily described by taking application on an ECU as an example.
[0024] In the vehicle key processing method, the interface layer of the ECU encapsulates at least one key interface function corresponding to each key platform, and then the first key processing request transmitted by the application layer can be obtained through the interface layer, the first key processing request is parsed to obtain the key function type and the key platform identifier carried by the first key processing request, and the key interface function of the target key platform corresponding to the key platform identifier is used to send the second key processing request corresponding to the key function type to the target key platform. The technical solutions provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0025] Figure 1 The flowchart of the vehicle key processing method provided by an exemplary embodiment of the present application is shown in Figure 1 The method comprises the following steps.
[0026] Step 11, obtaining a first key processing request transmitted by an application layer through an interface layer; the interface layer encapsulates at least one key interface function corresponding to each key platform in an ECU.
[0027] Step 12, parsing the first key processing request to obtain a key function type and a key platform identifier carried by the first key processing request.
[0028] Step 13, the interface function of the key platform is used to identify the key interface function of the target key platform, and a second key processing request corresponding to the key function type is sent to the target key platform.
[0029] The embodiment can be executed by an Electronic Control Unit (ECU) on a vehicle.
[0030] The ECU on the vehicle is an important component of controlling the vehicle electronic system, which is composed of many ECUs, each responsible for implementing different functions, such as power, doors, and steering, etc. These ECUs are interconnected through different communication networks, such as CAN (Controller Area Network). If the ECU is injected with illegal control information, it will affect the normal operation of the vehicle and the safety of passengers. The current ECU security protection mechanism involves secure boot, secure communication, identity verification, and message authentication, etc. The core is to use keys to ensure the security of the in-vehicle network.
[0031] In the embodiment, the ECU can include an interface layer, an application layer, and a hardware layer. The application layer establishes contact and transmits information with the hardware layer through the interface layer. For the application layer, the interface layer can be implemented as a key function general interface function for multiple key platforms. The key function general interface function is located between the application layer and the hardware layer, can be directly called by the application layer, and can call the key interface functions of the key platforms of the hardware layer to interact with the key platforms of the hardware layer.
[0032] The interface layer encapsulates the key interface functions corresponding to each of the at least one key platform in the ECU. For example, the interface layer encapsulates the key interface function F1 corresponding to the key platform P1, the key interface function F2 corresponding to the key platform P2, and the key interface function F3 corresponding to the key platform P3 in the ECU. The hardware layer can be implemented as a key platform in the application, which can include but is not limited to SE (Security Element), HSM (Hardware Security Module) and HSE (Hardware Security Engine) in the vehicle MCU (Microcontroller Unit), etc. For example, in some scenarios, the application (APP) on the application layer can establish contact and transmit information with the SE on the hardware layer through the interface function on the interface layer.
[0033] In the embodiment, the ECU can obtain the first key processing request transmitted by the application layer through the interface layer. The "first" is used to distinguish the key processing request obtained by the ECU from the application layer from other key processing requests.
[0034] After obtaining the first key processing request, the interface layer can analyze the first key processing request to obtain the key function type and the key platform identifier carried by the first key processing request. The key function type carried by the first key processing request can include at least one of a key import type, a key export type, a key generation type, a key deletion type, and a key exchange type. The key platform identifier is used to identify the platform to which the key is applied. For example, the analysis of the first key processing request obtains that the key function type carried by the first key processing request is the key import type, and the key platform identifier is SE.
[0035] After the key platform identifier is obtained through the above-mentioned step, the key interface function of the target key platform corresponding to the key platform identifier can be used to send a second key processing request corresponding to the key function type obtained by the analysis to the target key platform. The target key platform refers to the key platform corresponding to the key platform identifier. The key interface function is used to establish a connection between the interface layer and the key platform and to transmit information. The "second" is used to limit the key processing request sent to the target key platform. For example, the key interface function of SE (the target key platform) can be used to send a second key processing request corresponding to the key deletion type (the key function type) to SE.
[0036] In the embodiment, the interface layer of the ECU encapsulates at least one key interface function corresponding to each key platform, and then the interface layer can obtain the first key processing request transmitted by the application layer, analyze the first key processing request to obtain the key function type and the key platform identifier carried by the first key processing request, and use the key interface function of the target key platform corresponding to the key platform identifier to send a second key processing request corresponding to the key function type to the target key platform. Through this implementation, the interface layer accesses the key platform, the decoupling between the application layer and the key platform is realized, and then the application layer does not need to maintain the key interface functions of different key platforms, the influence of the change of the key platform on the application layer is reduced, and the development efficiency of the ECU application layer is improved.
[0037] In some optional embodiments, after sending the second key processing request corresponding to the key function type to the target key platform, the execution result of the second key processing request or the fault data corresponding to the key processing request can be obtained from the target key platform through the interface layer, and the execution result of the key processing request or the fault data corresponding to the key processing request can be sent to the application layer for use. The execution result can include a result returned after the second key processing request is successfully executed, for example, after the second key processing request corresponding to the key exchange type is executed, the ECU can obtain the execution result of "exchange success" from the target key platform through the interface layer. After the second key processing request corresponding to the key generation type is executed, the ECU can obtain the generated key from the target key platform through the interface layer. The fault data refers to data returned after the second key processing request fails to execute, which can be implemented as a fault code in an actual scenario. For example, after the second key processing request corresponding to the key import type (key function type) is executed, the ECU can obtain the fault code (fault data) from the target key platform through the interface layer.
[0038] Based on this implementation, the interface layer can automatically return fault information when the key platform executes an error, facilitating fault analysis of key-related functions in vehicle ECU testing, vehicle testing, and after-sales processes.
[0039] In some embodiments, the key function general interface function corresponding to the interface layer can provide interface parameters to the application layer, so that the application layer can send different key processing requests to the interface layer by configuring the interface parameters. The interface parameters configured by the application layer can be passed to the interface layer as formal parameters.
[0040] Optionally, the interface parameters provided by the interface layer can include a key function type parameter and a key platform type parameter, as shown in Table 1 below:
[0041] Table 1
[0042]
[0043] The APP (Application, application program) of the application layer can send a first key processing request to the interface layer according to a set program logic during the running process, and pass the configured formal parameters through the first key processing request. For example, the application layer can specify the key function type in the first key processing request by configuring the value of usage. The application layer can specify the key platform in the first key processing request by configuring the value of type.
[0044] Based on this, in some optional embodiments, the "parsing the first key processing request" described in the foregoing embodiments can be implemented based on the following implementation:
[0045] In an embodiment, the ECU can obtain the form parameters passed by the application layer from the first key processing request through the interface layer. The form parameters include a key function type parameter and a key platform type parameter. The key function type parameter is used to describe the type of key function used by the request, and the key platform type parameter is used to describe the identity of the key platform used by the request. After obtaining the form parameters, the key function type parameter and the key platform type parameter can be parsed respectively to obtain the key function type and the key platform identity. For example, the ECU can parse the key function type parameter obtained to obtain that the key function type used by the request is a key generation type, and parse the key platform type parameter obtained to obtain that the identity of the key platform used by the request is the identity of an SE.
[0046] In another embodiment, the first key processing request can include a key function type and a key platform type. The key function type and the key platform type can be in the form of a string or in the form of a number, and the present embodiment does not limit this. The ECU can directly parse the string or number corresponding to the key function type and the string or number corresponding to the key platform type in the first key processing request, and can parse the key function type and the key platform type.
[0047] In the present embodiment, the transmission of the key platform identity and the key function type can be achieved through the transmission of the form parameters between the interface layer and the application layer. When the key platform changes, the identity of the key platform and the key function type can still be transmitted through this form of parameter transmission, without the need to modify the request method of the application layer.
[0048] In some optional embodiments, the key interface function of the target key platform corresponding to the key platform identity is used to send a second key processing request corresponding to the key function type to the target key platform, which can be achieved based on the following steps:
[0049] According to the key function type obtained by analysis, a target function module is determined from at least one function module of the interface layer. The interface layer is provided with a plurality of function modules. The function modules can include at least one of a key import module, a key export module, a key generation module, a key deletion module, and a key exchange module. Any function module in the at least one function module is encapsulated with corresponding key processing logic. For example, the key import module is encapsulated with processing logic for calling an interface function of each of a plurality of key platforms to perform a key import operation; the key export module is encapsulated with processing logic for calling an interface function of each of a plurality of key platforms to perform a key export operation; the key generation module is encapsulated with processing logic for calling an interface function of each of a plurality of key platforms to perform a key generation operation; the key deletion module is encapsulated with processing logic for calling an interface function of each of a plurality of key platforms to perform a key deletion operation; and the key exchange module is encapsulated with processing logic for calling an interface function of each of a plurality of key platforms to perform a key exchange operation.
[0050] The target function module refers to a function module selected from the at least one function module and corresponding to the key function type obtained by analysis. For example, according to the key generation type (key function type), the key generation module is determined as the target function module from the at least one function module of the interface layer.
[0051] Further, the interface layer can call a key interface function of the target key platform through the target function module to send a key processing request corresponding to the key function type to the target key platform. In the foregoing example, after the target function module is determined as the key generation module, the key interface function of the SE (target key platform) can be called through the key generation module, and a key processing request corresponding to the key generation type (key function type) can be sent to the SE.
[0052] Through this implementation, the function module is still available when the key platform changes, the interface layer can call the corresponding key interface function through the function module to access the key platform, the decoupling between the application layer and the key platform is achieved, the reusability of the key function general interface function is improved, the impact of the change of the key platform on the application layer is reduced, and thus the development efficiency of the ECU application layer is improved.
[0053] In some exemplary embodiments, the general interface function of the interface layer can also provide an index parameter, as shown in Table 2 below:
[0054] Table 2
[0055]
[0056] Wherein, the index is used to represent the storage location of the key in the key platform, and the application layer can establish the index for the key to be processed by configuring the key parameter, or query the key corresponding to the specified index as the key to be processed. The use of the above index parameter will be exemplarily illustrated below in combination with different key functions.
[0057] Further optionally, the first key processing request sent by the application layer further comprises: a key index. The key index can be the value passed by the keyIndex0 (i.e. key 0 index) parameter in the above table.
[0058] Correspondingly, when the target function module calls the key interface function of the target key platform to send the key processing request corresponding to the key function type to the target key platform, if the key function type is the key import type (i.e. the value of useage is key import), the key import module calls the key interface function of the target key platform to send the key import request to the target key platform according to the key index (i.e. the value of keyIndex0) and the specified key to be imported, so that the target key platform imports the specified key and takes the key index as the index of the specified key. For example, the key import module calls the key interface function of SE to send the key import request to SE according to the specified key A1 to be imported and the key index Y1; after receiving the request, SE can import the specified key A1 and take the key index Y1 as the index of the key A1.
[0059] Optionally, if the key function type is the key export type (i.e. the value of useage is key export), the key export module calls the key interface function of the target key platform to send the key export request to the target key platform according to the key index (i.e. the value of keyIndex0), so that the target key platform exports the key corresponding to the key index. For example, the key export module calls the key interface function of SE to send the key export request to SE according to the key index Y2, and after receiving the request, SE can export the key corresponding to the key index Y2.
[0060] Optionally, if the key function type is the key deletion type (i.e. the value of useage is key deletion), the key deletion module calls the key interface function of the target key platform to send the key deletion request to the target key platform according to the key index (i.e. the value of keyIndex0), so that the target key platform deletes the key corresponding to the key index. For example, the key deletion module calls the key interface function of SE to send the key deletion request to SE according to the key index Y3, and after receiving the request, SE can delete the key corresponding to the key index Y3.
[0061] If the key function type is a key generation type (i.e., the value of useage is key generation), the key interface function of the target key platform is called by the key generation module according to the key index (i.e., the value of keyIndex0) to send a key generation request to the target key platform, so that the target key platform generates a key, and the key index is taken as the index of the generated key. For example, the key interface function of the SE is called by the key generation module according to the key index Y4 to send a key generation request to the SE. After receiving the request, the SE can generate a key, and the key index Y4 is taken as the index of the generated key.
[0062] If the key function type is a key exchange type (i.e., the value of useage is key exchange), the key interface function of the target key platform is called by the key exchange module according to the key index (i.e., the value of keyIndex0) and the key exchange material to send a key exchange request to the target key platform, so that the target key platform generates a new key according to the key exchange material, and the key index is taken as the index of the new key. The key platform can generate a new key according to the key exchange material by using a set key exchange algorithm, for example, a DH key exchange algorithm (Diffie-Hellman). The key exchange material refers to the material required by the application layer to send to the key platform for generating a new key. For example, the key interface function of the SE is called by the key exchange module according to the key index Y5 and the key exchange material to send a key exchange request to the SE. After receiving the request, the SE carrying the key A2 can generate a new key A2' according to the key exchange material, and the key index Y5 is taken as the index of A2'.
[0063] In some optional embodiments, the first key processing request further includes a public key index. The public key index can be the value of the keyIndex1 (i.e., key 1 index) parameter in the above table.
[0064] Correspondingly, when the interface layer sends a key processing request corresponding to the key function type to the target key platform by calling the key interface function of the target key platform through the target function module, if the parsed key function type is a key exchange type (i.e., the value of useage is key exchange), the key interface function of the target key platform is called by the key exchange module according to the public key index (i.e., the value of keyIndex1) and the key exchange material to send a key exchange request to the target key platform, so that the target key platform generates a new public key according to the key exchange material, and the public key index is taken as the index of the new public key.
[0065] In some optional embodiments, the first key processing request further includes a private key index. The public key index can be the value of the keyIndex2 (i.e., key 2 index) parameter in the above table.
[0066] Correspondingly, when the interface layer sends a key processing request corresponding to a key function type to the target key platform through the target function module and the key interface function of the target key platform, if the key function type is a key exchange type (i.e., the value of useage is key exchange), the key exchange module calls the key interface function of the target key platform to send a key exchange request to the target key platform according to the private key index (i.e., the value of keyIndex2) and the key exchange material, so that the target key platform generates a new private key according to the key exchange material, and takes the private key index as the index of the new private key. For example, the interface layer can call the key interface function of the SE to send a key exchange request to the SE through the key exchange module according to the private key index S1 and the key exchange material. After receiving the request, the SE can generate a new private key G1' according to the key exchange material, and take the private key index S1 as the index of G1'.
[0067] In some exemplary embodiments, the general interface function of the interface layer can also provide a key type parameter and a key parameter pointer variable for use by the application layer. As shown in the following table:
[0068] Table 3
[0069]
[0070] Based on the above key type parameter and key parameter pointer variable provided by the interface layer, the application layer can configure the key type and the address of the related key parameter in the first key processing request, so that the key platform generates a key of a specified type according to the related key parameter. In some optional embodiments, the first key processing request sent by the application layer to the interface layer can also include a key parameter pointer and a key type.
[0071] Correspondingly, in the process of analyzing the first key processing request, the key parameter pointer can be analyzed according to the key type to obtain the storage address of the key parameter. The key parameter includes at least one of the public key modulus of the asymmetric encryption algorithm, the public key exponent of the asymmetric encryption algorithm, the private key exponent of the asymmetric encryption algorithm, the public key parameter of the elliptic encryption algorithm, the private key parameter of the elliptic encryption algorithm, and the symmetric key.
[0072] The analysis result of the key pointer is different when the key type is different, which will be exemplarily explained below.
[0073] Optionally, when the key parameter pointer is pKey0 in the above table, if the key type is asymmetric key (i.e. type is RSA), the storage address of the RSA public key modulus n can be obtained according to the value of pKey0. When the key type is ECC (i.e. type is ECC), the storage addresses of Qx and Qy in the ECC public key parameters can be obtained according to the value of pKey0. When the key type is symmetric key (i.e. type is SYMMETRIC), the value of pKey0 is null.
[0074] Optionally, when the key parameter pointer is pKey1 in the above table, if the key type is asymmetric key (i.e. type is RSA), the storage address of the RSA public key exponent e can be obtained according to the value of pKey1. When the key type is ECC or symmetric key (i.e. type is ECC or SYMMETRIC), the value of pKey1 is null.
[0075] Optionally, when the key parameter pointer is pKey2 in the above table, if the key type is asymmetric key (i.e. type is RSA), the storage address of the RSA private key exponent d can be obtained according to the value of pKey2. When the key type is ECC (i.e. type is ECC), the storage address of the ECC private key parameter k can be obtained according to the value of pKey2. When the key type is symmetric key (i.e. type is SYMMETRIC), the value of pKey2 points to the storage address of the symmetric key.
[0076] For example, in the process of parsing the first key processing request, if type is RSA, the key parameter pointer pKey1 is parsed to obtain the storage address Z1 of the public key exponent of the asymmetric encryption algorithm.
[0077] The overall architecture of the ECU for executing the vehicle key processing method will be further described below in combination with Figure 2 and actual application scenarios.
[0078] As shown in Figure 2 , the ECU is composed of an application layer, a key function general interface function (i.e. the aforementioned interface layer) and Hardware (i.e. the aforementioned hardware layer). The interface layer contains modules corresponding to multiple key function types, i.e. Figure 2The key derivation module, the key import module, the key generation module, the key exchange module and the key deletion module in the interface layer are used to implement the key functions. The application layer can run multiple APPs. When the APPs use algorithms or make function requests, the APPs can pass parameters to the interface layer. The interface layer can automatically identify the key function (i.e., the key function type) and the information security hardware module (i.e., the key platform identifier) according to the received parameters, and call the corresponding function according to the key function type and the information security hardware module. The function is used to send a key processing request to the hardware layer. The hardware layer can perform the key operation corresponding to the request in response to the request. In this way, the transmission of the key request of the hardware layer and the application layer can be implemented based on the interface layer. Even when the hardware platform changes, the key function universal interface function of the interface layer is still effective, and the key function universal interface function does not need to be redesigned, thereby improving the development efficiency.
[0079] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can also be executed by different devices as the execution subject. For example, the execution subject of steps 11 to 13 can be device A; for example, the execution subject of steps 11 and 12 can be device A, and the execution subject of step 13 can be device B; and the like.
[0080] In addition, in some of the processes described in the above embodiments and the accompanying drawings, a plurality of operations appearing in a specific order are included, but it should be clear that these operations can be executed or executed in parallel without the order in which they appear in this text. The serial numbers of the operations, such as 11, 12, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and the operations can be executed in sequence or in parallel.
[0081] It should be noted that the "first", "second", and the like in this text are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence. "First" and "second" are not of different types.
[0082] Figure 3 is a structural schematic diagram of an electronic device provided by an exemplary embodiment of the present application, as shown in Figure 3 The electronic device includes a memory 301 and a processor 302.
[0083] The memory 301 is used to store computer programs and can be configured to store other various data to support operations on the terminal device. Examples of these data include instructions for operating any application or method on the terminal device, contact data, phonebook data, messages, pictures, videos, etc.
[0084] The memory 301 can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0085] The processor 302 is coupled with the memory 301 and is configured to execute the computer program in the memory 301 to: obtain a first key processing request transmitted by an application layer through an interface layer; the interface layer encapsulates a key interface function corresponding to each key platform in an ECU; parse the first key processing request to obtain a key function type and a key platform identifier carried by the first key processing request; and send a second key processing request corresponding to the key function type to a target key platform by using a key interface function of the target key platform corresponding to the key platform identifier.
[0086] Further optionally, after sending the second key processing request corresponding to the key function type to the target key platform, the processor 302 is further configured to: obtain an execution result of the second key processing request or fault data corresponding to the key processing request from the target key platform through the interface layer; and send the execution result of the key processing request or the fault data corresponding to the key processing request to the application layer for use.
[0087] Further optionally, when parsing the first key processing request, the processor 302 is specifically configured to: obtain a form parameter transmitted by the application layer from the first key processing request through the interface layer; the form parameter includes a key function type parameter and a key platform type parameter; and parse the key function type parameter and the key platform type parameter respectively to obtain the key function type and the key platform identifier.
[0088] Further optionally, when the processor 302 sends the second key processing request corresponding to the key function type to the target key platform by using the key interface function of the target key platform corresponding to the key platform identifier, the processor 302 is specifically configured to: determine a target function module from at least one function module of the interface layer according to the key function type; any function module in the at least one function module encapsulates a corresponding key processing logic; and call the key interface function of the target key platform through the target function module to send the key processing request corresponding to the key function type to the target key platform.
[0089] Further optionally, the key processing request further comprises a key index. When the processor 302 invokes the key interface function of the target key platform through the target function module to send the key processing request corresponding to the key function type to the target key platform, specifically: if the key function type is a key import type, the key import module is used to invoke the key interface function of the target key platform to send a key import request to the target key platform according to the key index and the specified key to be imported, so that the target key platform imports the specified key and takes the key index as the index of the specified key; if the key function type is a key export type, the key export module is used to invoke the key interface function of the target key platform to send a key export request to the target key platform according to the key index, so that the target key platform exports the key corresponding to the key index; if the key function type is a key deletion type, the key deletion module is used to invoke the key interface function of the target key platform to send a key deletion request to the target key platform according to the key index, so that the target key platform deletes the key corresponding to the key index; if the key function type is a key generation type, the key generation module is used to invoke the key interface function of the target key platform to send a key generation request to the target key platform according to the key index, so that the target key platform generates a key and takes the key index as the index of the generated key; if the key function type is a key exchange type, the key exchange module is used to invoke the key interface function of the target key platform to send a key exchange request to the target key platform according to the key index and the key exchange material, so that the target key platform generates a new key according to the key exchange material and takes the key index as the index of the new key.
[0090] Further optionally, the first key processing request further comprises a public key index. When the processor 302 invokes the key interface function of the target key platform through the target function module to send the key processing request corresponding to the key function type to the target key platform, specifically: if the key function type is a key exchange type, the key exchange module is used to invoke the key interface function of the target key platform to send a key exchange request to the target key platform according to the public key index and the key exchange material, so that the target key platform generates a new public key according to the key exchange material and takes the public key index as the index of the new public key.
[0091] Further optionally, the first key processing request further comprises a private key index. When the processor 302 invokes the key interface function of the target key platform through the target function module to send the key processing request corresponding to the key function type to the target key platform, the processor 302 is specifically configured to: if the key function type is a key exchange type, invoke the key interface function of the target key platform through a key exchange module according to the private key index and key exchange material to send a key exchange request to the target key platform, so that the target key platform generates a new private key according to the key exchange material, and takes the private key index as an index of the new private key.
[0092] Further optionally, the first key processing request further comprises a key type and a key parameter pointer. The processor 302 is further configured to: in the process of parsing the first key processing request, parse the key parameter pointer according to the key type to obtain a storage address of a key parameter; the key parameter comprises at least one of a public key modulus of an asymmetric encryption algorithm, a public key exponent of an asymmetric encryption algorithm, a private key exponent of an asymmetric encryption algorithm, a public key parameter of an elliptic encryption algorithm, a private key parameter of an elliptic encryption algorithm, and a symmetric key.
[0093] The display 303 in the above Figure 3 includes a screen, and the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect a duration and a pressure related to the touching or the sliding action.
[0094] Further, as shown in Figure 3 , the electronic device further includes a communication component 304 and a power component 305, and other components. Figure 3 Only some components are shown schematically in the above Figure 3 , and it does not mean that the electronic device only includes the components shown in .
[0095] Figure 3The communication component 304 in the apparatus is configured to facilitate wired or wireless communication between the apparatus and other apparatuses. The apparatus can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G or 5G, or a combination thereof. In an example embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component can implement based on a near-field communication (NFC) technology, a radio frequency identification (RFID) technology, an infrared data association (IrDA) technology, a ultra-wideband (UWB) technology, a Bluetooth (BT) technology and other technologies.
[0096] The power supply component 305 provides power to the various components of the apparatus. The power supply component can include a power supply management system, one or more power sources, and other components associated with generating, managing and distributing power for the apparatus.
[0097] In the embodiment, the interface layer of the ECU encapsulates the key interface function corresponding to each of the at least one key platform, and then the first key processing request transmitted by the application layer can be acquired through the interface layer, the first key processing request is parsed to obtain the function type key function type and the key platform identifier carried by the first key processing request, and the key interface function of the target key platform corresponding to the key platform identifier is used to send the second key processing request corresponding to the function type key function type to the target key platform. Through the implementation, the interface layer accesses the key platform, the decoupling between the application layer and the key platform is realized, the application layer does not need to maintain the key interface functions of different key platforms, the influence of the change of the key platform on the application layer is reduced, and the development efficiency of the ECU application layer is improved.
[0098] Correspondingly, the embodiment of the application further provides a computer readable storage medium storing a computer program, when the computer program is executed by a processor, the processor is caused to implement the steps in the processing method of the vehicle key.
[0099] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0100] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or a combination of flowcharts and / or blocks in the flowcharts. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or a combination of flowcharts and / or blocks in the flowcharts.
[0101] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or a combination of flowcharts and / or blocks in the flowcharts. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or a combination of flowcharts and / or blocks in the flowcharts.
[0102] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or a combination of flowcharts and / or blocks in the flowcharts. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or a combination of flowcharts and / or blocks in the flowcharts.
[0103] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0104] The memory can include non-persistent memory, random access memory (RAM), and / or non-volatile memory, etc. in the form of a computer-readable medium, such as read only memory (ROM) or flash memory. The memory is an example of computer-readable media.
[0105] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0106] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0107] The above description is only an embodiment of the present application and is not intended to limit the present application. Those skilled in the art can make various modifications and changes to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A method for processing vehicle keys, characterized in that, include: The first key processing request is obtained from the application layer through the interface layer; The interface layer encapsulates key interface functions corresponding to at least one key platform in the ECU. The first key processing request is parsed to obtain the key function type and key platform identifier carried in the first key processing request; Using the key interface function of the target key platform corresponding to the key platform identifier, a second key processing request corresponding to the key function type is sent to the target key platform; Specifically, the method involves using the key interface function of the target key platform corresponding to the key platform identifier to send a second key processing request corresponding to the key function type to the target key platform, including: Based on the key function type, a target function module is determined from at least one function module of the interface layer; in the at least one function module, each function module encapsulates corresponding key processing logic; The target functional module calls the key interface function of the target key platform to send a key processing request corresponding to the key function type to the target key platform; the key processing request also includes: a key index; Specifically, the process involves calling the key interface function of the target key platform through the target functional module to send a key processing request corresponding to the key function type to the target key platform, including: If the key function type is key import type, then the key import module calls the key interface function of the target key platform to send a key import request to the target key platform according to the key index and the specified key to be imported, so that the target key platform imports the specified key and uses the key index as the index of the specified key.
2. The method according to claim 1, characterized in that, After sending a second key processing request corresponding to the key function type to the target key platform, the process further includes: The interface layer obtains the execution result of the second key processing request or the fault data corresponding to the key processing request from the target key platform. The execution result of the key processing request or the fault data corresponding to the key processing request is sent to the application layer for use.
3. The method according to claim 1, characterized in that, Parsing the first key processing request includes: The interface layer obtains the formal parameters passed by the application layer from the first key processing request; the formal parameters include: key function type parameters and key platform type parameters. The key function type parameter and the key platform type parameter are parsed to obtain the key function type and the key platform identifier.
4. The method according to claim 1, characterized in that, Through the target functional module, the key interface function of the target key platform is invoked to send a key processing request corresponding to the key function type to the target key platform, including: If the key function type is a key export type, then the key export module calls the key interface function of the target key platform according to the key index to send a key export request to the target key platform, so that the target key platform exports the key corresponding to the key index; If the key function type is key deletion type, then the key deletion module calls the key interface function of the target key platform according to the key index to send a key deletion request to the target key platform so that the target key platform deletes the key corresponding to the key index; If the key function type is key generation type, then the key generation module calls the key interface function of the target key platform according to the key index, sends a key generation request to the target key platform, so that the target key platform generates a key, and uses the key index as the index of the generated key; If the key function type is a key exchange type, then the key exchange module calls the key interface function of the target key platform according to the key index and key exchange materials to send a key exchange request to the target key platform, so that the target key platform generates a new key according to the key exchange materials and uses the key index as the index of the new key.
5. The method according to claim 1, characterized in that, The first key processing request also includes: a public key index; Through the target functional module, the key interface function of the target key platform is invoked to send a key processing request corresponding to the key function type to the target key platform, including: If the key function type is a key exchange type, then the key exchange module calls the key interface function of the target key platform according to the public key index and the key exchange material, and sends a key exchange request to the target key platform, so that the target key platform generates a new public key according to the key exchange material, and uses the public key index as the index of the new public key.
6. The method according to claim 1, characterized in that, The first key processing request also includes: a private key index; Through the target functional module, the key interface function of the target key platform is invoked to send a key processing request corresponding to the key function type to the target key platform, including: If the key function type is a key exchange type, then the key exchange module calls the key interface function of the target key platform according to the private key index and the key exchange material, and sends a key exchange request to the target key platform, so that the target key platform generates a new private key according to the key exchange material, and uses the private key index as the index of the new private key.
7. The method according to claim 1, characterized in that, The first key processing request further includes: a key type and a key parameter pointer; the method further includes: During the parsing of the first key processing request, the key parameter pointer is parsed according to the key type to obtain the storage address of the key parameters.
8. An electronic device, characterized in that, include: Memory and processor; The memory is used to store one or more computer instructions; The processor is configured to execute one or more computer instructions for performing the steps of the method according to any one of claims 1-7.
9. A computer-readable storage medium storing a computer program, characterized in that, When a computer program is executed by a processor, it causes the processor to perform the steps of the method according to any one of claims 1-7.
Citation Information
Patent Citations
Cipher system for calling system private key from user side cipher module
CN106059760A
Digital forensic method based on blockchain privacy protection and fine-grained access control
CN111327597A