Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Sqlite3 ChangePassword() failed.
Sqlite3 ChangePassword() failed. [message #59957] Mon, 19 June 2023 13:35 Go to next message
zouql is currently offline  zouql
Messages: 15
Registered: December 2020
Location: China
Promising Member
Helo
when I test the sqlite3 at reference/SQL_sqlite3, I found a question about
ChangePassword() function.

Step 1: Use sqlite3.Open(file, "password") create an encrypted db file.

Step 2: Use sqlite3.ChangePassword("password_changed") change the file's password.

Step 3: Use sqlite3.Open(file, "password_changed") to open the db again.

The problem occurred in th third step, when I opened the db file with changed password, that failed about "ERROR file is not a database(26)".

I am not familiar with encryption. Can anyone test and answer this question?

Thanks.

1. create a encrypted file.
index.php?t=getfile&id=6818&private=0



2. change password

index.php?t=getfile&id=6819&private=0

3. use newpassword open failed.
index.php?t=getfile&id=6820&private=0
  • Attachment: sqlite_1.jpg
    (Size: 277.04KB, Downloaded 190 times)
  • Attachment: sqlite_2.jpg
    (Size: 269.02KB, Downloaded 180 times)
  • Attachment: sqlite_3.jpg
    (Size: 303.99KB, Downloaded 193 times)

[Updated on: Mon, 19 June 2023 13:38]

Report message to a moderator

Re: Sqlite3 ChangePassword() failed. [message #59958 is a reply to message #59957] Mon, 19 June 2023 15:35 Go to previous messageGo to next message
coolman is currently offline  coolman
Messages: 117
Registered: April 2006
Location: Czech Republic
Experienced Member
Hi,

From the comment in the int Sqlite3Session::SetDBEncryption(int cipher)
	// "default:cipher" => use SQLCipher during the entire lifetime of database instance
	// CIPHER_CHAHA2020_SQLEET settings are backward compatible with the previous sqleet implementation in the U++
	// Note: It is not recommended to use legacy mode for encrypting new databases. It is supported for compatibility
	// reasons only, so that databases that were encrypted in legacy mode can be accessed.


So, if you will use cipher Upp::Sqlite3Session::CIPHER_CHAHA2020_DEFAULT, there is no problem (legacy is not set).

if(!sqlite3.Open(ConfigFile("simple.db"), "test", Upp::Sqlite3Session::CIPHER_CHAHA2020_DEFAULT)) {
...

sqlite3.ChangePassword("test_new", Upp::Sqlite3Session::CIPHER_CHAHA2020_DEFAULT);


BR, Radek
icon14.gif  Re: Sqlite3 ChangePassword() failed. [message #59959 is a reply to message #59957] Tue, 20 June 2023 01:01 Go to previous message
zouql is currently offline  zouql
Messages: 15
Registered: December 2020
Location: China
Promising Member
Hi Radekļ¼š

Thinks a lot!
Previous Topic: Transfer compress data
Next Topic: Bitwise and, or, xor in sql
Goto Forum:
  


Current Time: Fri Nov 01 00:53:45 CET 2024

Total time taken to generate the page: 0.02081 seconds