From: Tobias Brunner Date: Tue, 30 Sep 2025 14:47:42 +0000 (+0200) Subject: android: Make a certificate alias pre-selectable in managed profiles X-Git-Tag: android-2.6.0^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cde39f4c1ac0cc2e25a1143bca3725bc963eb99f;p=thirdparty%2Fstrongswan.git android: Make a certificate alias pre-selectable in managed profiles This allows associating a pre-installed certificate/key with a VPN profile. For instance, one locally generated on the device via SCEP/ETS by the MDM. It only works if the app is granted access to the certificate/key (alias) by the MDM. For now, users may still select a different certificate if one is available (since this requires the certificate to be installed as user-selectable there might not be). --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/data/ManagedVpnProfile.java b/src/frontends/android/app/src/main/java/org/strongswan/android/data/ManagedVpnProfile.java index 47e85a5ca9..dfe519a23c 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/data/ManagedVpnProfile.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/data/ManagedVpnProfile.java @@ -38,6 +38,7 @@ public class ManagedVpnProfile extends VpnProfile private static final String KEY_REMOTE_REVOCATION_CRL_FLAG = "remote_revocation_crl"; private static final String KEY_REMOTE_REVOCATION_OCSP_FLAG = "remote_revocation_ocsp"; private static final String KEY_REMOTE_REVOCATION_STRICT_FLAG = "remote_revocation_strict"; + private static final String KEY_LOCAL_USER_CERTIFICATE_ALIAS = "user_certificate_alias"; private static final String KEY_LOCAL_RSA_PSS_FLAG = "local_rsa_pss"; private static final String KEY_SPLIT_TUNNELLING_BLOCK_IPV4_FLAG = "split_tunnelling_block_ipv4"; @@ -152,6 +153,10 @@ public class ManagedVpnProfile extends VpnProfile userCertificate = new ManagedUserCertificate(uuid.toString(), userCertificateData, userCertificatePassword); setUserCertificateAlias(userCertificate.getAlias()); } + else + { + setUserCertificateAlias(getString(local, KEY_LOCAL_USER_CERTIFICATE_ALIAS)); + } flags = addPositiveFlag(flags, local, KEY_LOCAL_RSA_PSS_FLAG, VpnProfile.FLAGS_RSA_PSS); return flags; diff --git a/src/frontends/android/app/src/main/res/values-de/strings_managed_configuration.xml b/src/frontends/android/app/src/main/res/values-de/strings_managed_configuration.xml index c7d516011b..c0bdd7f709 100644 --- a/src/frontends/android/app/src/main/res/values-de/strings_managed_configuration.xml +++ b/src/frontends/android/app/src/main/res/values-de/strings_managed_configuration.xml @@ -1,5 +1,6 @@