自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
IPsec/IKEv2 程式庫
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
IPsec/IKEv2 程式庫模組提供一種機制,可為新舊 Android 功能 (例如互通無線區域網路 (IWLAN) 和 VPN) 協商安全性參數 (金鑰、演算法、通道設定)。這個模組可更新,也就是說,它可以在正常的 Android 發布週期之外接收功能更新。
IPsec/IKEv2 程式庫模組具備下列優點:
支援 IMS、IWLAN 和現代化 VPN。IP Multimedia Subsystem (IMS) 和 IWLAN 需要 IKEv2 來安全可靠地完成金鑰交換。在 Android 11 中,IPsec/IKEv2 程式庫模組的 IKEv2 協商資料庫是平台對 IKEv2 用戶端的預設實作方式,可支援初始建立、定期重新產生金鑰、偵測死節點和移交。這個模組還可讓您淘汰並取代以 racoon 為基礎的 IKEv1 VPN 程式庫,該程式庫在 Android 10 以下版本中用於預設內建的 VPN 用戶端。
生態系統一致性。使用 IPsec/IKEv2 協商程式庫做為平台的預設程式庫,可促進生態系統的一致性、減少對封閉原始碼實作的依賴,並改善可維護性和可更新性。只要在 Android 的 IPsec API 上實作用戶端專用功能,就能發揮 Linux IPsec 支援的強大功能,而不需要 IKEv2 守護程序所需的權限提升功能。IKEv2 程式庫是以 Java 編寫,可避免在 C 或 C++ 實作中發現的安全性問題。
快速修正安全性和互通性問題。IPsec/IKEv2 是安全性關鍵程式碼,可支援 VPN 保護使用者資料。許多用戶端和伺服器實作 IKEv2 通訊協定的做法略有不同,因此 IKEv2 程式庫和其他 IKEv2 伺服器之間可能會發生互通性問題。模組更新功能可讓 Android 團隊迅速回應安全漏洞,並快速修正互通性錯誤,同時盡量減少生態系統合作夥伴的工作量。
模組邊界
IPsec/IKEv2 程式庫模組位於 packages/modules/IPsec
中。
IPsec/IKEv2 程式庫模組 (com.android.ipsec
) 採用 APEX 格式,適用於搭載 Android 11 以上版本的裝置。
自訂
IPsec/IKEv2 程式庫模組不支援自訂。
測試
Android Compatibility Test Suite (CTS) 會在每個模組版本上執行一套完整的 CTS 測試,驗證 IPsec/IKEv2 程式庫模組的功能。您也可以使用 atest FrameworksIkeTests
指令執行 IPsec/IKEv2 程式庫模組單元測試。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# IPsec/IKEv2 Library\n\nThe IPsec/IKEv2 Library module provides a mechanism for negotiating security\nparameters (keys, algorithms, tunnel configurations) for new and existing\nAndroid features such as Interworking Wireless LAN (IWLAN) and VPNs. This module\nis updatable, meaning it can receive updates to functionality outside of the\nnormal Android release cycle.\n\nThe IPsec/IKEv2 Library module provides the following benefits.\n\n- **Support for IMS, IWLAN, and modernized VPNs.** IP Multimedia Subsystem (IMS)\n and IWLAN require IKEv2 to complete key exchanges securely and reliably. In\n Android 11, the IPsec/IKEv2 Library module's IKEv2\n negotiation library is the platform's default implementation of an IKEv2\n client, supporting initial establishment, periodic re-key, dead peer\n detection, and handoff. The module also enables deprecation and replacement of\n the racoon-based IKEv1 VPN library used as the default built-in VPN client in\n Android 10 and lower.\n\n- **Ecosystem consistency.** Using the IPsec/IKEv2 negotiation library as the\n platform's default library encourages ecosystem-wide consistency, reduces\n dependencies on closed source implementations, and improves maintainability\n and updatability. Having a client-only implementation that works on top of\n Android's IPsec API unlocks the power of Linux IPsec support without requiring\n the elevated privileges needed by an IKEv2 daemon. The IKEv2 library is\n written in Java to avoid security issues found in C or C++ implementations.\n\n- **Quick fixes for security and interoperability issues.** IPsec/IKEv2 is\n security-critical code that supports VPNs in securing user data. Many clients\n and servers implement IKEv2 protocol slightly differently, resulting in\n potential interoperability issues between the IKEv2 library and other IKEv2\n servers. Module updatability allows the Android team to respond to security\n vulnerabilities quickly and to fix interoperability bugs quickly while\n minimizing work for ecosystem partners.\n\nModule boundary\n---------------\n\nThe IPsec/IKEv2 Library module is in `packages/modules/IPsec`.\n\nModule format\n-------------\n\nThe IPsec/IKEv2 Library module (`com.android.ipsec`) is in\n[APEX](/docs/core/ota/apex) format and is available for devices\nrunning Android 11 or higher.\n\nCustomization\n-------------\n\nThe IPsec/IKEv2 library module doesn't support customization.\n\nTesting\n-------\n\nThe Android Compatibility Test Suite (CTS) verifies the IPsec/IKEv2\nlibrary module's functionality by running a comprehensive set of CTS\ntests on every module release. You can also run IPsec/IKEv2 Library module unit\ntests using the command `atest FrameworksIkeTests`."]]