Quite often an extension needs a storage to keep its data - for example, user settings or secret keys. As a developer, you have a variety of ways to store data, like files or databases. Additionally, Plesk provides the mechanism of Key-Value Storage to simplify storing and accessing data.

Encrypting Data

If you need to store arbitrary data in encrypted form, use the following methods of the pm_Crypt class:

The following code encrypts the value from your variable:

$password = "secret password";
$encryptedPassword = pm_Crypt::encrypt($password);
// store $encryptedPassword to your own storage