|
@@ 331-339 (lines=9) @@
|
| 328 |
|
* @param array $options mount options |
| 329 |
|
* @return array updated options |
| 330 |
|
*/ |
| 331 |
|
public static function encryptPasswords($options) { |
| 332 |
|
if (isset($options['password'])) { |
| 333 |
|
$options['password_encrypted'] = self::encryptPassword($options['password']); |
| 334 |
|
// do not unset the password, we want to keep the keys order |
| 335 |
|
// on load... because that's how the UI currently works |
| 336 |
|
$options['password'] = ''; |
| 337 |
|
} |
| 338 |
|
return $options; |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
/** |
| 342 |
|
* Decrypt passwords in the given config options |
|
@@ 347-354 (lines=8) @@
|
| 344 |
|
* @param array $options mount options |
| 345 |
|
* @return array updated options |
| 346 |
|
*/ |
| 347 |
|
public static function decryptPasswords($options) { |
| 348 |
|
// note: legacy options might still have the unencrypted password in the "password" field |
| 349 |
|
if (isset($options['password_encrypted'])) { |
| 350 |
|
$options['password'] = self::decryptPassword($options['password_encrypted']); |
| 351 |
|
unset($options['password_encrypted']); |
| 352 |
|
} |
| 353 |
|
return $options; |
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
/** |
| 357 |
|
* Encrypt a single password |