-1

I was unable to find any information about this behavior online, so any help will be much appreciated.

When using the following code:

//create file with encryption key "test1"
$tempDB = new \SQLite3("temp.db", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, "test1");

//attempt to open the same file using key "test2"
$tempDB = new \SQLite3("temp.db", SQLITE3_OPEN_READWRITE, "test2"); 

var_dump($tempDB->lastErrorCode()); //int(0)  : no error?

Is this the expected behavior? If so, how can I check whether or not a key is correct for a given SQLite3 file?

vbnm
  • 83
  • 6

1 Answers1

0

Yeah, I'm an idiot. After skimming through the manual I assumed that encryption was a module that PHP+SQLite ships with or which you can just easily install and use.

Turns out that's not the case. You have to pay USD 2000 in order to use this module. Ugh.

My code was just ignoring the parameter as per this:

An optional encryption key used when encrypting and decrypting an SQLite database. If the SQLite encryption module is not installed, this parameter will have no effect.

vbnm
  • 83
  • 6