openvpn: improve the cipher parsing

It had verbose text in it.  Sort better while here.
This commit is contained in:
Franco Fichtner 2021-07-30 13:46:48 +02:00
parent c5c622fd77
commit 00062ae8f8

View File

@ -271,13 +271,13 @@ function openvpn_get_cipherlist()
$ciphers = array();
exec('/usr/local/sbin/openvpn --show-ciphers', $lines);
foreach ($lines as $line) {
if (strstr($line, '(') !== false) {
if (strstr($line, ' (') !== false) {
$cipher = explode(' ', $line)[0];
$ciphers[$cipher] = $line;
}
}
ksort($ciphers);
$ciphers["none"] = gettext("None (No Encryption)");
ksort($ciphers, SORT_STRING | SORT_FLAG_CASE);
$ciphers['none'] = gettext('None (No Encryption)');
return $ciphers;
}