public function encrypt($value, string $key, bool $base64 = false): string
    {
        $ret = $this->encryptBinary(serialize($value), $key);
        return ($base64) ? base64_encode($ret) : $ret;
    }