diff options
author | Sohani Rao <sohanirao@google.com> | 2017-11-29 15:46:00 -0800 |
---|---|---|
committer | Ecco Park <eccopark@google.com> | 2018-02-09 00:34:03 +0000 |
commit | 10cae9629e422c2c21f6167ef9c59a2c446d0aa3 (patch) | |
tree | c7ab8ec914c39682e29b5c73166eb6c1fa34efd5 /service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java | |
parent | 9313a7c2e5445c6b86ed13f84287abde68db311b (diff) | |
download | android_frameworks_opt_net_wifi-10cae9629e422c2c21f6167ef9c59a2c446d0aa3.tar.gz android_frameworks_opt_net_wifi-10cae9629e422c2c21f6167ef9c59a2c446d0aa3.tar.bz2 android_frameworks_opt_net_wifi-10cae9629e422c2c21f6167ef9c59a2c446d0aa3.zip |
[Wifi][Passpoint] WFA KeyStore and cert validation
Create a WFA KeyStore containing root CA certs and verify the OSU server
certificates against it. Also get the OSU certificate matching the FQDN
of the Passpoint network provider for verfiying the provider.
Bug: 70692526
Test: Integration test and existing Unit tests
Change-Id: Icf9382a7ded0f0b3049a8fa8bb8461dd382cc520
Diffstat (limited to 'service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java')
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java b/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java index 6cf3a7edf..ae90958af 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java @@ -19,11 +19,17 @@ package com.android.server.wifi.hotspot2; import android.content.Context; import android.net.wifi.hotspot2.PasspointConfiguration; +import com.android.org.conscrypt.TrustManagerImpl; import com.android.server.wifi.Clock; import com.android.server.wifi.SIMAccessor; import com.android.server.wifi.WifiKeyStore; import com.android.server.wifi.WifiNative; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; + +import javax.net.ssl.SSLContext; + /** * Factory class for creating Passpoint related objects. Useful for mocking object creations * in the unit tests. @@ -103,11 +109,8 @@ public class PasspointObjectFactory{ * @param context * @return {@link PasspointProvisioner} */ - public PasspointProvisioner makePasspointProvisioner(Context context, - OsuNetworkConnection osuNetworkConnection, - OsuServerConnection osuServerConnection) { - return new PasspointProvisioner(context, osuNetworkConnection, - osuServerConnection); + public PasspointProvisioner makePasspointProvisioner(Context context) { + return new PasspointProvisioner(context, this); } /** @@ -128,4 +131,40 @@ public class PasspointObjectFactory{ public OsuServerConnection makeOsuServerConnection() { return new OsuServerConnection(); } + + + /** + * Create an instance of {@link WfaKeyStore}. + * + * @return WfaKeyStore {@link WfaKeyStore} + */ + public WfaKeyStore makeWfaKeyStore() { + return new WfaKeyStore(); + } + + /** + * Create an instance of {@link SSLContext}. + * + * @param tlsVersion String indicate TLS version + * @return SSLContext an instance, corresponding to the TLS version + */ + public SSLContext getSSLContext(String tlsVersion) { + SSLContext tlsContext = null; + try { + tlsContext = SSLContext.getInstance(tlsVersion); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return tlsContext; + } + + /** + * Create an instance of {@link TrustManagerImpl}. + * + * @param ks KeyStore used to get root certs + * @return TrustManagerImpl an instance for delegating root cert validation + */ + public TrustManagerImpl getTrustManagerImpl(KeyStore ks) { + return new TrustManagerImpl(ks); + } } |