自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
Trusty TEE
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Trusty 是安全的作業系統 (OS),可為 Android 提供受信任的執行環境 (TEE)。Trusty OS 與 Android 作業系統使用相同的處理器,但 Trusty 會透過硬體和軟體與其他系統隔離。Trusty 和 Android 會並行執行。Trusty 可使用裝置主處理器和記憶體的全部效能,但完全隔離。Trusty 的隔離功能可保護它免受使用者安裝的惡意應用程式,以及 Android 中可能發現的潛在安全漏洞。
Trusty 與 ARM 和 Intel 處理器相容。在 ARM 系統上,Trusty 會使用 ARM 的 TrustZone 將主處理器虛擬化,並建立安全的 TEE。在使用 Intel 虛擬化技術的 Intel x86 平台上,也提供類似的支援。
圖 1. Trusty 總覽圖。
Trusty 包含以下元素:
- 源自
Little Kernel 的小型 OS 核心
- 用於在安全環境和 Android 之間傳輸資料的 Linux 核心驅動程式
- 透過核心驅動程式與信任的應用程式 (也就是安全的作業/服務) 通訊的 Android
使用者空間程式庫
注意:Trusty 和 Trusty API 可能會變更。如需 Trusty API 的相關資訊,請參閱 API 參考資料。
為什麼要使用 Trusty?
其他 TEE 作業系統通常由第三方供應商提供,或由內部開發人員以二進位檔 Blob 的形式提供。晶片系統 (SoC) 供應商和原始設備製造商 (OEM) 若要開發內部 TEE 系統,或向第三方授權 TEE,可能會付出高昂的成本。金錢成本加上不可靠的第三方系統,會導致 Android 生態系統不穩定。我們提供 Trusty 給合作夥伴,讓他們可使用可靠且免費的開放原始碼替代方案來執行 TEE。Trusty 提供的資訊公開程度,是封閉原始碼系統無法達到的。
Android 支援各種 TEE 實作,因此您不必侷限於使用 Trusty。每個 TEE OS 都有其專屬的部署信任應用程式方式。對於信任應用程式開發人員而言,這種分散現象可能會造成問題,因為他們希望確保應用程式可在所有 Android 裝置上運作。使用 Trusty 做為標準,有助於應用程式開發人員輕鬆建立及部署應用程式,而無須考量多個 TEE 系統的碎片化問題。Trusty TEE 可為開發人員和合作夥伴提供資訊公開、協作、程式碼檢查和輕鬆偵錯等功能。信任的應用程式開發人員可以聚焦於常見的工具和 API,降低引入安全漏洞的風險。這些開發人員可放心開發應用程式,並在多部裝置上重複使用,而無須進一步開發。
應用程式和服務
Trusty 應用程式定義為一組二進位檔案 (可執行檔和資源檔案)、二進位資訊清單和加密編譯簽章。在執行階段,Trusty 應用程式會以 Trusty 核心的無特權模式,以隔離的程序運作。每個程序都會在自己的虛擬記憶體沙箱中執行,並利用 TEE 處理器的記憶體管理單元功能。硬體的版本會變更 Trusty 遵循的確切程序,但舉例來說,核心會使用以安全計時器滴答為驅動的以優先順序為準的循環式調度器,排定這些程序。所有 Trusty 應用程式都會共用相同的優先順序。
圖 2. Trusty 應用程式總覽。
第三方 Trusty 應用程式
目前所有 Trusty 應用程式都是由單一廠商開發,並與 Trusty 核心映像檔一併封裝。整個映像檔會在開機期間由系統啟動載入程式簽署及驗證。Trusty 目前不支援第三方應用程式開發作業。雖然 Trusty 可用於開發新應用程式,但這項作業必須極為謹慎;每個新應用程式都會增加系統的受信任運算基礎 (TCB) 範圍。信任的應用程式可以存取裝置機密,並使用這些機密執行運算或資料轉換作業。開發可在 TEE 中執行的新應用程式,可開啟許多創新的可能性。不過,由於 TEE 的定義,這些應用程式必須附加某種信任機制,才能發布。通常,這會以數位簽章的形式呈現,而這項簽章是由應用程式執行產品的使用者信任的實體所簽署。
用途和範例
TEE 正迅速成為行動裝置的標準。使用者在日常生活中越來越仰賴行動裝置,因此對安全性的需求也持續增加。搭載 TEE 的行動裝置比沒有 TEE 的裝置更安全。
在實作 TEE 的裝置上,主處理器通常會被稱為「不受信任」,這表示它無法存取 RAM、硬體登錄和一次寫入保險絲的特定區域,因為這些區域儲存的是製造商儲存的機密資料 (例如特定裝置的密碼金鑰)。在主處理器上執行的軟體會將需要使用機密資料的任何作業,委派給 TEE 處理器。
在 Android 生態系統中,最廣為人知的例子就是用於受保護內容的 DRM 架構。在 TEE 處理器上執行的軟體可存取解密受保護內容所需的裝置專屬金鑰。主處理器只會看到已加密的內容,可提供高層級安全性,並防範軟體攻擊。
TEE 還有許多其他用途,例如行動支付、安全銀行服務、多重驗證、裝置重設保護、重播保護的持續性儲存空間、安全的 PIN 碼和指紋處理,甚至是惡意軟體偵測。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Trusty TEE\n\nTrusty is a secure Operating System (OS) that provides a Trusted Execution\nEnvironment (TEE) for Android. The Trusty OS runs on the same processor\nas the Android OS, but Trusty is isolated from the rest of the system\nby both hardware and software. Trusty and Android run parallel\nto each other. Trusty has access to the full power of a device's main\nprocessor and memory but is completely isolated. Trusty's isolation\nprotects it from malicious apps installed by the user and potential\nvulnerabilities that may be discovered in Android.\n\nTrusty is compatible with ARM and Intel processors. On ARM systems,\nTrusty uses ARM's TrustZone to virtualize the main processor and create\na secure TEE. Similar support is also available\non Intel x86 platforms using Intel's Virtualization Technology.\n\n\n**Figure 1**. Trusty overview diagram.\n\nTrusty consists of:\n\n- A small OS kernel derived from [Little Kernel](https://github.com/littlekernel/lk)\n- A Linux kernel driver to transfer data between the secure environment and Android\n- An Android [userspace library](https://android.googlesource.com/trusty/lib/) to communicate with trusted applications (that is, secure tasks/services) via the kernel driver\n\n**Note:** Trusty and the Trusty API are subject\nto change. For information about the Trusty API, see the [API Reference](/docs/security/features/trusty/trusty-ref).\n\nWhy Trusty?\n-----------\n\nOther TEE operating systems are traditionally supplied as binary\nblobs by third-party vendors or developed internally.\nDeveloping internal TEE systems or licensing a TEE from a third-party\ncan be costly to System-on-Chip (SoC) vendors and OEMs.\nThe monetary cost combined with unreliable third-party systems creates an\nunstable ecosystem for Android. Trusty is being provided to its partners\nas a reliable and free open source alternative for their TEE. Trusty offers a level of\ntransparency that isn't possible with closed source systems.\n\nAndroid supports various TEE implementations so you are not restricted\nto using Trusty. Each TEE OS has its own unique way of deploying trusted\napplications. This fragmentation can be a problem for trusted application\ndevelopers trying to ensure their apps work on every Android device.\nUsing Trusty as a standard helps application developers to easily\ncreate and deploy applications without accounting\nfor the fragmentation of multiple TEE systems. Trusty TEE provides developers\nand partners with transparency, collaboration, inspectability of code, and\nease of debugging. Trusted application developers can converge around common\ntools and APIs to reduce the risk of introducing security vulnerabilities.\nThese developers will have the confidence that they can develop an application\nand have it reused across multiple devices without further development.\n\nApplications and services\n-------------------------\n\nA Trusty application is defined as a collection of binary files\n(executables and resource files), a binary manifest, and a\ncryptographic signature.\nAt runtime, Trusty applications run as isolated processes in\nunprivileged mode under the Trusty kernel. Each process runs\nin its own virtual memory sandbox utilizing the memory management\nunit capabilities of the TEE processor. The build of the hardware\nchanges the exact process that Trusty follows, but for example,\nthe kernel schedules these processes using a priority-based,\nround-robin scheduler driven by a secure timer tick.\nAll Trusty applications share the same priority.\n\n\n**Figure 2**. Trusty application overview.\n\nThird-party Trusty applications\n-------------------------------\n\nCurrently all Trusty applications are developed by a single\nparty and packaged with the Trusty kernel image.\nThe entire image is signed and verified by the bootloader during boot.\nThird-party application development is not supported in Trusty at\nthis time. Although Trusty enables the development of new\napplications, doing so must be exercised with extreme care; each\nnew application increases the area of the trusted computing base\n(TCB) of the system.\nTrusted applications can access device secrets and can perform\ncomputations or data transformations using them. The ability to\ndevelop new applications that run in the TEE opens up many\npossibilities for innovation. However, due to the very definition\nof a TEE, these applications cannot be distributed without some\nform of trust attached. Typically this comes in the form of a\ndigital signature by an entity trusted by the user of the\nproduct on which the application runs.\n\nUses and examples\n-----------------\n\nTEEs are fast becoming a standard in\nmobile devices. Users are relying more and more on their mobile\ndevices for their everyday lives and the need for security is always\ngrowing.\nMobile devices with a TEE are more secure than devices without a TEE.\n\nOn devices with a TEE implementation, the main processor is often\nreferred to as \"untrusted\", meaning it cannot access certain areas\nof RAM, hardware registers, and write-once fuses where secret data\n(such as, device-specific cryptographic keys) are stored by the manufacturer.\nSoftware running on the main processor delegates any operations that\nrequire use of secret data to the TEE processor.\n\nThe most widely known example of this in the Android ecosystem is the [DRM framework](/docs/core/media/drm)\nfor protected content. Software running on the TEE processor can\naccess device-specific keys required to decrypt protected content.\nThe main processor sees only the encrypted content, providing\na high level of security and protection against software-based attacks.\n\nThere are many other uses for a TEE such as mobile payments, secure banking,\nmulti-factor authentication, device reset protection,\nreplay-protected persistent storage, secure PIN and fingerprint processing,\nand even malware detection."]]