Populate ipsecSecret field in VpnProfile

This commit fixes IKEv2 RSA VPN could not be an always-on VPN
issue to populate ipsecSecret field from "IPsec user certificate".

Fields ipsecUserCert and ipsecSecret are required for a valid
VpnProfile. The ipsecSecret field in VpnProfile should be
populated from "IPsec user certificate" field. It's the matching
private key.

Bug: 263610164
Bug: 230727391
Test: Verify if IKEv2 RSA VPN can setup successfully and set as
      as always on VPN
Change-Id: I605b35fff9e399ee7b82d8441137984992ab2907
This commit is contained in:
chiachangwang
2023-04-13 07:47:53 +00:00
parent 60d9be5a0a
commit 02156d600d

View File

@@ -653,10 +653,14 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
profile.ipsecSecret = mIpsecSecret.getText().toString();
break;
case VpnProfile.TYPE_IKEV2_IPSEC_RSA:
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
profile.ipsecSecret = (String) mIpsecUserCert.getSelectedItem();
}
// fall through
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
profile.l2tpSecret = mL2tpSecret.getText().toString();
// fall through
case VpnProfile.TYPE_IKEV2_IPSEC_RSA: // fall through
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
profile.ipsecUserCert = (String) mIpsecUserCert.getSelectedItem();