Shared key generation method and electronic device in a multi-trusted execution environment

By generating a shared secret during the secure boot phase of an electronic device and combining it with a random factor to generate a shared key, the problems of shared key leakage and complexity are solved, achieving higher security in key generation and updating.

CN120729512BActive Publication Date: 2026-03-10HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2026-03-10

Smart Images

  • Figure CN120729512B_ABST
    Figure CN120729512B_ABST
Patent Text Reader

Abstract

This application provides a method and electronic device for generating shared keys in multiple trusted execution environments. In the method, during the secure boot phase, the electronic device generates a shared secret. During the boot process of the first trusted execution environment, the shared secret is sent to the first trusted execution environment via a first trusted connection, and then sent to the second trusted execution environment via a second trusted connection. Next, a target random factor is obtained and sent to both the first and second trusted execution environments to generate a shared key based on the target random factor and the shared secret. This allows for the generation of shared keys in at least two trusted execution environments. Furthermore, since the shared secret is generated during the secure boot phase of the electronic device, it not only avoids the risk of leakage associated with burning pre-set shared secrets into a production environment but also allows for updating the shared secret, thus improving the security of the generated shared key.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of intelligent terminal, and in particular, relate to a shared key generation method in multiple trusted execution environments and an electronic device. BACKGROUND

[0002] At present, with the development of communication technology, the application of electronic devices is also more and more extensive. In order to protect user privacy and information security, an electronic device (for example: a smart phone and / or a tablet computer, etc.) usually contains a rich execution environment (REE) and a trusted execution environment (TEE). The REE is also called a normal execution environment, which includes a rich execution environment operating system (REE OS) and a client application (CA) running on a general-purpose processor. The TEE is also called a secure execution environment, which can run a trusted execution environment operating system (TEE OS) and provide a trusted secure service (for example: a fingerprint comparison service, a password verification service and / or a face comparison service, etc.) for the CA. These secure services can run in the form of a trust application (TA) on the TEE OS.

[0003] When there are at least two trusted execution environments in an electronic device, secure communication is needed between the at least two trusted execution environments, which requires generating a shared key for integrity verification of data interaction between the at least two trusted execution environments. SUMMARY

[0004] Embodiments of the present application provide a shared key generation method in multiple trusted execution environments and an electronic device. Embodiments of the present application also provide a computer readable storage medium to generate a shared key in at least two trusted execution environments, avoid leaking a preset shared secret, and improve the security of generating a shared key.

[0005] In a first aspect, an embodiment of the present application provides a shared key generation method in a multi-trusted execution environment, applied to an electronic device, the electronic device comprising a first trusted execution environment and a second trusted execution environment; the method comprising: generating a shared secret according to a key of the electronic device in a secure start-up phase of the electronic device; sending the shared secret to the first trusted execution environment through a first trusted connection in a start-up process of the first trusted execution environment; sending the shared secret to the second trusted execution environment through a second trusted connection; obtaining a target random factor; and sending the target random factor to the first trusted execution environment and the second trusted execution environment respectively, so that the first trusted execution environment and the second trusted execution environment generate a shared key according to the target random factor and the shared secret.

[0006] In the above shared key generation method in a multi-trusted execution environment, in a secure start-up phase, the electronic device generates a shared secret according to a key of the electronic device, in a start-up process of the first trusted execution environment, the electronic device sends the shared secret to the first trusted execution environment through a first trusted connection, and sends the shared secret to the second trusted execution environment through a second trusted connection. Then, the electronic device obtains a target random factor, and sends the target random factor to the first trusted execution environment and the second trusted execution environment respectively, so that the first trusted execution environment and the second trusted execution environment generate a shared key according to the target random factor and the shared secret, thereby achieving generation of a shared key in at least two trusted execution environments. In the above method, the shared secret is generated in a secure start-up phase of the electronic device, which not only avoids the risk of leakage of pre-embedded shared secret in a production environment, but also enables updating of the shared secret, thereby improving the security of the generated shared key.

[0007] In one possible implementation, the obtaining of the target random factor comprises: obtaining a first random factor generated by the first trusted execution environment and a second random factor generated by the second trusted execution environment; and generating the target random factor according to the first random factor and the second random factor.

[0008] In one possible implementation, the first trusted execution environment is implemented based on a processor of the electronic device, the second trusted execution environment is implemented based on a secure element in the electronic device, and the first trusted execution environment and the second trusted execution environment are mutually isolated trusted execution environments; and the sending of the shared secret to the second trusted execution environment through a second trusted connection comprises: sending the shared secret to the second trusted execution environment through the second trusted connection between the first trusted execution environment and the second trusted execution environment.

[0009] In a possible implementation, the first trusted execution environment is implemented based on a processor of the electronic device, the second trusted execution environment is implemented based on a virtual machine in the electronic device, and the first trusted execution environment and the second trusted execution environment are mutually isolated trusted execution environments; and the method further includes: sending the shared secret to a virtual machine monitor in the electronic device through a third trusted connection before starting of the second trusted execution environment.

[0010] In a possible implementation, the sending of the shared secret to the second trusted execution environment through the second trusted connection includes: during the starting process of the second trusted execution environment, sending, by the virtual machine monitor, the shared secret to the second trusted execution environment through the second trusted connection between the virtual machine monitor and the second trusted execution environment.

[0011] In a possible implementation, the electronic device further includes a third trusted execution environment implemented based on a secure element in the electronic device; the first trusted execution environment, the second trusted execution environment, and the third trusted execution environment are mutually isolated trusted execution environments; and after the sending, by the virtual machine monitor, of the shared secret to the second trusted execution environment through the second trusted connection between the virtual machine monitor and the second trusted execution environment, the method further includes: sending, by the second trusted execution environment, the shared secret to the third trusted execution environment through a fourth trusted connection between the second trusted execution environment and the third trusted execution environment.

[0012] In a possible implementation, the obtaining of the target random factor includes: obtaining a first random factor generated by the first trusted execution environment, a second random factor generated by the second trusted execution environment, and a third random factor generated by the third trusted execution environment; and generating a target random factor according to the first random factor, the second random factor, and the third random factor.

[0013] In a possible implementation, after the obtaining of the target random factor, the method further includes: sending the target random factor to the third trusted execution environment, so that the third trusted execution environment generates a shared key according to the target random factor and the shared secret.

[0014] In a possible implementation, after the target random factor is sent to the first trusted execution environment and the second trusted execution environment respectively, the method further includes: the first trusted execution environment signing first data to be sent using the shared key, and sending the signed first data; after the second trusted execution environment obtains the signed first data, the second trusted execution environment verifying the signed first data using the shared key; after the first data passes the verification, the second trusted execution environment performing an operation corresponding to the first data.

[0015] In a second aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the electronic device, cause the electronic device to perform the method in the first aspect.

[0016] It should be understood that the second aspect of the embodiment of the present application is consistent with the technical solution of the first aspect of the embodiment of the present application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manner are similar, which will not be repeated.

[0017] In a third aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, which, when executed on a computer, causes the computer to perform the method in the first aspect.

[0018] In a fourth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, is used to perform the method in the first aspect.

[0019] In a possible design, the program in the fourth aspect can be stored in a storage medium packaged with the processor in whole or in part, or in a storage medium not packaged with the processor in whole or in part. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 A schematic diagram of generating a shared key in an electronic device provided by the prior related art;

[0021] Figure 2 A structural schematic diagram of an electronic device provided by an embodiment of the present application;

[0022] Figure 3 A software structural block diagram of an electronic device provided by an embodiment of the present application;

[0023] Figure 4 A schematic diagram of an ARM architecture provided by an embodiment of the present application;

[0024] Figure 5 A flowchart illustrating a shared key generation method in a multi-trusted execution environment provided in one embodiment of this application;

[0025] Figure 6 This is a schematic diagram illustrating an application scenario provided in one embodiment of this application;

[0026] Figure 7 This is a schematic diagram illustrating an application scenario provided for another embodiment of this application;

[0027] Figure 8 This is a schematic diagram illustrating an application scenario provided in yet another embodiment of this application;

[0028] Figure 9 A flowchart illustrating a shared key generation method in a multi-trusted execution environment provided in another embodiment of this application;

[0029] Figure 10 A flowchart of a shared key generation method in a multi-trusted execution environment provided in another embodiment of this application;

[0030] Figure 11 A schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0031] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.

[0032] Figure 1 A schematic diagram illustrating the generation of shared keys in electronic devices provided by existing related technologies, such as... Figure 1 As shown, the electronic device includes two trusted execution environments: Trusted Execution Environment 1 (TEE) and Trusted Execution Environment 2 (Secure Element (SE)). Existing related technologies provide shared key generation schemes that may include:

[0033] Step 1: Before the electronic device leaves the factory, a pre-set shared secret is burned into Trusted Execution Environment 1 and Trusted Execution Environment 2 respectively through the production environment.

[0034] Step 2: During the startup process of the electronic device, Trusted Execution Environment 1 generates random factor 1 and random factor 2, and Trusted Execution Environment 2 also generates random factor 1 and random factor 2; then, Trusted Execution Environment 1 and Trusted Execution Environment 2 exchange random factor 1 and random factor 2 through an insecure channel.

[0035] Step 3: Trusted Execution Environment 1 and Trusted Execution Environment 2 generate a shared key based on a preset shared secret, random factor 1, and random factor 2, respectively.

[0036] However, the above solution has the following problems:

[0037] 1. There is a risk of leaking pre-configured shared secrets in the production environment;

[0038] 2. The pre-set shared secret is burned offline; if it is leaked, it cannot be updated.

[0039] 3. As the trusted execution environment in electronic devices increases, the complexity of the above-mentioned scheme for generating shared keys increases, and the security of generating shared keys decreases.

[0040] To address the above issues, this application provides a shared key generation method in a multi-trusted execution environment. This method can generate shared keys in at least two trusted execution environments, avoiding the leakage of pre-set shared secrets and improving the security of the generated shared keys. It should be noted that "improving the security of the generated shared keys" mentioned herein can include not only improving the security of the shared key generation process but also improving the security of the final generated shared key.

[0041] The shared key generation method in a multi-trusted execution environment provided in this application can be applied to electronic devices, such as smartphones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs). This application does not impose any restrictions on the specific type of electronic device.

[0042] For example, Figure 2 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application, as shown below. Figure 2As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0043] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0044] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0045] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0046] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0047] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0048] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0049] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via a USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device 100 via the power management module 141.

[0050] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0051] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.

[0052] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0053] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0054] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0055] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0056] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0057] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0058] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0059] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0060] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0061] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0062] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0063] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0064] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0065] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0066] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor.

[0067] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0068] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.

[0069] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.

[0070] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.

[0071] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.

[0072] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.

[0073] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0074] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

[0075] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.

[0076] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0077] The software architecture of the aforementioned electronic devices can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. The following section uses a layered architecture as an example to illustrate the software structure of electronic devices.

[0078] Figure 3This is a software architecture block diagram of an electronic device provided in one embodiment of this application. The layered architecture divides the software system into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into four layers, from top to bottom: applications, application framework, system layer, and kernel. It should be understood that the execution environment in the electronic device 100 includes REE and TEE, and applications and operating systems (OS) can run independently under both TEE and REE. Meanwhile, each layer of the software architecture includes software components that can run on both TEE and REE, which will be described in detail below:

[0079] The application layer can include a series of applications. Based on their execution environment, these applications can be categorized into ordinary applications (REE apps) and trusted applications (TAs). REE apps are those running on an REE (Remote Application Environment), such as calendar, memo, map, navigation, video, payment, or chat apps; REE apps can also be called CAs (Certificates of Compatibility). TAs are those running on a TEE (Trusted Application Environment). Compared to REEs, TEEs provide a more secure space for data and code execution, ensuring their confidentiality and integrity. Therefore, TEEs can be used to run apps with high security requirements.

[0080] It's important to note that the TA (Transaction Provider) can be a standalone app, such as a wallet application. Alternatively, the TA may not be a standalone app but rather embedded within the REE app to implement a specific function within the REE app. For example, if the REE app is a banking app, the transfer function within a banking app requires a banking TA. In other words, running the banking app and triggering the transfer function will activate the banking TA. Clearly, the banking TA can be understood as an app embedded within the REE app.

[0081] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. For example, the application framework layer includes various services that support application execution, such as Bluetooth and / or camera services. Also, based on the execution environment, the application framework layer includes services that support the REE app and services that support the TA.

[0082] The system layer can include an OS running under REE (which can be referred to as a regular operating system REE OS), such as Android, iOS, or Linux, as well as an OS running under TEE (which can be referred to as a trusted operating system TEE OS). It should be understood that the OS can include system libraries, such as media libraries and 3D graphics processing libraries (e.g., OpenGL ES). Media libraries support playback and recording of various common audio and video formats, as well as still image files. Media libraries can support various audio and video encoding formats, such as JPG and PNG. 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0083] The kernel layer is the layer between hardware and software. It can include hardware drivers such as display drivers, touchscreen drivers, camera drivers, audio drivers, sensor drivers, and Bluetooth drivers, which are used to drive the hardware. Similarly, corresponding to the two execution environments, these hardware drivers can also be divided into two types.

[0084] Furthermore, the processor of electronic device 100 can typically employ an advanced reduced instruction set computing (RISC) machine (ARM) architecture. Because ARM uses a reduced instruction set computing (RISC) instruction set, it avoids complex instructions, focusing primarily on logic control and using little or no microcode control. This allows for a small size and low power consumption in the system-on-chip (SoC), making it highly suitable for small electronic devices.

[0085] Figure 4 A schematic diagram of an ARM architecture provided in one embodiment of this application, as shown below. Figure 4 As shown, the ARM architecture can include four exception levels (EL), from EL0 to EL3. For ELn (where n is an integer greater than or equal to 0), the larger n is, the greater the privileged access the software can have. Execution at EL0 level is called unprivileged execution. Furthermore, the larger n is, the higher the privileged access to resources within the electronic device 100.

[0086] EL0 runs applications from the application layer, such as REE apps and TAs, as well as various services provided by the application framework layer to support application execution, such as general application services and security application services. EL1 runs the operating system (OS) from the system layer, such as REE OS and TEE OS, and hardware drivers from the kernel layer, such as general application drivers and security application drivers. EL2 runs a hypervisor, which can create virtual machines, each with its own independent operating system (i.e., the OS running within each virtual machine), capable of independently running applications and storing data. EL3 supports transitions between secure and insecure states. For example, EL3 runs a security monitor (SecureMonitor).

[0087] For ease of understanding, the following embodiments of this application will be described using the following methods: Figures 2 to 4 Taking the electronic device 100 with the structure shown as an example, and in conjunction with the accompanying drawings and application scenarios, the shared key generation method in a multi-trusted execution environment provided by the embodiments of this application will be specifically described.

[0088] Figure 5 This is a flowchart illustrating a shared key generation method in a multi-trusted execution environment according to an embodiment of this application. This security processing method can be applied to an electronic device 100, which may include: a first trusted execution environment and a second trusted execution environment; as... Figure 5 As shown, the above-mentioned shared key generation method may include:

[0089] Step 501: During the secure boot phase, electronic device 100 generates a shared secret based on the key of electronic device 100.

[0090] Step 502: During the startup process of the first trusted execution environment, the electronic device 100 sends the shared secret to the first trusted execution environment through the first trusted connection.

[0091] Step 503: Electronic device 100 sends the shared secret to the second trusted execution environment via the second trusted connection.

[0092] In one implementation, such as Figure 6 As shown, Figure 6 This is a schematic diagram illustrating an application scenario provided by one embodiment of this application. Figure 6In the application scenario shown, the first trusted execution environment is implemented based on the processor of the electronic device 100, and the second trusted execution environment is implemented based on the secure element in the electronic device 100. The first and second trusted execution environments are mutually isolated trusted execution environments. In this implementation, the electronic device 100 can configure the secure element in the first trusted execution environment and connect the first and second trusted execution environments through the second trusted connection 62.

[0093] In this implementation, the electronic device 100 sending the shared secret to the second trusted execution environment through the second trusted connection can be as follows: the electronic device 100 sends the shared secret to the second trusted execution environment through the second trusted connection between the first trusted execution environment and the second trusted execution environment.

[0094] Figure 6 In the diagram, 61 is the first trusted connection and 62 is the second trusted connection. During the startup process of the first trusted execution environment, the electronic device 100 sends the shared secret to the first trusted execution environment through the first trusted connection 61. Then, the electronic device 100 can send the shared secret to the second trusted execution environment through the second trusted connection 62 between the first trusted execution environment and the second trusted execution environment.

[0095] Figure 6 This example illustrates the concept of having only one first trusted execution environment (TEX) and one second trusted execution environment. However, this does not constitute a limitation on this embodiment. In specific implementations, there can be at least two first trusted execution environments and at least two second trusted execution environments. For example, electronic device 100 can implement at least two first trusted execution environments based on its processor. Each first trusted execution environment is configured with a secure element (i.e., a second trusted execution environment). Thus, during the startup process of at least two first trusted execution environments, electronic device 100 sends a shared secret to each first trusted execution environment through a first trusted connection corresponding to each first trusted execution environment. Then, each first trusted execution environment sends the shared secret to each second trusted execution environment through a second trusted connection between itself and the second trusted execution environment. The above is merely an example. This embodiment does not limit the number of first and second trusted execution environments in electronic device 100. However, regardless of the number of first and second trusted execution environments, the methods by which the first and second trusted execution environments obtain the shared secret can refer to the above description and will not be repeated here.

[0096] In another implementation, such as Figure 7 As shown, Figure 7 This is a schematic diagram illustrating an application scenario provided by another embodiment of this application. Figure 7In the application scenario shown, the first trusted execution environment is implemented based on the processor of the electronic device 100, and the second trusted execution environment is implemented based on the virtual machine in the electronic device 100. The first trusted execution environment and the second trusted execution environment are mutually isolated trusted execution environments. Figure 7 In the diagram, 72 represents the third trusted connection, 71 the second trusted connection, and 61 the first trusted connection.

[0097] In this implementation, see Figure 7 During the startup process of the first trusted execution environment, the electronic device 100 sends the shared secret to the first trusted execution environment through the first trusted connection 61. Before the startup of the second trusted execution environment, the electronic device 100 can send the shared secret to the virtual machine monitor in the electronic device 100 through the third trusted connection 72. Then, during the startup process of the second trusted execution environment, the virtual machine monitor sends the shared secret to the second trusted execution environment through the second trusted connection 71 between the virtual machine monitor and the second trusted execution environment.

[0098] same, Figure 7 This example illustrates the concept of having only one first trusted execution environment (TEX) and one second trusted execution environment (TEX), but this does not constitute a limitation on the embodiment. In specific implementations, there can be at least two first TEXs and at least two second TEXs. For example, electronic device 100 can implement at least two first TEXs based on its processor and at least two second TEXs based on virtual machines within it. During the startup process of the at least two first TEXs, electronic device 100 sends a shared secret to each first TEX through a first trusted connection corresponding to each first TEX. Before the startup of the at least two second TEXs, electronic device 100 can send the shared secret to a virtual machine monitor within it via a third trusted connection 72. Then, during the startup process of each second TEX, the virtual machine monitor sends the shared secret to each second TEX through a second trusted connection 71. The above is merely an example. This embodiment does not limit the number of the first trusted execution environment and the second trusted execution environment in the electronic device 100. However, regardless of the number of the first trusted execution environment and the second trusted execution environment, the method by which the first trusted execution environment and the second trusted execution environment obtain the shared secret can refer to the above description, and will not be repeated here.

[0099] Step 504: Electronic device 100 acquires the target random factor.

[0100] Specifically, the electronic device 100 may obtain the target random factor by: obtaining a first random factor generated by a first trusted execution environment and a second random factor generated by a second trusted execution environment, and then generating the target random factor based on the first random factor and the second random factor.

[0101] Step 505: Electronic device 100 sends the target random factor to the first trusted execution environment and the second trusted execution environment respectively, so that the first trusted execution environment and the second trusted execution environment can generate a shared key based on the target random factor and the shared secret.

[0102] In the above-described method for generating shared keys under multiple trusted execution environments, during the secure boot phase, electronic device 100 generates a shared secret based on its own key. During the boot process of the first trusted execution environment, electronic device 100 sends the shared secret to the first trusted execution environment via a first trusted connection, and then sends it to the second trusted execution environment via a second trusted connection. Next, electronic device 100 obtains a target random factor and sends it to both the first and second trusted execution environments. This allows the first and second trusted execution environments to generate shared keys based on the target random factor and the shared secret. This enables the generation of shared keys under at least two trusted execution environments. Furthermore, since the shared secret is generated during the secure boot phase of electronic device 100, this method not only avoids the risk of leakage associated with burning pre-set shared secrets in a production environment but also allows for updating the shared secret, thus improving the security of the generated shared keys.

[0103] Figure 8 This is a schematic diagram illustrating an application scenario provided in another embodiment of this application, such as... Figure 8 As shown, the electronic device 100 includes three trusted execution environments, namely a first trusted execution environment, a second trusted execution environment, and a third trusted execution environment. The first trusted execution environment can be implemented based on the processor 110 of the electronic device 100. ARM integrates TrustZone technology with the Cortex-A processor, providing a platform that can support the first trusted execution environment as well as security-aware applications and security services. As a trusted execution environment in the electronic device 100, the first trusted execution environment can provide trusted applications for the REE side.

[0104] The second trusted execution environment can be implemented based on a virtual machine in the electronic device 100. As another trusted execution environment in the electronic device 100, the second trusted execution environment can provide trusted applications for the REE side.

[0105] The third trusted execution environment can be implemented based on the SE in the electronic device 100. As another trusted execution environment in the electronic device 100, the third trusted execution environment can provide trusted applications for the REE side.

[0106] Specifically, the electronic device 100 can configure the third trusted execution environment in the second trusted execution environment and connect the second trusted execution environment and the third trusted execution environment through the fourth trusted connection 81.

[0107] The first trusted execution environment, the second trusted execution environment, and the third trusted execution environment mentioned above are mutually isolated trusted execution environments.

[0108] The following is about Figure 8 The method for generating shared keys in the scenario shown will be introduced.

[0109] Figure 9 A flowchart of a shared key generation method in a multi-trusted execution environment provided in another embodiment of this application is shown below. Figure 9 As shown, the above method may include:

[0110] Steps 901 to 902 are the same as steps 501 to 502.

[0111] Step 903: Before the second trusted execution environment is started, the electronic device 100 sends the aforementioned shared secret to the virtual machine monitor in the electronic device 100 via the third trusted connection 72.

[0112] In step 904, during the startup process of the second trusted execution environment, the virtual machine monitor sends the shared secret to the second trusted execution environment through the second trusted connection 71 between the virtual machine monitor and the second trusted execution environment.

[0113] In step 905, the second trusted execution environment sends the shared secret to the third trusted execution environment through the fourth trusted connection 81 between the second trusted execution environment and the third trusted execution environment.

[0114] Step 906: Electronic device 100 acquires the target random factor.

[0115] Specifically, see Figure 8 The electronic device 100 can obtain the target random factor by: obtaining the first random factor generated by the first trusted execution environment, the second random factor generated by the second trusted execution environment, and the third random factor generated by the third trusted execution environment, and then generating the target random factor based on the first random factor, the second random factor, and the third random factor.

[0116] In step 907, the electronic device 100 sends the target random factor to the first trusted execution environment, the second trusted execution environment, and the third trusted execution environment, respectively, so that the first trusted execution environment, the second trusted execution environment, and the third trusted execution environment can generate a shared key based on the target random factor and the shared secret.

[0117] In the above-described method for generating shared keys under multiple trusted execution environments, during the secure boot phase, electronic device 100 generates a shared secret based on its own key. During the boot process of the first trusted execution environment, electronic device 100 sends the shared secret to the first trusted execution environment via a first trusted connection. During the boot process of the second trusted execution environment, electronic device 100 sends the shared secret to the second trusted execution environment via a second trusted connection, and the second trusted execution environment then sends the shared secret to the third trusted execution environment via a third trusted connection. Next, electronic device 100 obtains a target random factor and sends it to the first, second, and third trusted execution environments respectively, so that the first, second, and third trusted execution environments can generate shared keys based on the target random factor and the shared secret. This allows for the generation of shared keys under at least two trusted execution environments. Furthermore, in this method, the shared secret is generated during the secure boot phase of electronic device 100, which not only avoids the risk of leakage associated with burning pre-set shared secrets in the production environment but also allows for updating the shared secret, improving the security of the generated shared keys.

[0118] Similarly, it should be noted that, Figures 8 to 9 The example given is that there is only one first trusted execution environment, one second trusted execution environment, and one third trusted execution environment. However, this does not constitute a limitation on this embodiment. In specific implementations, there can be at least two first trusted execution environments, at least two second trusted execution environments, and at least two third trusted execution environments. For example, electronic device 100 can implement at least two first trusted execution environments based on the processor of electronic device 100, and at least two second trusted execution environments based on the virtual machine in electronic device 100. Each second trusted execution environment is configured with a security element (i.e., a third trusted execution environment).

[0119] Thus, during the startup of at least two first trusted execution environments, the electronic device 100 sends the shared secret to each first trusted execution environment through the first trusted connection 61 corresponding to each first trusted execution environment. Before the startup of at least two second trusted execution environments, the electronic device 100 can send the shared secret to the virtual machine monitor in the electronic device 100 through the third trusted connection 72. Then, during the startup of each second trusted execution environment, the virtual machine monitor sends the shared secret to the second trusted execution environment through the second trusted connection 71 between itself and each second trusted execution environment. Each second trusted execution environment then sends the shared secret to its corresponding third trusted execution environment through the fourth trusted connection 81. The above is merely an example. This embodiment does not limit the number of first, second, and third trusted execution environments in the electronic device 100. However, regardless of the number of first, second, and third trusted execution environments, the methods by which the first, second, and third trusted execution environments obtain the shared secret can all be referred to. Figure 9 The description of the illustrated embodiments will not be repeated here.

[0120] Figure 10 A flowchart of a shared key generation method in a multi-trusted execution environment provided in another embodiment of this application is shown below. Figure 10 As shown, this application Figure 5 Following step 505 in the illustrated embodiment, the following may also be included:

[0121] Step 1001: The first trusted execution environment uses the aforementioned shared key to sign the first data to be sent, and then sends the signed first data.

[0122] Step 1002: After the second trusted execution environment obtains the signed first data, it uses the aforementioned shared key to verify the signed first data.

[0123] Step 1003: After the first data passes verification, the second trusted execution environment performs the operation corresponding to the first data.

[0124] In this embodiment, data verification between the first trusted execution environment and the second trusted execution environment is used as an example for illustration. It can be understood that, Figure 8 In the application scenarios shown, the data verification between the first trusted execution environment and the third trusted execution environment, the second trusted execution environment and the third trusted execution environment, or the first trusted execution environment, the second trusted execution environment and the third trusted execution environment is similar to this process, and will not be described in detail here.

[0125] In this embodiment, the first trusted execution environment signs the first data to be sent using a shared key before sending it to the second trusted execution environment, thereby improving the security of data interaction between different trusted execution environments in the electronic device 100.

[0126] It is understood that some or all of the steps or operations in the above embodiments are merely examples, and other operations or variations thereof can be performed in the embodiments of this application. Furthermore, the steps may be performed in different orders as presented in the above embodiments, and it is not necessary to perform all the operations in the above embodiments.

[0127] It is understood that, in order to achieve the above-mentioned functions, electronic devices include hardware and / or software modules that perform the respective functions. Based on the algorithm steps of the examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware 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 in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0128] This embodiment can divide the electronic device into functional modules according to the above method embodiment. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0129] Figure 11 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. In the case where functional modules are divided according to their respective functions, Figure 11 A schematic diagram of a possible composition of the electronic device 1100 involved in the above embodiments is shown, such as... Figure 11 As shown, the electronic device 1100 may include: a receiving unit 1101, a processing unit 1102, and a transmitting unit 1103;

[0130] The processing unit 1102 can be used to support the electronic device 1100 in executing steps 501 to 505, steps 901 to 907, and steps 1001 to 1003, and / or other processes used in the technical solutions described in the embodiments of this application.

[0131] It should be noted that all relevant content of each step involved in the method embodiments of this application can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0132] The electronic device 1100 provided in this embodiment is used to execute the shared key generation method in a multi-trusted execution environment provided in this application embodiment, and thus can achieve the same effect as the above method.

[0133] It should be understood that electronic device 1100 can correspond to Figure 2 The electronic device 100 shown. The functions of the receiving unit 1101 and the transmitting unit 1103 can be determined by... Figure 2 The processor 110, antenna 1, and mobile communication module 150 in the electronic device 100 shown are, and / or, implemented by the processor 110, antenna 2, and wireless communication module 160; the function of the processing unit 1102 can be implemented by... Figure 2 The processor 110 in the electronic device 100 shown is implemented.

[0134] When using integrated units, the electronic device 1100 may include a processing module, a storage module, and a communication module.

[0135] The processing module can be used to control and manage the actions of the electronic device 1100. For example, it can support the electronic device 1100 in executing the steps performed by the receiving unit 1101, processing unit 1102, and sending unit 1103. The storage module can support the electronic device 1100 in storing program code and data. The communication module can support communication between the electronic device 1100 and other devices.

[0136] The processing module can be a processor or controller, which can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as radio frequency circuitry, a Bluetooth chip, and / or a Wi-Fi chip.

[0137] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device 1100 involved in this embodiment can be a device having... Figure 2 The device with the structure shown.

[0138] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute this application. Figures 6 to 8 The method provided in the illustrated embodiment.

[0139] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to execute this application. Figures 6 to 8 The method provided in the illustrated embodiment.

[0140] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0141] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. 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.

[0142] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0143] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes 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.

[0144] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A method for generating shared keys in a multi-trusted execution environment, characterized in that, The method is applied to an electronic device, and the electronic device comprises a first trusted execution environment and a second trusted execution environment; the method comprises: generating a shared secret according to a key of the electronic device in a secure boot phase of the electronic device; sending the shared secret to the first trusted execution environment through a first trusted connection in a boot process of the first trusted execution environment; sending the shared secret to the second trusted execution environment through a second trusted connection; obtaining a random factor generated by a trusted execution environment in the electronic device, and generating a target random factor according to the random factor generated by the trusted execution environment; sending the target random factor to the first trusted execution environment and the second trusted execution environment respectively, so that the first trusted execution environment and the second trusted execution environment generate a shared key according to the target random factor and the shared secret.

2. The method of claim 1, wherein, The obtaining of the random factor generated by the trusted execution environment in the electronic device comprises: obtaining a first random factor generated by the first trusted execution environment and a second random factor generated by the second trusted execution environment; The generating of the target random factor according to the random factor generated by the trusted execution environment comprises: generating the target random factor according to the first random factor and the second random factor.

3. The method of claim 1, wherein, The first trusted execution environment is implemented based on a processor of the electronic device, the second trusted execution environment is implemented based on a secure element in the electronic device, and the first trusted execution environment and the second trusted execution environment are mutually isolated trusted execution environments; The sending of the shared secret to the second trusted execution environment through the second trusted connection comprises: sending the shared secret to the second trusted execution environment through the second trusted connection between the first trusted execution environment and the second trusted execution environment.

4. The method of claim 1, wherein, The first trusted execution environment is implemented based on a processor of the electronic device, the second trusted execution environment is implemented based on a virtual machine in the electronic device, and the first trusted execution environment and the second trusted execution environment are mutually isolated trusted execution environments; The method further comprises: sending the shared secret to a virtual machine monitor in the electronic device through a third trusted connection before the second trusted execution environment is started.

5. The method of claim 4, wherein, The sending of the shared secret to the second trusted execution environment through the second trusted connection comprises: sending the shared secret to the second trusted execution environment through the second trusted connection between the virtual machine monitor and the second trusted execution environment in a boot process of the second trusted execution environment.

6. The method of claim 5, wherein, The electronic device further comprises a third trusted execution environment, the third trusted execution environment is implemented based on a secure element in the electronic device, and the first trusted execution environment, the second trusted execution environment and the third trusted execution environment are mutually isolated trusted execution environments; after the virtual machine monitor sends the shared secret to the second trusted execution environment through the second trusted connection between the virtual machine monitor and the second trusted execution environment, the method further comprises: The second trusted execution environment sends the shared secret to the third trusted execution environment through a fourth trusted connection between the second trusted execution environment and the third trusted execution environment.

7. The method of claim 6, wherein, The acquiring the random factor generated by the trusted execution environment in the electronic device comprises: acquiring a first random factor generated by the first trusted execution environment, a second random factor generated by the second trusted execution environment and a third random factor generated by the third trusted execution environment; The generating the target random factor according to the random factor generated by the trusted execution environment comprises: generating a target random factor according to the first random factor, the second random factor and the third random factor.

8. The method of claim 7, wherein, After the generating the target random factor, the method further comprises: sending the target random factor to the third trusted execution environment, so that the third trusted execution environment generates a shared key according to the target random factor and the shared secret.

9. The method according to any one of claims 1 to 8, characterized in that, After the sending the target random factor to the first trusted execution environment and the second trusted execution environment respectively, the method further comprises: The first trusted execution environment signs the first data to be sent using the shared key, and sends the signed first data; The second trusted execution environment acquires the signed first data, and then checks the signed first data using the shared key; After the first data passes the check, the second trusted execution environment executes the operation corresponding to the first data.

10. An electronic device, comprising: comprise: one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs comprise instructions which, when executed by the electronic device, cause the electronic device to perform the method of any one of claims 1-9.

11. A computer readable storage medium, characterized in that, The computer readable storage medium stores a computer program, which, when running on a computer, causes the computer to perform the method of any one of claims 1-9.

Citation Information

Patent Citations

  • System, apparatus and method for controlling multiple trusted execution environments in a system

    CN107533609A

  • Trusted execution environment-based key burning system and method

    CN108155986A