Method for preventing illegal calling of security chip
By introducing technologies such as digital signature, PIN code obfuscation and dispersion and dynamic memory verification into the security chip, the problems in the existing technology that security chips are easily called illegally and data are easily modified, realizing the uniqueness and confidentiality of the security chips, ensuring the integrity and operation of authorized applications.
Patent Information
- Application Number
- CN202510638816.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-07-11
AI Technical Summary
The existing security chip technology has problems such as easy to crack PIN code, channel authentication mode is easily called illegally, encrypted transmission key leakage, and encrypted storage data are easily modified, resulting in insufficient security of the Internet of Vehicles network.
The security chip is used to call the monitoring authorization service to generate digital signatures, obfuscate and disperse the PIN code, obtain legal operation handles through dynamic memory verification, and monitor changes in static files to ensure the integrity and authenticity of authorized applications.
It realizes the uniqueness and confidentiality of the security chip, prevents illegal calls, ensures the integrity and operation of authorized applications, and covers the life cycle protection from startup to end.
Smart Images

Figure CN120301606A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information security, and in particular, relates to a method for preventing illegal invocation of a security chip. Background Art
[0002] With the rapid development and wide application of vehicle networking technology, the network security risks of vehicle networking have become increasingly prominent. It faces problems such as complex network security requirements and insufficient pertinence of network security protection means. Vehicle networking network security has become an important factor determining the healthy and sustainable development of the vehicle networking industry.
[0003] The existing security access security chip technology mainly has the following problems:
[0004] (1) The PIN code technology has the risk of using a default weak password. Even if a new one is set, it will result in the same password being used in mass-produced products, which has a risk of being cracked.
[0005] (2) In the channel authentication mode SCP method, although a perfect verification mechanism is provided, generally, the chip manufacturer provides the corresponding library and API for the users to call. Objectively, the users do not understand the underlying verification and authentication mechanism. Illegal access personnel can directly use the ready-made API to operate the chip. In addition, the chips using this mechanism are mainly smart card chips and are only used in specific scenarios.
[0006] (3) The encryption transmission mechanism can ensure the confidentiality of data on the communication link. The implementation mechanism is mainly to specify a key stored in the security chip as the encryption and decryption key. Before transmission, the original text needs to be encrypted first, and then decrypted after reaching the chip, and the original text is processed again. The main risk of this is that the caller needs to obtain the key first for encryption, which has the risk of key leakage. And a symmetric key with a fixed keyId is used. Illegal callers can determine the used keyId through multiple attempts.
[0007] (4) For sensitive data that needs to be stored, through the method of encrypted storage, the confidentiality of the data is ensured. However, illegal callers can completely modify the original data by storing new data at the specified location again, resulting in the failure of subsequent services. Summary of the Invention
[0008] In view of this, the present invention aims to propose a method for preventing illegal invocation of a security chip in order to solve at least one of the above partial technical problems.
[0009] To achieve the above object, the technical solution of the present invention is realized as follows:
[0010] A method for preventing illegal invocation of a security chip includes:
[0011] The secure chip invokes the monitoring authorization service, generates a digital signature for the application program and attaches it to the application program to obtain an authorized application;
[0012] Before the authorized application starts, the monitoring authorization service verifies the digital signature and starts the authorized application that passes the verification;
[0013] During the startup of the authorized application, the monitoring authorization service generates and updates the secure chip PIN code, performs confusion and dispersion processing on the PIN code, and assigns some of the dispersed PIN codes to the authorized application;
[0014] After the authorized application starts, the PIN code is restored and authenticated with the secure chip;
[0015] The authorized application obtains a legal operation handle through dynamic memory verification and uses the legal operation handle to access the secure chip.
[0016] Furthermore, it also includes:
[0017] When the authorized application ends the access to the secure chip, it sends an access end notification to the monitoring authorization service, and the monitoring authorization service releases the corresponding resources and destroys the access data;
[0018] When the authorized application does not access the secure chip, the monitoring authorization service adds the static file of the authorized application to the monitoring list directory, and when the file changes, the monitoring authorization service stops the call service to the secure chip.
[0019] Furthermore, the digital signature is obtained by hashing the code segment of the application program through the SM3 national cryptographic algorithm and then encrypting the hash value with the private key;
[0020] The authorized application is obtained by attaching the digital signature as a separate section to the end of the ELF executable file of the application program;
[0021] The authorized application is calculated using the SM3 hash algorithm, and the calculated hash value is added to the authorized application list.
[0022] Furthermore, the PIN code is obtained by performing the SM3 hash algorithm on the original data, where the original data consists of the device ID, UTC timestamp, and random number.
[0023] Furthermore, the process of the confusion and dispersion processing includes:
[0024] The PIN code is bitwise XORed with the original data to obtain the confused data, the confused data is dispersed into 3 parts, and 2 parts are sent to the authorized application.
[0025] Furthermore, based on the characteristics of the polynomial and the Lagrange interpolation method, the PIN code is dispersed and restored.
[0026] Further, the process of obtaining the legal operation handle includes:
[0027] After the process of the authorized application is loaded into the memory, a timed dynamic memory authentication is performed on the process by monitoring the authorization service to obtain a legal operation handle; wherein, the status of the process includes the CPU occupancy rate, the memory occupancy rate, and whether a child process is created.
[0028] Further, the process of the timed dynamic memory authentication is as follows:
[0029] The process sends an operation handle for interacting with the security chip, and the monitoring authorization service encrypts and signs the operation handle and the handle validity period and encapsulates them into a digital envelope. The process receives the digital envelope and verifies and decrypts the signature.
[0030] The timed dynamic memory authentication is completed by periodically updating the digital envelope.
[0031] Further, if the monitoring authorization service does not receive a handle update request before the end of the handle validity period, it actively closes the handle and sends a timeout end notice to the process.
[0032] Compared with the prior art, the method for preventing illegal invocation of a security chip according to the present invention has the following beneficial effects:
[0033] The PIN code confusion and dispersion technology is adopted to achieve the uniqueness and confidentiality of the device PIN code; the co - authentication method is used to prevent unauthorized applications from invoking the security chip - related interfaces; based on the static file monitoring technology, it is ensured that the startup of the authorized application cannot be illegally modified to ensure integrity; through the dynamic memory verification technology, the authenticity and security of the operation of the authorized application are ensured; it can effectively protect the entire life cycle of the access to the security chip from startup to operation and end. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0035] Figure 1 It is a schematic diagram of the working process of a method for preventing illegal invocation of a security chip according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0036] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0037] In the description of the present invention, it should be understood that the orientation or positional relationship indicated by the terms "center", "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the present invention. In addition, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first", "second", etc. may explicitly or implicitly include one or more of such features. In the description of the present invention, unless otherwise specified, the meaning of "a plurality" is two or more.
[0038] In the description of the present invention, it should be noted that unless otherwise clearly defined and limited, the terms "installed", "connected", "coupled" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood through specific situations.
[0039] The present invention will be described in detail below with reference to the drawings and in conjunction with embodiments.
[0040] As the root of trust and the anchor point of the entire vehicle networking information security trust, the security chip can provide information security guarantee, communication encryption, and identity authentication for the vehicle networking. The security chip mainly achieves the above purposes through built-in cryptographic algorithms and physical anti-attack designs. More and more applications need to be completed based on the capabilities provided by the security chip.
[0041] The security chip here refers to a chip that is externally placed outside the SOC and communicates with the main control SOC through physical interfaces such as SPI, I2C, UART, etc. to complete cryptographic operations and key generation and storage, rather than the HSM (Hardware Security Module) integrated inside the SOC chip. It can only be called passively, and the content of the firmware in the security chip cannot be modified.
[0042] The existing security access security chip technologies are mainly as follows:
[0043] ① The PIN code is a digital password used to verify user identity. It usually consists of 4 to 8 digits or letters. The security chip generally provides the SDK (Software Development Kit) or library in the form for users to directly call the API for business development. Among them, the PIN code has a default PIN code when leaving the factory, which is relatively simple. Some users will directly use the default PIN code for business development testing without modification for the sake of convenience.
[0044] Some users will modify the PIN code, but for mass-produced products, the same new PIN code is used for modification. If the physical link is not encrypted, by capturing the data of the physical link hardware interface (such as SPI, I2C, UART, etc.), the PIN code can be easily cracked.
[0045] ② The channel authentication mode SecureChannelProtocol (SCP) is a protocol used for secure communication between smart cards and card readers in GlobalPlatform technology. The main goal of SCP is to ensure that the data transmitted between the card and the terminal is confidential and can prevent tampering. It establishes a secure session through a series of steps, including initialization, key exchange, authentication process, and subsequent encryption and decryption of command and response messages. This technology is mainly applied in the occasions of SIM cards and bank cards. The main feature of this kind of smart card chip is that it needs multiple application scenarios in one card. It mainly does not provide basic cryptographic algorithms, but is more closely combined with specific applications, such as payment, CCC digital key and other services. It is relatively more expensive than the general security chip that provides ordinary cryptographic algorithms.
[0046] ③ For encrypted transmission, some security chips support it. There are four modes for data exchange between the interface device and the security chip: the data can be plaintext, ciphertext, plaintext plus checksum, and ciphertext plus checksum. In the case of ciphertext transmission, if it is illegally called with the wrong key, the internal decryption of the chip will fail, which plays a certain role in protection to a certain extent. However, in this mode, it is also the key under a certain keyid inside the chip. The illegal caller can find the corresponding encryption transmission keyid by trying multiple times.
[0047] ④ For encrypted storage, the chip generally provides corresponding import files and interfaces for writing custom data. After encrypting the data, it can be stored in the security chip, which also prevents the impact caused by illegal calls to a certain extent, such as reading sensitive data. However, this method involves key management. If the encryption key is fixed, there is also a risk of being cracked.
[0048] In view of the fact that the above methods only solve the related problems to a certain extent in one aspect, in order to solve the problems of the existing technology as a whole, this embodiment proposes a method for preventing illegal calls to the security chip, including:
[0049] S1. The secure chip invokes the monitoring authorization service, generates a digital signature for the application program and attaches it to the application program to obtain an authorized application;
[0050] S2. Before the authorized application starts, the monitoring authorization service verifies the digital signature and starts the authorized application that passes the verification;
[0051] S3. During the startup of the authorized application, the monitoring authorization service generates and updates the secure chip PIN code, performs confusion and dispersion processing on the PIN code, and assigns a part of the dispersed PIN code to the authorized application;
[0052] S4. After the authorized application starts, the PIN code is restored and authenticated with the secure chip;
[0053] S5. The authorized application obtains a legal operation handle through dynamic memory verification and uses the legal operation handle to access the secure chip.
[0054] It further includes:
[0055] When the authorized application ends the access to the secure chip, it sends an access end notice to the monitoring authorization service, and the monitoring authorization service releases the corresponding resources and destroys the access data;
[0056] When the authorized application does not access the secure chip, the monitoring authorization service adds the static file of the authorized application to the monitoring list directory, and when the file changes, the monitoring authorization service stops the call service to the secure chip.
[0057] The digital signature is obtained by hashing the code segment of the application program through the SM3 national cryptography algorithm and then encrypting the hash value with the private key;
[0058] The authorized application is obtained by attaching the digital signature as a separate section to the end of the ELF executable file of the application program;
[0059] The authorized application is calculated using the SM3 hash algorithm, and the calculated hash value is added to the authorized application list.
[0060] The PIN code is obtained by performing the SM3 hash algorithm on the original data, where the original data consists of: device ID (32 bytes) + UTC timestamp (4 bytes) + random number (16 bytes).
[0061] The process of the confusion and dispersion processing includes:
[0062] The PIN code is exclusive-ORed with the original data bit by bit to obtain the confused data, the confused data is dispersed into 3 parts, and 2 parts are sent to the authorized application.
[0063] Disperse and recover the PIN code based on the characteristics of polynomials and Lagrange interpolation method.
[0064] Characteristics of polynomials:
[0065] For a polynomial of degree k - 1: f(x) = a0 + a1x + a2x 2 +... + a k-1 x k-1 ;
[0066] If all coefficients {a i | 0 ≤ i ≤ k - 1} are known, the function values (x, f(x)) at any point can be calculated; on the other hand, as long as k points on the polynomial are known, all coefficients can be calculated, and the values at any other point can also be calculated (k points uniquely determine a curve of degree k - 1, and substituting into the system of simultaneous equations and using Gaussian elimination method can obtain the result).
[0067] Lagrange interpolation method:
[0068] To calculate the value of f(x) at other points, it is not necessary to first find all coefficients. Lagrange interpolation can be directly used to find any f(x); assume that k different points {(x i , y i )) | 1 ≤ i ≤ k} on f(x) are known, then:
[0069]
[0070] where li(x) is called the Lagrange interpolation basis function.
[0071] The process of obtaining the legal operation handle includes:
[0072] After the process of the authorized application is loaded into memory, perform timed dynamic memory authentication on the process through the monitoring authorization service to obtain the legal operation handle; among them, the state of the process includes CPU occupancy rate, memory occupancy rate, and whether a child process is created.
[0073] The process of the timed dynamic memory authentication is as follows:
[0074] The process sends an operation handle for interaction with the security chip. The monitoring authorization service encrypts and signs the operation handle and the handle validity period and encapsulates them into a digital envelope. The process receives the digital envelope and verifies and decrypts the signature.
[0075] Complete the timed dynamic memory authentication by periodically updating the digital envelope.
[0076] If the monitoring authorization service does not receive an update request for the handle before the expiration of the handle validity period, it will actively close the handle and send a timeout end notice to the process.
[0077] In some embodiments, for an authorized application to enter the subsequent encryption and decryption operation business process, it is necessary to obtain a legal operation handle through dynamic memory verification technology according to the following steps:
[0078] To prevent a legitimate authorization process from being injected with malicious processes during operation, which may lead to illegal access to the security chip. After the authorization program process (authorization process) is loaded into memory, the authorization service needs to be monitored. It is necessary to monitor the status of the authorization process, check the CPU occupancy rate, memory occupancy rate, and whether child processes are created. The authorization process needs to complete dynamic memory authentication with the monitoring authorization authentication process at regular intervals. The authorization process first sends a request for the operation handle for communication and interaction with the security chip. The monitoring authorization authentication process encrypts and signs the operation handle and the key data of the handle validity period, encapsulates them into a digital envelope structure, and then sends the result to the authorization process. The authorization process verifies the signature and decrypts it, and updates this envelope value at regular intervals to complete the authentication and ensure that the security chip will not be illegally accessed.
[0079] When the monitoring authorization service does not receive a request from the authorized application to update the handle at the end of the handle validity period, it actively closes the handle and sends a timeout end notification to the authorization process. With a legal handle, the authorized application can perform encryption and decryption operations.
[0080] When the authorized application has no task of encrypting and decrypting with the security chip, the monitoring authorization service adds the static file of the authorized application to the monitoring list directory. In this way, it notifies the operating system kernel that if the file changes, it will notify the monitoring authorization authentication service program. The monitoring authorization authentication service program receives the notification and then stops the subsequent call service to the security chip. By monitoring the changes of this static file, it is ensured that the security chip will not be illegally called.
[0081] As Figure 1 shown, in some embodiments, the specific execution process and its execution examples of the above method for preventing illegal calls to the security chip are as follows:
[0082] Step 1: Sign the permitted application to generate a new authorization file, perform the SM3 hash algorithm on the authorization file, and add the relevant hash value to the authorized application list.
[0083] The structure of each sub-item in this list is as shown in the following table:
[0084]
[0085] Ensure the authenticity and integrity of the signature value code segment to prevent it from being modified.
[0086] The authorization file hash value ensures the integrity of the authorization file and provides an authentication basis for static monitoring in Step 10.
[0087] For the permitted applications, taking the ELF file as an example, a.sign signature field is added with the attribute of NOTE.
[0088] Step 2: The startup of the authorized application is verified by the monitoring authorization authentication service program through reading the signed section to ensure the integrity and authenticity of the authorized application. The monitoring authorization authentication service program controls the power-on pin of the security chip to make the security chip enter the normal working mode from the non-operable state of hardware reset.
[0089] Step 3: After completing the above work, the monitoring authorization service program starts the authorized application.
[0090] Step 4: Generate a PIN code and perform the SM3 hashing algorithm on the original data, where the original data consists of: device ID (32 bytes) + UTC timestamp (4 bytes) + random number (16 bytes). The monitoring authorization authentication service program updates the PIN code of the security chip.
[0091] Step 5: Confuse and disperse the PIN code.
[0092] (1) Confuse the PIN code. The PIN code is exclusive-ORed with the original data bit by bit to obtain the confused PIN code.
[0093] (2) Disperse the PIN code, which is dispersed into 3 parts here.
[0094] Step 6: After the authorized application starts, it first obtains the confused and dispersed PIN code of the security chip from the monitoring authorization authentication service program for recovery, and then uses the correct PIN code to complete the authentication with the security chip.
[0095] Key recovery:
[0096] Substitute t groups of (xi, yi) into the following formula;
[0097]
[0098] Among them, the negative first power is the inverse of this term modulo p.
[0099] Substitute t groups of (xi, yi) to obtain S;
[0100] Arbitrarily select two of the above and send them to the authorized application to recover the original confused PIN code, and then perform an exclusive-OR operation with the original data to recover the actual PIN code.
[0101] Step 7: For the authorized application to enter the subsequent encryption and decryption operation business process, it needs to obtain a legal operation handle through the dynamic memory verification technology according to the following steps.
[0102] To prevent a legally authorized process from being injected with malicious processes during operation, resulting in illegal access to the security chip, after the authorized process is loaded into memory, the monitoring authorization authentication program needs to monitor the status of the authorized process, check the CPU occupancy rate, memory occupancy rate, and whether child processes are created. The authorized process needs to complete dynamic memory authentication with the monitoring authorization authentication process at regular intervals. The authorized process first sends a request for an operation handle for communication and interaction with the security chip. The monitoring authorization authentication process uses the authorized public key to encrypt and sign the operation handle and the validity period of the handle, these key data, and encapsulates them into a digital envelope structure. At the same time, the result is sent to the authorized process. The authorization process verifies the signature and decrypts it, and updates this envelope value regularly to complete the authentication and ensure that the security chip cannot be illegally accessed.
[0103] When the monitoring authorization authentication program does not receive a request from the authorized application to update the handle at the end of the handle validity period, it actively closes the handle and sends a timeout end notice to the authorized process.
[0104] With a legal handle, the authorized application can perform encryption and decryption operations.
[0105] Among them, the legal handle is the key to subsequent communication with the security chip; the key lies in this handle. The handle validity period indicates how long it takes to apply for a new handle.
[0106] Step 8: The authorized application uses the legal operation handle to perform encryption and decryption operations with the security chip.
[0107] Step 9: When the authorized application ends the normal access to the security chip, it sends a normal end notice to the authorization monitoring program. The authorization monitoring process releases relevant resources and destroys relevant previous data.
[0108] Step 10: When the authorized application has no task of performing encryption and decryption with the security chip, the monitoring authorization authentication program adds the static file of the authorized application to the monitoring list directory. In this way, it notifies the operating system kernel that if the file changes, it will notify the monitoring authorization authentication service program. The monitoring authorization authentication service program receives the notice and then stops the subsequent call service to the security chip. By monitoring the changes of this static file, it safeguards against illegal calls to the security chip.
[0109] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the present practical embodiments, and they should all be covered by the scope of the claims and the description of the present invention.
[0110] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for preventing illegal invocation of a security chip, characterized in that Including: The secure chip invokes the monitoring authorization service to generate a digital signature for the application program and append it to the application program to obtain an authorized application; Before the authorized application starts, the monitoring authorization service verifies the digital signature and starts the authorized application that passes the verification; During the startup of the authorized application, the monitoring authorization service generates and updates the secure chip PIN code, performs confusion and dispersion processing on the PIN code, and assigns some of the dispersed PIN codes to the authorized application; After the authorized application starts, the PIN code is restored and authenticated with the secure chip; The authorized application obtains a legal operation handle through dynamic memory verification and uses the legal operation handle to access the secure chip.
2. The method for preventing illegal invocation of a security chip according to claim 1, characterized in that It also includes: When the authorized application ends the access to the secure chip, it sends an access end notification to the monitoring authorization service, and the monitoring authorization service releases the corresponding resources and destroys the access data; When the authorized application does not access the secure chip, the monitoring authorization service adds the static files of the authorized application to the monitoring list directory, and when the files change, the monitoring authorization service stops the call service to the secure chip.
3. A method for preventing illegal invocation of a security chip according to claim 1, characterized in that, The digital signature is obtained by hashing the code segment of the application program using the SM3 national cryptographic algorithm and then encrypting the hash value using the private key; The authorized application is obtained by appending the digital signature as a separate section to the end of the ELF executable file of the application program; The authorized application is calculated using the SM3 hash algorithm, and the calculated hash value is added to the authorized application list.
4. A method for preventing illegal invocation of a security chip according to claim 1, characterized in that, The PIN code is obtained by performing the SM3 hash algorithm on the original data, where the original data consists of the device ID, UTC timestamp, and random number.
5. A method for preventing illegal invocation of a security chip according to claim 4, characterized in that, The process of the confusion and dispersion processing includes: The PIN code is bitwise XORed with the original data to obtain the confused data, the confused data is dispersed into 3 parts, and 2 parts are sent to the authorized application.
6. A method for preventing illegal invocation of a security chip according to claim 1, characterized in that, Based on the characteristics of polynomials and Lagrange interpolation method, the PIN code is dispersed and restored.
7. A method for preventing illegal invocation of a security chip according to claim 1, characterized in that, The process of obtaining the legal operation handle includes: After the process of the authorized application is loaded into memory, it performs timed dynamic memory authentication with the process through the monitoring authorization service to obtain a legal operation handle; among them, the state of the process includes CPU occupancy, memory occupancy, and whether a child process is created.
8. A method for preventing illegal invocation of a security chip according to claim 7, characterized in that, The process of the timed dynamic memory authentication is as follows: The process sends an operation handle for interacting with the secure chip, and the monitoring authorization service encrypts and signs the operation handle and the handle validity period and encapsulates them into a digital envelope. The process receives the digital envelope and verifies and decrypts the signature; The timed dynamic memory authentication is completed by updating the digital envelope at regular intervals.
9. A method for preventing illegal invocation of a security chip according to claim 8, characterized in that, If the monitoring authorization service does not receive a handle update request before the end of the handle validity period, it actively closes the handle and sends a timeout end notification to the process.