Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release thay vì aosp-main để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Đối với các thiết bị chạy Android 13 trở lên, Android hỗ trợ phương pháp xác thực Trust on First Use (TOFU) (RFC7435). Phương thức này cho phép người dùng tin tưởng mạng doanh nghiệp (EAP) bằng cách cài đặt CA gốc mà máy chủ sử dụng và đặt tên miền của mạng đó trong một mạng đã lưu. TOFU cho phép thiết bị lấy khoá công khai chưa xác thực khi người dùng kết nối với mạng doanh nghiệp lần đầu tiên và giữ lại khoá đó cho các kết nối tiếp theo.
Thông tin khái quát
So với các mạng cá nhân chỉ yêu cầu mật khẩu, mạng doanh nghiệp sử dụng phương thức xác thực cơ sở hạ tầng khoá công khai (PKI). Phương thức này yêu cầu ứng dụng cài đặt trước chứng chỉ. Trong Android 11 trở xuống, người dùng có thể chọn tuỳ chọn Do not validate (Không xác thực) cho chứng chỉ CA máy chủ trong phần cài đặt mạng, bỏ qua quy trình xác thực chứng chỉ phía máy chủ. Tuy nhiên, để tăng cường tính bảo mật và tuân thủ thông số kỹ thuật WPA R2, Android 12 đã đưa ra yêu cầu đối với mạng doanh nghiệp là phải có quy trình xác thực chứng chỉ máy chủ. Yêu cầu bổ sung này đã tạo ra rào cản cho người dùng vì họ cần cài đặt chứng chỉ CA cho các mạng đó. TOFU cung cấp một cách để người dùng kết nối với mạng doanh nghiệp dựa trên PKI chỉ bằng cách chấp nhận CA gốc của mạng đó.
Hành vi của tính năng
Các thiết bị hỗ trợ TOFU sẽ hiển thị hành vi sau đây khi người dùng kết nối với một mạng doanh nghiệp không có khoá công khai đã xác thực được cài đặt sẵn.
Kết nối với mạng mới thông qua bộ chọn Wi-Fi
Chọn một mạng doanh nghiệp mới trong bộ chọn Wi-Fi.
Thiết bị sẽ hiển thị một hộp thoại (Hình 1) để xác nhận xem mạng có đáng tin cậy hay không.
Nhấn vào Có, kết nối để chấp nhận kết nối mạng hoặc nhấn vào Không, không kết nối để từ chối.
Nếu bạn nhấn vào Có, kết nối, thiết bị sẽ tự động định cấu hình các thông số bảo mật, kết nối với mạng và bật tính năng tự động kết nối cho mạng.
Nếu bạn nhấn vào Không, đừng kết nối, thiết bị sẽ ngắt kết nối với mạng và tắt tính năng tự động kết nối cho mạng đó.
Hình 1. Hộp thoại cho tính năng TOFU
Kết nối với mạng hiện có khi bật tính năng tự động kết nối
Khi kết nối với một mạng doanh nghiệp đã bật tính năng tự động kết nối nhưng không có chứng chỉ CA hợp lệ, thiết bị sẽ tự động kết nối, sau đó hiển thị một thông báo cố định (không thể đóng).
Nhấn vào thông báo đó.
Thiết bị sẽ hiển thị một hộp thoại (Hình 1) để xác nhận xem mạng có đáng tin cậy hay không.
Nhấn vào Có, kết nối để chấp nhận kết nối mạng hoặc nhấn vào Không, không kết nối để từ chối.
Nếu bạn nhấn vào Có, kết nối, thiết bị sẽ tự động định cấu hình các thông số bảo mật, kết nối với mạng và bật tính năng tự động kết nối cho mạng.
Nếu bạn nhấn vào Không, đừng kết nối, thiết bị sẽ ngắt kết nối với mạng và tắt tính năng tự động kết nối cho mạng đó.
Để xác thực việc triển khai TOFU trên thiết bị, hãy sử dụng các kiểm thử sau:
CTS: CtsWifiTestCases
VTS: VtsHalWifiSupplicantStaNetworkTargetTest
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Trust on First Use (TOFU)\n\nFor devices running Android 13 or higher, Android\nsupports the Trust on First Use (TOFU) authentication approach\n([RFC7435](https://datatracker.ietf.org/doc/html/rfc7435.html)),\nwhich lets users trust an enterprise (EAP) network by installing the root CA\nused by the server and setting its domain name in a saved network. TOFU allows\nthe device to obtain an unauthenticated public key when a user first connects\nto an enterprise network and retain the key for subsequent connections.\n\nBackground\n----------\n\nCompared to personal networks that just require a password, enterprise networks\nuse public key infrastructure (PKI) authentication, which requires the client\nto preinstall certificates. In Android 11 or lower, users can select the\n*Do not validate* option for the server CA certificate in the network settings,\nbypassing the validation of the server side certificate. However, to strengthen\nsecurity and comply with the WPA R2 specification, Android 12 introduced a\nrequirement for enterprise networks to have server certificate validation. This\nadditional requirement created a barrier for users as they need to install a CA\ncertificate for such networks. TOFU provides a way for users to connect to a\nPKI-based enterprise network by simply accepting its root CA.\n\nFeature behavior\n----------------\n\nDevices that support TOFU display the following behavior when a user connects\nto an enterprise network that doesn't have an *already-installed*\nauthenticated public key.\n\n### Connect to new network through Wi-Fi picker\n\n1. Select a new enterprise network in Wi-Fi picker.\n\n The device displays a dialog (Figure 1) to confirm whether the\n network is trusted.\n2. Tap **Yes, connect** to accept the network connection, or tap **No, don't\n connect** to decline.\n\n - If you tap **Yes, connect**, the device automatically configures the\n security parameters, connects to the network, and enables autoconnect\n for the network.\n\n | **Note:** Misconfigured networks that use invalid or expired certificates might not allow any security validation by the device. In such cases, the device fails to connect to the network.\n - If you tap **No, don't connect**, the device disconnects from the\n network and disables autoconnect for the network.\n\n **Figure 1.** Dialog for the TOFU feature\n\n### Connect to existing network with autoconnect enabled\n\nWhen connecting to an enterprise network that has autoconnect enabled but\ndoesn't have a valid CA certificate, the device connects automatically, then\ndisplays a sticky (nondismissable) notification.\n\n1. Tap the notification.\n\n The device displays a dialog (Figure 1) to confirm whether the\n network is trusted.\n2. Tap **Yes, connect** to accept the network connection, or tap **No, don't\n connect** to decline.\n\n - If you tap **Yes, connect**, the device automatically configures the\n security parameters, connects to the network, and enables autoconnect\n for the network.\n\n | **Note:** Misconfigured networks that use invalid or expired certificates might not allow any security validation by the device. In such cases, the device fails to connect to the network.\n - If you tap **No, don't connect**, the device disconnects from the\n network and disables autoconnect for the network.\n\nImplementation\n--------------\n\nTo support the TOFU feature, implement the supplicant HALs provided in the\nAndroid Open Source Project (AOSP) at\n[`/hardware/interfaces/wifi/supplicant/aidl/android/hardware/wifi/supplicant`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/wifi/supplicant/aidl/android/hardware/wifi/supplicant).\n\nThe following public APIs are available in Android 13\nfor use by apps:\n\n- [`WifiManager#isTrustOnFirstUseSupported()`](https://developer.android.com/reference/android/net/wifi/WifiManager#isTrustOnFirstUseSupported()): Indicates whether the device supports TOFU.\n- [`WifiEnterpriseConfig#enableTrustOnFirstUse(boolean)`](https://developer.android.com/reference/android/net/wifi/WifiEnterpriseConfig#enableTrustOnFirstUse(boolean)): Enables TOFU.\n- [`WifiEnterpriseConfig#isTrustOnFirstUseEnabled()`](https://developer.android.com/reference/android/net/wifi/WifiEnterpriseConfig#isTrustOnFirstUseEnabled()): Indicates whether TOFU is enabled.\n\nValidation\n----------\n\nTo validate the implementation of TOFU on your device, use the following tests:\n\n- CTS: `CtsWifiTestCases`\n- VTS: `VtsHalWifiSupplicantStaNetworkTargetTest`"]]