public static function encrypt(string $data, string $key): string
    {
        $method = Configuration::getSecurityConfiguration('encryption_algorithm');
        $initializationVector = self::randomBytes(openssl_cipher_iv_length($method));
        $cipher = openssl_encrypt($data, $method, $key, 0, $initializationVector);
        return base64_encode($initializationVector) . ':' . base64_encode($cipher);
    }