diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-12-06 17:51:01 -0800 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2011-12-06 17:51:01 -0800 |
commit | f5317a151bef8d93f7a640fe46c6dcde6baa258d (patch) | |
tree | f8984b6c757766a382127d2059f84cc2bac42cac /src/com/android/settings/vpn2/VpnSettings.java | |
parent | 9ef669a65d6ecaabeb5cf1f8d342ae8032f6bfd5 (diff) | |
download | packages_apps_settings-f5317a151bef8d93f7a640fe46c6dcde6baa258d.zip packages_apps_settings-f5317a151bef8d93f7a640fe46c6dcde6baa258d.tar.gz packages_apps_settings-f5317a151bef8d93f7a640fe46c6dcde6baa258d.tar.bz2 |
VpnSettings: add support for server certificates.
Bug: 5714397
Change-Id: I5ce13e244fba554bec31c4935571b09127b9270a
Diffstat (limited to 'src/com/android/settings/vpn2/VpnSettings.java')
-rw-r--r-- | src/com/android/settings/vpn2/VpnSettings.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java index 0197333..655306a 100644 --- a/src/com/android/settings/vpn2/VpnSettings.java +++ b/src/com/android/settings/vpn2/VpnSettings.java @@ -354,6 +354,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements String privateKey = ""; String userCert = ""; String caCert = ""; + String serverCert = ""; if (!profile.ipsecUserCert.isEmpty()) { byte[] value = mKeyStore.get(Credentials.USER_PRIVATE_KEY + profile.ipsecUserCert); privateKey = (value == null) ? null : new String(value, Charsets.UTF_8); @@ -364,7 +365,11 @@ public class VpnSettings extends SettingsPreferenceFragment implements byte[] value = mKeyStore.get(Credentials.CA_CERTIFICATE + profile.ipsecCaCert); caCert = (value == null) ? null : new String(value, Charsets.UTF_8); } - if (privateKey == null || userCert == null || caCert == null) { + if (!profile.ipsecServerCert.isEmpty()) { + byte[] value = mKeyStore.get(Credentials.USER_CERTIFICATE + profile.ipsecServerCert); + serverCert = (value == null) ? null : new String(value, Charsets.UTF_8); + } + if (privateKey == null || userCert == null || caCert == null || serverCert == null) { // TODO: find out a proper way to handle this. Delete these keys? throw new IllegalStateException("Cannot load credentials"); } @@ -380,7 +385,8 @@ public class VpnSettings extends SettingsPreferenceFragment implements break; case VpnProfile.TYPE_L2TP_IPSEC_RSA: racoon = new String[] { - interfaze, profile.server, "udprsa", privateKey, userCert, caCert, "1701", + interfaze, profile.server, "udprsa", privateKey, userCert, + caCert, serverCert, "1701", }; break; case VpnProfile.TYPE_IPSEC_XAUTH_PSK: @@ -391,14 +397,14 @@ public class VpnSettings extends SettingsPreferenceFragment implements break; case VpnProfile.TYPE_IPSEC_XAUTH_RSA: racoon = new String[] { - interfaze, profile.server, "xauthrsa", privateKey, userCert, caCert, - profile.username, profile.password, "", gateway, + interfaze, profile.server, "xauthrsa", privateKey, userCert, + caCert, serverCert, profile.username, profile.password, "", gateway, }; break; case VpnProfile.TYPE_IPSEC_HYBRID_RSA: racoon = new String[] { - interfaze, profile.server, "hybridrsa", caCert, - profile.username, profile.password, "", gateway, + interfaze, profile.server, "hybridrsa", + caCert, serverCert, profile.username, profile.password, "", gateway, }; break; } |