Model loading and reasoning method and device based on encryption card, equipment and medium

By introducing an encrypted card as a root of trust into the AI ​​inference appliance, the problems of model churn, untrusted environment, and performance bottlenecks are solved, realizing hardware binding and remote verification of the model, ensuring a balance between security and performance.

CN122027280APending Publication Date: 2026-05-12CCORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CCORE TECH CO LTD
Filing Date
2026-02-11
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing AI inference all-in-one machines suffer from problems such as easy loss of model assets, unreliable operating environment, lack of hardware-level verification in heterogeneous environments, and performance bottlenecks.

Method used

An encryption card is introduced as an independent root of trust. The public and private keys in the encryption card are used to verify the integrity of the model ciphertext and the sealed ticket, ensuring that the model encryption key is bound to the environmental metric. The model can only be decrypted and loaded in a trusted environment and then inference can be performed in the accelerator.

Benefits of technology

It implements hardware binding and secure loading of the model to prevent model theft, supports remote verification of system environment and model state, meets the audit requirements of high security level, and ensures low-latency inference performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122027280A_ABST
    Figure CN122027280A_ABST
Patent Text Reader

Abstract

The invention discloses a model loading and reasoning method and device based on an encryption card, equipment and a medium, and relates to the technical field of computer security and artificial intelligence, and the method comprises the steps: carrying out the integrity verification of a model ciphertext and a seal bill through a public key and a signature value in the encryption card when a model loading request is received; if the integrity verification is passed, unsealing the sealed bill, and matching a target environment measurement value in the sealed bill with a current target environment measurement value of the system; if the matching is successful, using a private key to unseal the printed bill to obtain a model encryption key; decrypting the model ciphertext by using the model encryption key to obtain a target model; and loading the target model to a memory area of the accelerator and executing reasoning in the memory area. The method can solve the problems that the AI reasoning all-in-one machine is stolen in model, untrusted in operation environment, lack of heterogeneous environment hardware-level verification and performance bottleneck in edge computing and privatized deployment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer security and artificial intelligence technology, and in particular to a method, apparatus, device and medium for model loading and inference based on an encryption card. Background Technology

[0002] With the popularization of artificial intelligence (AI) technology, AI inference engines are widely used in finance, security, and healthcare. However, existing AI inference engines suffer from the following technical shortcomings: 1. Easily lost model assets: Once the system is started and mounted, existing disk encryption technologies make model files visible to the operating system, making them easy for internal personnel or hackers to copy and steal. 2. Untrusted operating environment: If malicious code (such as rootkits) is injected into the operating system or drivers, it may tamper with the inference logic or steal input data, and traditional application-layer security software struggles to detect kernel-level attacks. 3. Security blind spots in heterogeneous computing: Existing trusted computing technologies (such as TPM) mainly focus on CPU-side metrics, making it difficult to effectively cover the model loading status and memory data security on accelerator cards such as GPUs / NPUs. 4. Performance bottlenecks: Relying entirely on the CPU for high-intensity encrypted inference or homomorphic encryption operations leads to a significant increase in inference latency, failing to meet real-time requirements.

[0003] Therefore, how to solve the above-mentioned technical defects has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] The purpose of this application is to provide a model loading and inference method, apparatus, device and medium based on an encryption card, which can solve the problems faced by AI inference all-in-one machines in edge computing and private deployment, such as model theft, untrusted operating environment, lack of hardware-level verification in heterogeneous environments and performance bottlenecks.

[0005] To address the aforementioned technical problems, this application provides a model loading and inference method based on an encryption card, comprising:

[0006] Upon receiving a model loading request, the integrity of the model ciphertext and the sealed ticket is verified using the public key and signature value within the encryption card. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key within the encryption card. The model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card. The sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key within the encryption card.

[0007] If the integrity verification passes, the sealed ticket is unsealed, and the target environmental metric value in the sealed ticket is matched with the current target environmental metric value of the system.

[0008] If a match is found, the sealed ticket is decrypted using the private key to obtain the model encryption key;

[0009] The model ciphertext is decrypted using the model encryption key to obtain the target model;

[0010] The target model is loaded into the accelerator's memory region and inference is performed in the memory region.

[0011] In some embodiments, it also includes:

[0012] The encryption card is invoked to generate a model encryption key, and the target model is encrypted using the encryption key to obtain the model ciphertext;

[0013] Extract the target environment metric value at the initial startup of the system, and use the public key in the encryption card to seal the model encryption key and the target environment metric value to obtain the sealed ticket;

[0014] The model ciphertext and the sealed ticket are signed using the private key in the encryption card to obtain the signature value;

[0015] The encrypted model, the sealed ticket, and the signature value are stored in a local encrypted storage device.

[0016] In some embodiments, it also includes:

[0017] Receive random numbers sent by remote devices;

[0018] Obtain the platform configuration register value and the hash value of the currently loaded model;

[0019] The random number, the platform configuration register value, and the hash value of the currently loaded model are digitally signed using the private key to obtain a proof report;

[0020] The proof report is sent to the remote device so that the remote device can verify the proof report using the public key, the expected platform configuration register value, and the expected hash value.

[0021] In some embodiments, it also includes:

[0022] Perform trusted environment measurements during system startup and application loading;

[0023] The trusted environment measurement results are stored in the platform configuration register of the encryption card.

[0024] In some embodiments, the private key is stored in a secure storage area physically isolated from the encryption card, and the private key does not leave the card.

[0025] In some embodiments, it also includes:

[0026] During the model inference process, the encryption card is used to encrypt or sign the inference data stream.

[0027] In some embodiments, the target environment metric includes a baseline hash value in the platform configuration register and an encryption card fingerprint; the encryption card fingerprint is a unique identifier for the encryption card.

[0028] To address the aforementioned technical problems, embodiments of this application also provide a model loading and inference device based on an encryption card, comprising:

[0029] The verification module is used to verify the integrity of the model ciphertext and the sealed ticket using the public key and signature value in the encryption card when a model loading request is received. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key in the encryption card. The model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card. The sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key in the encryption card.

[0030] The unsealing module is used to unseal the sealed ticket if the integrity verification passes, and match the target environmental metric value in the sealed ticket with the current target environmental metric value of the system.

[0031] The first decryption module is used to decrypt the sealed ticket using the private key if a match is successful, to obtain the model encryption key.

[0032] The second decryption module is used to decrypt the model ciphertext using the model encryption key to obtain the target model;

[0033] A loading module is used to load the target model into the memory region of the accelerator and perform inference in the memory region.

[0034] To address the aforementioned technical problems, embodiments of this application also provide an electronic device, comprising:

[0035] Memory, used to store computer programs;

[0036] A processor is used to implement the steps of the encryption card-based model loading and inference method described above when executing the computer program.

[0037] To address the aforementioned technical problems, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the model loading and inference method based on an encryption card as described above.

[0038] The model loading and inference method based on an encryption card provided in this application includes: upon receiving a model loading request, performing integrity verification on the model ciphertext and the sealed ticket using the public key and signature value within the encryption card; obtaining the signature value by signing the model ciphertext and the sealed ticket using the private key within the encryption card; encrypting the target model using the encryption key generated by the encryption card; sealing the model encryption key and the target environment metric value using the public key within the encryption card; if the integrity verification passes, unsealing the sealed ticket and matching the target environment metric value in the sealed ticket with the current target environment metric value of the system; if the match is successful, decrypting the sealed ticket using the private key to obtain the model encryption key; decrypting the model ciphertext using the model encryption key to obtain the target model; loading the target model into the memory region of the accelerator and performing inference in the memory region.

[0039] As can be seen, the model loading and inference method based on an encryption card provided in this application introduces an encryption card as an independent root of trust, binding the model encryption key to an environmental metric. When the target environmental metric in the sealed ticket matches the current target environmental metric of the system, the model ciphertext is decrypted and the model is securely loaded into the accelerator. This method enforces hardware protection that the model can only be decrypted in a trusted environment, achieving one-machine-one-key hardware binding. Even if the model is copied to other devices, it cannot be decrypted and run. Furthermore, this method supports remote verification of the system environment and model state, meeting the requirements of high-security auditing.

[0040] The model loading and inference device, equipment, and computer-readable storage medium based on the encryption card provided in this application all have the aforementioned technical effects. Attached Figure Description

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

[0042] Figure 1 A schematic flowchart illustrating a model loading and inference method based on an encryption card, provided in an embodiment of this application;

[0043] Figure 2 A schematic diagram of an overall system hardware architecture provided in an embodiment of this application;

[0044] Figure 3This is a schematic diagram illustrating the process of establishing and loading a trusted execution environment, as provided in an embodiment of this application.

[0045] Figure 4 This is a schematic diagram illustrating a model sealing and hardware binding process provided in an embodiment of this application;

[0046] Figure 5 This is a schematic diagram of the remote verification process provided in the embodiments of this application;

[0047] Figure 6 A schematic diagram of a model loading and inference device based on an encryption card provided in an embodiment of this application;

[0048] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0049] The purpose of this application is to provide a model loading and inference method, apparatus, device and storage medium based on an encryption card, which can solve the problems faced by AI inference all-in-one machines in edge computing and private deployment, such as model theft, untrusted operating environment, lack of hardware-level verification in heterogeneous environments and performance bottlenecks.

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

[0051] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a model loading and inference method based on an encryption card, provided in an embodiment of this application. (Refer to...) Figure 1 As shown, the method includes:

[0052] S101: Upon receiving a model loading request, the integrity of the model ciphertext and the sealed ticket is verified using the public key and signature value within the encryption card; the signature value is obtained by signing the model ciphertext and the sealed ticket using the private key within the encryption card; the model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card; the sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key within the encryption card.

[0053] S102: If the integrity verification passes, the sealed ticket is unsealed, and the target environmental metric value in the sealed ticket is matched with the current target environmental metric value of the system.

[0054] S103: If the match is successful, the sealed ticket is decrypted using the private key to obtain the model encryption key;

[0055] S104: Decrypt the model ciphertext using the model encryption key to obtain the target model;

[0056] S105: Load the target model into the memory region of the accelerator and perform inference in the memory region.

[0057] The model loading and inference method based on an encryption card provided in this application is implemented by an AI inference all-in-one machine. The overall hardware architecture of the AI ​​inference all-in-one machine is as follows: Figure 2 As shown, it mainly includes a CPU, a general-purpose processor (CPU), an AI accelerator (GPU / NPU), storage devices, and a PCIe encryption card. The encryption card integrates a security chip (SE) and features a true random number generator (TRNG), an asymmetric algorithm hardware acceleration engine (RSA / ECC / SM2), a hash algorithm engine (SHA256 / SM3), and a physically isolated secure storage area. During the production phase, the internal true random number generator (TRNG) of the encryption card generates a seed, which is then iteratively generated using the hash algorithm and bound to an asymmetric master key pair. Among them, the private key Stored in a secure storage area physically isolated from the encrypted card, it never leaves the card. The encrypted card offloads complex symmetric, asymmetric, and hash operations, minimizing the impact of security mechanisms on AI business performance.

[0058] This inference method introduces an encryption card as the hardware trust anchor of the system. By leveraging the physically isolated key storage capabilities and hardware acceleration capabilities of the encryption card, the AI ​​model is bound to specific hardware, and a heterogeneous trusted execution environment including CPUs and AI accelerators is constructed.

[0059] Steps S101 to S105 are designed to ensure that the model is decrypted and loaded only if the system environment has not been tampered with.

[0060] When the AI ​​inference all-in-one machine receives a model loading request, it uses the public key in the encryption card and the signature value to verify the integrity of the model ciphertext and the sealed ticket. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key in the encryption card; the model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card; the sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key in the encryption card.

[0061] If the integrity verification fails, the process exits. If the integrity verification succeeds, the sealed ticket is unsealed, and the target environment metric in the sealed ticket is matched with the current target environment metric of the system.

[0062] If the match fails, the process exits. If the match succeeds, the private key is used to deseal the sealed ticket to obtain the model encryption key; the model encryption key is used to decrypt the model ciphertext to obtain the target model; the target model is loaded into the accelerator's memory region and model inference is performed in the memory region.

[0063] The models can be large language models, computer vision models, etc. Large language models can be used for general dialogue, content creation, code generation, and complex reasoning. Computer vision models can be used for image classification, object detection, etc.

[0064] In some embodiments, the target environment metric includes a base hash value in the platform configuration register and an encryption card fingerprint; the encryption card fingerprint is a unique identifier for the encryption card. For example, the encryption card fingerprint can be a hash value of the encryption card's serial number.

[0065] In some embodiments, the method further includes: encrypting or signing the inference data stream using the encryption card during model inference.

[0066] In some embodiments, it also includes:

[0067] Perform trusted environment measurements during system startup and application loading;

[0068] The trusted environment measurement results are stored in the platform configuration register of the encryption card.

[0069] refer to Figure 3 The diagram shows the process of establishing and loading a trusted execution environment. This process mainly includes trusted environment measurement, model unpacking and loading, and secure inference.

[0070] Trusted Environment Measurement: During system startup and application loading, hash calculations can be performed sequentially on the bootloader, operating system kernel, encryption card driver, and AI inference runtime environment, and the hash calculation results, i.e. measurement results, are stored in the platform configuration register of the encryption card.

[0071] Model unpacking and loading: When an AI model loading request is received, the encryption card first utilizes... The integrity of the model ciphertext E(M) and the sealed ticket is verified using the signature value S. After successful integrity verification, the sealed ticket is unsealed, verifying whether the preset expected environmental metric value in the sealed ticket matches the current environmental metric value. If they match, the device's unique private key is used. The sealed ticket is decrypted to obtain the model decryption key K. The encrypted card then uses K to decrypt the AI ​​model and loads it directly into the memory area of ​​the AI ​​accelerator via P2P technology.

[0072] Secure Inference: Perform AI model inference in a protected memory area and use the hardware algorithm engine of the encryption card to encrypt or sign the inference data stream.

[0073] Figure 3 IV represents the initial vector.

[0074] In some embodiments, it also includes:

[0075] The encryption card is invoked to generate a model encryption key, and the target model is encrypted using the encryption key to obtain the model ciphertext;

[0076] Extract the target environment metric value at the initial startup of the system, and use the public key in the encryption card to seal the model encryption key and the target environment metric value to obtain a sealed ticket;

[0077] The model ciphertext and the sealed ticket are signed using the private key in the encryption card to obtain a signature value;

[0078] The encrypted model, the sealed ticket, and the signature value are stored in a local encrypted storage device.

[0079] This embodiment aims to hardware seal the model to ensure its integrity and that it can only run on a designated AI inference device, preventing the model from being copied and taken away.

[0080] refer to Figure 4 The diagram shown illustrates the process of model sealing and hardware binding. This process mainly includes model acquisition, model sealing preparation, generating sealing tickets, signing, and storage.

[0081] Model Acquisition: Acquire the AI ​​model to be deployed, i.e., the target model M, and verify the completeness and effectiveness of the model.

[0082] Model sealing preparation: Call the encryption card to generate the model encryption key K and encrypt the target model M to generate the model ciphertext E(M).

[0083] Generate sealed ticket: Extract the base hash value H (PCRs_init) and the encryption card fingerprint (HW_FP) from the platform configuration registers (PCRs) during system initial startup, and use the public key within the encryption card. The model encryption key K, the extracted platform configuration register base hash value, and the encryption card fingerprint are sealed to form a sealed ticket.

[0084] Signature: Using the private key within the encryption card Sign the model ciphertext E(M) and the sealed ticket to obtain the signature value S.

[0085] Storage: Store the model ciphertext E (M), the sealed ticket, and the signature value S on a local encrypted storage device.

[0086] In some embodiments, it also includes:

[0087] Receive random numbers sent by remote devices;

[0088] Obtain the platform configuration register value and the hash value of the currently loaded model;

[0089] The random number, the platform configuration register value, and the hash value of the currently loaded model are digitally signed using the private key to obtain a proof report;

[0090] The proof report is sent to the remote device so that the remote device can verify the proof report using the public key, the expected platform configuration register value, and the expected hash value.

[0091] This embodiment aims to enable remote proof, allowing remote users / administrators to verify that the current inference is running a "real model" on a "real machine".

[0092] refer to Figure 5 The diagram shown illustrates the remote verification process, which mainly includes initiating a challenge, generating a report, hardware signing, and verification.

[0093] Initiate a challenge: A remote computer sends a random number (Nonce) to the all-in-one machine.

[0094] Report generation: The all-in-one machine collects current information, including:

[0095] Nonce (prevents replay attacks);

[0096] Current PCR values ​​(proving the operating system environment is secure);

[0097] Hash value of the currently loaded model (This proves that the correct model is being run).

[0098] Hardware signing: The above information is sent to the encryption card. The encryption card uses a non-exportable private key. Digitally sign the data packet and generate a proof report (Quote).

[0099] Verification: After receiving the report, the verifier uses the device's public key. And the expected safety status (PCR values ​​and H(M)). Verification of signature. Successful verification proves that the result indeed comes from the trusted device, and that the current system operation status and operation model are secure, reliable, and have not been tampered with.

[0100] This application embodiment utilizes an encryption card to construct a hardware root of trust, generating a non-exportable device-bound master key pair. It strongly binds the model decryption key to the encryption card hardware fingerprint and system environment metrics through model hardware sealing technology. Based on a trusted bootstrap chain metric system, the model is decrypted and securely loaded onto the accelerator after successful verification. A remote proof mechanism using random numbers to prevent replay is employed to generate a hardware signature report containing system environment and model hashes for remote verification. This application embodiment sinks the root of trust to the hardware layer, achieving full-process security coverage for heterogeneous computing environments of CPU and GPU / NPU, possessing anti-cloning and anti-piracy characteristics. Furthermore, it ensures low inference latency by offloading encrypted operations through hardware, making it suitable for AI inference scenarios with high security and performance requirements, such as edge computing, financial risk control, and industrial quality inspection.

[0101] In summary, the model loading and inference method based on an encryption card provided in this application introduces an encryption card as an independent root of trust, binding the model encryption key to an environmental metric. When the target environmental metric in the sealed ticket matches the current target environmental metric of the system, the model ciphertext is decrypted and the model is securely loaded into the accelerator. This method enforces hardware protection that the model can only be decrypted in a trusted environment, achieving one-machine-one-key hardware binding. Even if the model is copied to other devices, it cannot be decrypted and run. Furthermore, this method supports remote verification of the system environment and model state, meeting the requirements of high-security auditing.

[0102] This application also provides a model loading and inference apparatus based on an encryption card, which can be referred to in conjunction with the method described above. Please refer to... Figure 6 , Figure 2 This is a schematic diagram of a model loading and inference device based on an encryption card provided in an embodiment of this application, combined with... Figure 6 As shown, the device includes:

[0103] Verification module 10 is used to verify the integrity of the model ciphertext and the sealed ticket using the public key and signature value in the encryption card when a model loading request is received; the signature value is obtained by signing the model ciphertext and the sealed ticket using the private key in the encryption card; the model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card; the sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key in the encryption card.

[0104] The unsealing module 20 is used to unseal the sealed ticket if the integrity verification passes, and match the target environmental metric value in the sealed ticket with the current target environmental metric value of the system.

[0105] The first decryption module 30 is used to decrypt the sealed ticket using the private key if a match is successful, to obtain the model encryption key;

[0106] The second decryption module 40 is used to decrypt the model ciphertext using the model encryption key to obtain the target model;

[0107] The loading module 50 is used to load the target model into the memory region of the accelerator and perform inference in the memory region.

[0108] In some embodiments, it also includes:

[0109] The encryption module is used to call the encryption card to generate a model encryption key and use the encryption key to encrypt the target model to obtain the model ciphertext;

[0110] The sealing module is used to extract the target environment metric value when the system is initially started, and use the public key in the encryption card to seal the model encryption key and the target environment metric value to obtain the sealed ticket;

[0111] The signature module is used to sign the model ciphertext and the sealed ticket using the private key in the encryption card to obtain the signature value;

[0112] The storage module is used to store the model ciphertext, the sealed ticket, and the signature value in a local encrypted storage device.

[0113] In some embodiments, it also includes:

[0114] The receiving module is used to receive random numbers sent by remote devices;

[0115] The acquisition module is used to obtain the platform configuration register value and the hash value of the currently loaded model;

[0116] The digital signature module is used to digitally sign the random number, the platform configuration register value, and the hash value of the currently loaded model using the private key, and obtain a proof report;

[0117] A sending module is used to send the proof report to the remote device so that the remote device can verify the proof report using the public key, the expected platform configuration register value, and the expected hash value.

[0118] In some embodiments, it also includes:

[0119] The Trusted Environment Measurement module is used to perform trusted environment measurements during system startup and application loading.

[0120] The measurement result storage module is used to store the trusted environment measurement results in the platform configuration register of the encryption card.

[0121] In some embodiments, the private key is stored in a secure storage area physically isolated from the encryption card, and the private key does not leave the card.

[0122] In some embodiments, it also includes:

[0123] The encryption and signature processing module is used to encrypt or sign the inference data stream using the encryption card during the model inference process.

[0124] In some embodiments, the target environment metric includes a baseline hash value in the platform configuration register and an encryption card fingerprint; the encryption card fingerprint is a unique identifier for the encryption card.

[0125] This application also provides an electronic device, referenced... Figure 7 As shown, the device includes a memory 1 and a processor 2.

[0126] Memory 1 is used to store computer programs;

[0127] Processor 2 is used to execute computer programs to perform the following steps:

[0128] Upon receiving a model loading request, the integrity of the model ciphertext and the sealed ticket is verified using the public key and signature value within the encryption card. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key within the encryption card. The model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card. The sealed ticket is obtained by sealing the model encryption key and the target environment metric using the public key within the encryption card. If the integrity verification passes, the sealed ticket is unsealed, and the target environment metric in the sealed ticket is matched with the current target environment metric of the system. If the match is successful, the sealed ticket is decrypted using the private key to obtain the model encryption key. The model ciphertext is decrypted using the model encryption key to obtain the target model. The target model is loaded into the accelerator's memory area and inference is performed in the memory area.

[0129] For a description of the equipment provided in this application, please refer to the above method embodiments; further details will not be provided here.

[0130] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the following steps:

[0131] Upon receiving a model loading request, the integrity of the model ciphertext and the sealed ticket is verified using the public key and signature value within the encryption card. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key within the encryption card. The model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card. The sealed ticket is obtained by sealing the model encryption key and the target environment metric using the public key within the encryption card. If the integrity verification passes, the sealed ticket is unsealed, and the target environment metric in the sealed ticket is matched with the current target environment metric of the system. If the match is successful, the sealed ticket is decrypted using the private key to obtain the model encryption key. The model ciphertext is decrypted using the model encryption key to obtain the target model. The target model is loaded into the accelerator's memory area and inference is performed in the memory area.

[0132] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0133] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.

[0134] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant details can be found in the method section.

[0135] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0136] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0137] The above provides a detailed description of the encryption card-based model loading and inference method, apparatus, device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A model loading and inference method based on an encrypted card, characterized in that, include: Upon receiving a model loading request, the integrity of the model ciphertext and the sealed ticket is verified using the public key in the encryption card and the signature value. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key in the encryption card; the model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card; the sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key in the encryption card. If the integrity verification passes, the sealed ticket is unsealed, and the target environmental metric value in the sealed ticket is matched with the current target environmental metric value of the system. If a match is found, the sealed ticket is decrypted using the private key to obtain the model encryption key; The model ciphertext is decrypted using the model encryption key to obtain the target model; The target model is loaded into the accelerator's memory region and inference is performed in the memory region.

2. The model loading and inference method according to claim 1, characterized in that, Also includes: The encryption card is invoked to generate a model encryption key, and the target model is encrypted using the encryption key to obtain the model ciphertext; Extract the target environment metric value at the initial startup of the system, and use the public key in the encryption card to seal the model encryption key and the target environment metric value to obtain the sealed ticket; The model ciphertext and the sealed ticket are signed using the private key in the encryption card to obtain the signature value; The encrypted model, the sealed ticket, and the signature value are stored in a local encrypted storage device.

3. The model loading and inference method according to claim 1, characterized in that, Also includes: Receive random numbers sent by remote devices; Obtain the platform configuration register value and the hash value of the currently loaded model; The random number, the platform configuration register value, and the hash value of the currently loaded model are digitally signed using the private key to obtain a proof report; The proof report is sent to the remote device so that the remote device can verify the proof report using the public key, the expected platform configuration register value, and the expected hash value.

4. The model loading and inference method according to claim 1, characterized in that, Also includes: Perform trusted environment measurements during system startup and application loading; The trusted environment measurement results are stored in the platform configuration register of the encryption card.

5. The model loading and inference method according to claim 1, characterized in that, The private key is stored in a secure storage area physically isolated from the encryption card, and the private key does not leave the card.

6. The model loading and inference method according to claim 1, characterized in that, Also includes: During the model inference process, the encryption card is used to encrypt or sign the inference data stream.

7. The model loading and inference method according to claim 1, characterized in that, The target environment metric includes the baseline hash value in the platform configuration register and the encryption card fingerprint; the encryption card fingerprint is the unique identifier of the encryption card.

8. A model loading and inference device based on an encryption card, characterized in that, include: The verification module is used to verify the integrity of the encrypted model and the sealed ticket using the public key and signature value in the encryption card when a model loading request is received. The signature value is obtained by signing the model ciphertext and the sealed ticket using the private key in the encryption card; the model ciphertext is obtained by encrypting the target model using the encryption key generated by the encryption card; the sealed ticket is obtained by sealing the model encryption key and the target environment metric value using the public key in the encryption card. The unsealing module is used to unseal the sealed ticket if the integrity verification passes, and match the target environmental metric value in the sealed ticket with the current target environmental metric value of the system. The first decryption module is used to decrypt the sealed ticket using the private key if a match is successful, to obtain the model encryption key. The second decryption module is used to decrypt the model ciphertext using the model encryption key to obtain the target model; A loading module is used to load the target model into the memory region of the accelerator and perform inference in the memory region.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the model loading and inference method based on an encryption card as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the model loading and inference method based on an encryption card as described in any one of claims 1 to 7.