Skip to content

ReKey() function makes no use of cipher provided #75

@ghost

Description

The function ReKey() does not make use of the provided cipher whether it was provided or not, this causes the Open() function to fail to open a database if the cipher was used for a database that was encrypted using ReKey().

Here is the code snippet from wxsqlite.cpp:

void wxSQLite3Database::ReKey(const wxSQLite3Cipher& cipher, const wxMemoryBuffer& newKey)
{
#if WXSQLITE3_HAVE_CODEC
  CheckDatabase();
  int rc = sqlite3_rekey(m_db->m_db, newKey.GetData(), (int) newKey.GetDataLen());
  if (rc != SQLITE_OK)
  {
    const char* localError = sqlite3_errmsg(m_db->m_db);
    throw wxSQLite3Exception(rc, wxString::FromUTF8(localError));
  }
#else
  wxUnusedVar(newKey);
  throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_NOCODEC);
#endif
}

The cipher parameter was not mentioned in the whole function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions