自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
Android 安全性功能
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
請使用本節所述的功能,盡可能確保您開發的 Android 裝置安全無虞。
應用程式沙箱
Android 平台會利用 Linux 使用者為基礎的防護機制,識別及隔離應用程式資源。為此,Android 會為每個 Android 應用程式指派不重複的使用者 ID (UID),並在其專屬程序中執行。Android 會使用這個 UID 設定核心層級的應用程式沙箱。
應用程式簽署
應用程式簽署功能可讓開發人員識別應用程式的作者,並更新應用程式,而無須建立複雜的介面和權限。在 Android 平台上執行的每個應用程式都必須由開發人員簽署。
驗證
Android 有使用者驗證工具的概念,可用來解鎖裝置及執行其他工作:
- 閘道管理員子系統會在受信任的執行環境 (TEE) 中執行裝置圖案或密碼驗證。
- 選用的 Weaver 元件會在個別安全元素中執行解鎖圖案或密碼驗證。
- 裝置上有指紋感應器時,系統會支援使用註冊的指紋。
- 裝置可支援臉孔驗證。
Android 也支援硬體支援的加密編譯金鑰,這類金鑰只能在使用者透過其中一種機制完成驗證後才能使用。
生物辨識
Android 9 以上版本包含 BiometricPrompt
類別,應用程式開發人員可以使用該類別,以裝置和模式無關的方式將生物特徵辨識驗證功能整合至應用程式。只有強力生物特徵辨識才能與 BiometricPrompt
整合。
加密
裝置加密後,所有使用者建立的資料都會在寫入磁碟前自動加密,所有讀取作業都會在將資料傳回呼叫程序前自動解密資料。加密機制可確保即使未經授權的第三方嘗試存取資料,也無法讀取資料。
KeyStore
Android 提供硬體支援的 KeyStore,可在金鑰內容位於安全環境中時提供加密編譯功能。Android Keystore 支援對稱式和非對稱式金鑰的產生和匯入作業,並結合加密、解密、簽署和金鑰協議原始碼。
安全增強式 Linux
在 Android 安全性模型中,Android 會使用安全增強式 Linux (SELinux) 對所有程序實施強制存取控制 (MAC),甚至是使用根層級或超級使用者權限 (Linux 功能) 執行的程序。
Trusty TEE
Trusty TEE
Trusty 是安全的作業系統 (OS),可為 Android 提供 TEE。Trusty OS 與 Android 作業系統使用相同的處理器,但 Trusty 會透過硬體和軟體與其他系統隔離。
驗證開機程序
驗證開機程序旨在確保所有執行程式碼皆來自可信任的來源 (通常是裝置原始設備製造商),而非來自攻擊者或已損毀。驗證開機程序會建立完整的信任鏈結,從硬體保護的信任根開始,再到系統啟動載入程式、啟動分區和其他已驗證的分區。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Android security features\n\nUse the features described in this section to make the Android devices you\ndevelop as secure as possible.\n\nApplication Sandbox\n-------------------\n\nThe Android platform takes advantage of the Linux user-based protection to\nidentify and isolate app resources. To do this, Android assigns a unique user ID\n(UID) to each Android app and runs it in its own process. Android uses\nthis UID to set up a kernel-level Application Sandbox.\n\nApp signing\n-----------\n\nApp signing allows developers to identify the author of the app\nand to update their app without creating complicated interfaces and\npermissions. Every app that runs on the Android platform must be\nsigned by the developer.\n\nAuthentication\n--------------\n\nAndroid has the concept of *user authenticators* that can unlock the\ndevice and perform other tasks:\n\n- The [Gatekeeper subsystem](/docs/security/features/authentication/gatekeeper) performs device pattern or password authentication in a Trusted Execution Environment (TEE).\n- The optional Weaver component performs pattern or password authentication in a separate secure element.\n- Devices with a fingerprint sensor support the use of enrolled fingerprints.\n- Devices can support face authentication.\n\nAndroid also supports hardware-backed cryptographic keys that can be used only\nif user authentication with one of these mechanisms has occurred.\n\nBiometrics\n----------\n\nAndroid 9 and higher includes a [`BiometricPrompt`\nclass](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt)\nthat app developers can use to integrate biometric authentication into their\napps in a device- and modality-agnostic fashion. Only strong biometrics can\nintegrate with `BiometricPrompt`.\n\nEncryption\n----------\n\nOnce a device is encrypted, all user-created data is automatically encrypted\nbefore committing it to disk and all reads automatically decrypt data before\nreturning it to the calling process. Encryption ensures that even if an\nunauthorized party tries to access the data, they can't read it.\n\nKeystore\n--------\n\nAndroid offers a hardware-backed keystore that provides cryptographic\nfunctionality where the key material is contained within a secure environment.\n[Android Keystore](https://developer.android.com/privacy-and-security/keystore)\nsupports generation and import of both symmetric and asymmetric keys, combined\nwith encryption, decryption, signing, and key agreement primitives.\n\nSecurity-Enhanced Linux\n-----------------------\n\nAs part of the Android security model, Android uses Security-Enhanced Linux\n(SELinux) to enforce mandatory access control (MAC) over all processes, even\nprocesses running with root or superuser privileges (Linux capabilities).\n\nTrusty TEE\n----------\n\nTrusty TEE\n----------\n\n[Trusty](/docs/security/features/trusty) is a secure operating system (OS) that\nprovides a TEE for Android. The Trusty OS runs on the same processor as the\nAndroid OS, but Trusty is isolated from the rest of the system by both hardware\nand software.\n\nVerified Boot\n-------------\n\n[Verified Boot](/docs/security/features/verifiedboot) is designed to ensure that all\nexecuted code comes from a trusted source (usually device OEMs), rather than\nfrom an attacker or corruption. Verified Boot establishes a full chain of trust, starting\nfrom a hardware-protected root of trust to the bootloader, to the boot partition\nand other verified partitions."]]