首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接到Android 10+上的企业10+ wifi

连接到Android 10+上的企业10+ wifi
EN

Stack Overflow用户
提问于 2022-04-07 19:49:13
回答 1查看 248关注 0票数 2

我正在尝试用Kotlin本地代码创建一个企业WPA2连接。我使用的WifiSuggestion API,因为我希望wifi保持连接,即使在应用程序关闭。以下是实现:

代码语言:javascript
复制
            val enterpriseConfig = WifiEnterpriseConfig()

            enterpriseConfig.identity = uid
            enterpriseConfig.password = uPassword
            enterpriseConfig.eapMethod = WifiEnterpriseConfig.Eap.PEAP
            enterpriseConfig.phase2Method = WifiEnterpriseConfig.Phase2.MSCHAPV2

            val eduroamSuggestion = WifiNetworkSuggestion.Builder()
                    .setSsid(wifiSSID)
                    .setWpa2EnterpriseConfig(enterpriseConfig)
                    .build()

我的java.lang.IllegalArgumentException:企业配置是不安全的错误,如下面的堆栈跟踪所示

代码语言:javascript
复制
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612): Failed to handle method call
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612): java.lang.IllegalArgumentException: Enterprise configuration is insecure
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at android.net.wifi.WifiNetworkSuggestion$Builder.setWpa2EnterpriseConfig(WifiNetworkSuggestion.java:271)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at br.uff.uffmobileplus.WifiHandler$Companion.assembleConnection(WifiHandler.kt:171)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at br.uff.uffmobileplus.MainActivity.configureFlutterEngine$lambda-0(MainActivity.kt:59)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at br.uff.uffmobileplus.MainActivity.lambda$1vo85UVy1PXOPIbKlJk84gSeKS4(Unknown Source:0)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at br.uff.uffmobileplus.-$$Lambda$MainActivity$1vo85UVy1PXOPIbKlJk84gSeKS4.onMethodCall(Unknown Source:2)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$AIEPqY6mWzaNK15HekX9bftoAXs.run(Unknown Source:12)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at android.os.Looper.loop(Looper.java:236)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at android.app.ActivityThread.main(ActivityThread.java:8037)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
E/MethodChannel#br.uff.uffmobileplus/uffmobile_channel(11612):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-05 12:23:48

Android源代码掌握着答案。当出现错误消息 ()计算为true时,您的WifiEnterpriseConfig.isInsecure。

对于你的案子,你

  • 必须添加enterpriseConfig.DomainSuffixMatchenterpriseConfig.AltSubjectMatch,并且
  • 根据环境的不同,我相信您可能必须通过enterpriseConfig.CaCertificate添加RADIUS服务器的CA证书。

对于用户名/密码身份验证,重要的是验证RADIUS服务器的证书。否则,客户端将向使用SSID "eduroam“设置WiFi的攻击者发送凭据。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71788136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档