Bug 410688 - Password problem with database SQLCipher
Summary: Password problem with database SQLCipher
Status: CONFIRMED
Alias: None
Product: kmymoney
Classification: Applications
Component: database (show other bugs)
Version: 5.0.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-07 08:55 UTC by Fabiano Caruana
Modified: 2019-08-09 06:22 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Passwort - Fehler (40.00 KB, image/png)
2019-08-07 08:55 UTC, Fabiano Caruana
Details
Packed Databases (326.34 KB, application/zip)
2019-08-08 13:31 UTC, Fabiano Caruana
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabiano Caruana 2019-08-07 08:55:31 UTC
Created attachment 121994 [details]
Passwort - Fehler

Password problem with database SQLCipher.

KMyMoney 5.0.5 (Repository KDE: Extra)
OpenSuse Leap 15.1 (as of 07.08.2019)
Tumbleweed (as of 07.08.2019)

I can not open the same SQLite database with Leap 15.1 and Tumbleweed (copied file, no multiple access).
Created SQLite database in Leap 15.1 can not be opened in Tumbleweed, and vice versa.
Created in Tumbleweed, this can not be opened in Leap 15.1.
In each case, another password window appears for repeated entry and then the error message (see screenshots).

greetings
Udo Lubich


SOFTWARE/OS VERSIONS
OpenSuse Leap 15.1 / Tumbleweed

Linux/KDE Plasma: 

KDE Plasma Version: 5.12.8
KDE Frameworks Version: 5.55.0
Qt Version: 5.9.7

ADDITIONAL INFORMATION
Comment 1 Jack 2019-08-08 00:09:36 UTC
Can you try opening the file (on either system) with a command line tool, to see if you can get any more detailed error messages?  I assume you can repeatedly open each file on the system where it was created?
Comment 2 Thomas Baumgart 2019-08-08 10:48:21 UTC
Can you provide the following please:

a) sample DB file created with each version (incl. password)
b) KF5 version for each environment
c) Qt version for each environment

I assume, both KMyMoney version are 5.0.5. If not, please let us know the exact KMyMoney version number.
Comment 3 Fabiano Caruana 2019-08-08 13:31:24 UTC
Created attachment 122010 [details]
Packed Databases
Comment 4 Fabiano Caruana 2019-08-08 13:33:17 UTC
Hi Thomas,

Attached the desired databases as a zip file.
The password is "TestSQL" for everyone.
Following my tested environments:

Database: Leap15-1.sqlite
KMyMoney 5.0.5 (Repository KDE: Extra)
- Leap 15.1 (as of 08.08.2019)
- KDE-Plasma: 5.12.8
- KDE-Frameworks: 5.55.0
- QT-Version: 5.9.4

Database: Tumbleweed.sqlite
KMyMoney 5.0.5 (Repository KDE: Extra)
- Tumbleweed (as of 08.08.2019)
- KDE-Plasma: 5.16.4
- KDE-Frameworks: 5.60.0
- QT-Version: 5.13.0

Database: Leap15-0.sqlite
KMyMoney 5.0.80git144~e72565850 vom 06.08.2019
- Leap 15.0 (Stand: 08.08.2019)
- KDE-Plasma: 5.12.8
- KDE-Frameworks: 5.45.0
- QT-Version: 5.9.4

Here is a list of which database could be opened:

                        |           Database                                   |
                        |Leap15-0.sqlite | Leap15-1.sqlite | Tumbleweed.sqlite |
--------------------------------------------------------------------------------
OpenSuse Leap 15.0	|  yes           |  yes            |  no               |
--------------------------------------------------------------------------------
OpenSuse Leap 15.1	|  yes           |  yes            |  no               |
--------------------------------------------------------------------------------
OpenSuse Tumbleweed	|  no            |  no             |  yes              |
--------------------------------------------------------------------------------

Have a lot of fun... :-)

greetings
Udo
Comment 5 Thomas Baumgart 2019-08-08 14:32:19 UTC
Thanks. Why do I have the impression that the Qt version could be a candidate for the problem you encounter? I could be wrong, though.
Comment 6 Jack 2019-08-08 14:49:26 UTC
My initial attempts to open any of them with either sqlite or sqlcipher all fail.  None of them prompt for a password, so I'm not sure if I have a configuration problem or if there is a problem with the zip file.  On Linux, the "file" command just says all three are "data" but I don't know what a sqlcipher file should look like.
Comment 7 Jack 2019-08-08 16:20:27 UTC
My earlier tries were on my laptop.  I've now also tried on my desktop, and am still unable to open any of the .sqlite files - most attempts say "files is not a database."  Can anyone else open any of them, or confirm they are valid files?
Comment 8 Fabiano Caruana 2019-08-08 16:37:02 UTC
Hi Jack,
Hi Thomas,

also with me he says to all "data".
Even if I unpacked the files, I can open this normally (with password query).
Should I re-upload these files individually?

Now just a thought. Since then I have used the extension '.sqlite' and now also for the cipher files. Should I use another extension?
But everything works for me, but not on the different systems.

Thanks to you
Udo
Comment 9 Jack 2019-08-08 17:32:40 UTC
Hi Fabiano,

Please confirm the password you put in Comment #4 is correct, and that your file sizes match what I got from the zip file.  If not, then try attaching each file separately.
-rw-r--r-- 1 jack users  64512 Aug  8  2019 Leap15-0.sqlite
-rw-r--r-- 1 jack users  64512 Aug  8  2019 Leap15-1.sqlite
-rw-r--r-- 1 jack users 204800 Aug  8  2019 Tumbleweed.sqlite

Thanks.
Comment 10 Fabiano Caruana 2019-08-08 18:03:23 UTC
Hi Jack,

confirm password in Comment 4 (case sensitive)

confirm the values of the files
-rw-r--r--  1 xwy100 users  64512  8. Aug 18:12 Leap15-0.sqlite
-rw-r--r--  1 xwy100 users  64512  8. Aug 18:13 Leap15-1.sqlite
-rw-r--r--  1 xwy100 users 204800  8. Aug 14:12 Tumbleweed.sqlite

greetings
Udo
Comment 11 Jack 2019-08-08 18:25:18 UTC
What version of sqlcipher do you have on each PC?
Comment 12 Fabiano Caruana 2019-08-08 18:41:21 UTC
Hi Jack,

Leap 15.1: libsqlcipher-3_20_1-0 Version: 3.4.2-lp151.2.4
Leap 15.0: libsqlcipher-3_20_1-0 Version: 3.4.2-lp150.1.1
Tumbleweed: libsqlcipher-3_27_2-0 Version: 4.1.0-1.4 (!!!)

I think, there probably should be the problem ...

greetings
Udo
Comment 13 Jack 2019-08-08 19:30:01 UTC
Yes, I'm pretty sure that is it.  There is a way to "upgrade" a sqlcipher 3 database to sqlcipher 4 (https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283) but then you may not be able to open it on a machine with sqlcipher 3.  I'm finally figuring out some of the compile issues that were causing me additional problems, and I will shortly have two pc's one with each version of sqlcipher, so I'll be able to do more testing in the next day or so.  I'll update more when I have more information.
Comment 14 Jack 2019-08-08 20:02:03 UTC
OK, I can finally confirm this.  If KMyMoney is built with verions 3 or 4 of sqlcipher, it can only open database files created with that same version.  The one exception is that a version 3 sqlcipher file can be converted to the version 4 format (see link in previous comment).  Note that even with command line sqlcipher version 4, until you convert the file, it cannot read it.

I suspect it would be possible for KMyMoney built against version 4 sqlcipher to to the conversion programmatically, but that's probably not a good idea, as it would have no way to be sure that it couldn't open a file for that reason, as opposed to either having the wrong password or it simply not being a valid file.

Actually, reading further into that link above, it IS possible for a program compiled with sqlcipher 4 to request the current database be treated as version 3.  I suppose it is also possible for KMM to apply the version upgrade process, but I am NOT sure how it can tell if that is the right thing to do, other than by confirming it can't open the database with version 4 but can open it as version 3.  

This is going to take some thinking, to decide the best approach for KMyMoney.
However, at least the problem is now understood.
Comment 15 Fabiano Caruana 2019-08-09 06:22:54 UTC
Hi Jack,

Thank you for your effort and the detailed information.
I'll take a closer look at SQL-Cipher, also with regard to possible further use cases.

Thanks again and good luck at work.

greetings
Udo