public function decrypt(string $value, string $key = null): ?string
    {
        if ($key === null) {
            $key = $this->getDefaultKey();
        }
        $ivLength = openssl_cipher_iv_length($this->cipher);
        $iv = substr($value, 0, $ivLength);
        $result = @openssl_decrypt(substr($value, $ivLength), $this->cipher, $key, 0, $iv);
        if ($result === false) {
            return null;
        }
        return $result;
    }