Forum Discussion

Icehong's avatar
Icehong
Level 1.5: Cupcake
14 days ago

"Use System Certificates" with WifiEnterpriseConfig in Android

I would like to configure an Enterprise WiFi network for the user of my app.

When I manually configure the network via the settings app, I choose "Use System Certificates" as CA certificate and set the domain to "".

How can I set this option using WifiEnterpriseConfig?   Got "Enterprise configuration mandates server certificate but validation is not enabled." error without specify a list of X.509 certificates.

val suggestions = ArrayList<WifiNetworkSuggestion>()
// WPA2 configuration
val wificonfig = WifiEnterpriseConfig();
wificonfig.eapMethod = WifiEnterpriseConfig.Eap.PEAP
wificonfig.phase2Method = WifiEnterpriseConfig.Phase2.MSCHAPV2
//wificonfig.caCertificates = ??
wificonfig.identity = binding.txtUserid.text.toString()
wificonfig.password = binding.txtPassword.text.toString()
wificonfig.domainSuffixMatch = "test.com"

try {
	suggestions.add(
		WifiNetworkSuggestion.Builder()
			.setSsid("test")
			.setWpa2EnterpriseConfig(wificonfig)
			.setMacRandomizationSetting(RANDOMIZATION_PERSISTENT)
			.build()
	)
} catch (e: IllegalArgumentException) {
	showTip(e.message)
}

 

No RepliesBe the first to reply