自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
Android 安全功能
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助本部分介绍的功能,您可以让您开发的 Android 设备尽可能地安全无虞。
应用沙盒
Android 平台利用基于用户的 Linux 保护机制识别和隔离应用资源,为此,Android 会为每个 Android 应用分配一个唯一的用户 ID (UID),并在自己的进程中运行。Android 会使用此 UID 设置一个内核级应用沙盒。
应用签名
通过应用签名,开发者可以标识应用创作者并更新其应用,而无需创建复杂的接口和权限。在 Android 平台上运行的每个应用都必须有开发者的签名。
身份验证
Android 采用通过用户身份验证把关的加密密钥机制,该机制需要加密密钥存储区以及服务提供商和用户身份验证程序。
在配有指纹传感器的设备上,用户可以注册一个或多个指纹,并使用这些指纹解锁设备以及执行其他任务。Gatekeeper 子系统会在可信执行环境 (TEE) 中执行设备解锁图案或密码身份验证。
Android 9 及更高版本包含 Android Protected Confirmation,使用户能够正式确认关键交易(如付款)。
生物识别
Android 9 及更高版本包含一个 BiometricPrompt API,应用开发者可以使用该 API 采用与设备和模态无关的方式将生物识别身份验证集成到其应用中。只有极为安全的生物识别技术才能与 BiometricPrompt
集成。
加密
设备经过加密后,所有由用户创建的数据在存入磁盘之前都会自动加密,并且所有读取操作都会在将数据返回给调用进程之前自动解密数据。加密可确保未经授权方在尝试访问相应数据时无法读取数据。
密钥库
Android 提供了一个由硬件支持的密钥库,以提供生成密钥、导入和导出非对称密钥、导入原始对称密钥、使用适当的填充模式进行非对称加密和解密等功能。
安全增强型 Linux
作为 Android 安全模型的一部分,Android 使用安全增强型 Linux (SELinux) 对所有进程强制执行强制访问控制 (MAC),甚至包括以 root 或超级用户权限运行的进程(Linux 功能)。
Trusty 可信执行环境 (TEE)
Trusty 是一种安全的操作系统 (OS),可为 Android 提供可信执行环境 (TEE)。Trusty OS 与 Android OS 在同一处理器上运行,但 Trusty 通过硬件和软件与系统的其余组件隔离开来。
启动时验证
启动时验证会尽力确保所有已执行代码均来自可信来源(通常是设备的 OEM),以防受到攻击或损坏。它建立了一个完整的信任链,该信任链从硬件保护的信任根开始,延伸到引导加载程序,再延伸到启动分区以及其他已验证分区。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","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"]],["最后更新时间 (UTC):2025-03-26。"],[],[],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."]]