KeePass style database sync on Android

2014-05-30
2014-10-08
  • Kyle Altendorf
    Kyle Altendorf
    2014-05-30

    While I find lots of talk about 'syncing' a KeePass database from Android it seems that what they always mean is simply copying the file into the cloud. This is in contrast to how KeePass itself uses the word synchronize to mean merging two copies of a database so that all changes from each file are present in both. Is anyone here aware of any ability to do a real sync (not a file copy) on Android?

    Thanks for any pointers. I am just starting to try and setup usage of KeePass as an upgrade (hopefully) from my encrypted FreeMind map.

     
  • wellread1
    wellread1
    2014-05-31

    As far as I know there are no android apps that perform a KeePass sync. However if you use the recommended sync trigger on the Windows side, then file collisions that originate from changes made on the KeePass side are unimportant because the changes are preserved in a local working database copy and ultimately will be incorporated into the shared cloud database in a future KeePass sync.

    On the other hand, file collisions originating from changes made on the android side can end up in a conflicted copy. These will not be incorporated into the shared database automatically. However, you can incorporate them simply by performing a manual KeePass sync on the conflicted copy.

    File collisions are not an inevitable consequence of making a change to a database. They occur when "simultaneous" changes made at databases located at different end nodes collide at the cloud storage server. If you make changes rarely on the android side, then android side collisions will be rare. If you follow-up android side changes by verifying that they are incorporated into the shared database copy, and sync the "conflicted" copies when collisions occur, the problem is relatively minor.

     
    Last edit: wellread1 2014-05-31
  • Kyle Altendorf
    Kyle Altendorf
    2014-05-31

    I agree that with a little care the issue can be avoided. I was just hoping that since the code was already written that it would have been included in apps at both ends... ah well, thanks for the response.

     
  • Paul
    Paul
    2014-05-31

    The code for Android is completely different from the Windows version, more importantly the Android version is not written by the KeePass developer. Adding sync to the Android version is not a simple task, but I'm sure the developer would like to add it.

    cheers, Paul

     
  • Keepass2Android does provide the syncing mechanism from Keepass 2 since quite a while. If you can use one of the built-in file storage options (Dropbox/GDrive/Onedrive/HTTPS/FTP/SFTP) this can be applied. (It can not be used if you use Dropsync or any other external tool for copying the database files of course.)

    For KP2A, Paul's statement is not entirely correct. I'm using quite a fair amount of original Keepass 2 code (including the synchronization stuff).

    (Disclaimer: I'm the KP2A author.)

     
  • Paul
    Paul
    2014-06-13

    Philipp, thanks for the clarification. We can now update our sync recommendations.
    Does KP2A support triggers?

    cheers, Paul

     
  • wellread1
    wellread1
    2014-06-13

    Excellent! It is good to know that the 'Keepas2Android synchronization' performs object based synchronization of the database file contents.

    One characteristic of the KeePass synchronization is that the Target database file can (and usually is) different than the Source database file. The Source & Target need to be different to merge data (above the object level) in databases containing different data. It also requires a history so that collisions at the object level are not lost. I don't see a way to define the Target database to be different than the Source in Keepass2Android or a way to access a history.

    This Sourcefile-different-than-Targetfile configuration is actually important to eliminate data loss caused by dropbox file collisions on the Android device side. Such collisions can still occur after the user closes the database after synchronizing (e.g. if the android device is detached from a network when changes are made on the Android device, but others changes are made to the database at a different end-node while the android device is still detached).

     
    Last edit: wellread1 2014-06-13
  • wellread1
    wellread1
    2014-06-14

    It seems that KeePass2Android synchronization behaves correctly. Apparently I had the app misconfigured. While I am not entirely sure what was wrong because I have been unable to reproduce the behavior I originally observed, it was probably related to using the Dropbox sync app rather than accessing Dropbox via the Keepass2Droid App.

    The Dropbox option built in to KeePass2Droid appears to access the server copy of the database directly. If the Android device is connected to the internet, KeePass2Droid can synchronize directly with the server database file which avoids Android side data loss. If internet connectivity is lost, access to the dropbox server based KeePass database is lost unless the Keepass2Droid 'cache' option is on (on by default) in which case the data is stored in the local 'cached' database. When internet connectivity is restored, Keepass2Droid can synchronize changes made to the 'cached' file directly with the server database file again avoiding Android side data loss.

    When collisions occur at the entry object level, history entries are correctly created.

    Very nice Philipp!

     
    Last edit: wellread1 2014-06-14
  • JC Sullivan
    JC Sullivan
    2014-10-08

    I had originally started using Password Coral many years ago and switched to Keepass a few years back. It then became available as a Portable app. I stuck with it because it was convenient. In the meanwhile i've acquired a tablet and a smart phone to go along with the netbook. All the while I have been making a copy of the dB and then opening it on the device. It has now become inconvenient and today discovered keepass2android.

    The following couple of questions come to mind however.

    How can you sync the v1.27 dB on windows with the keepass2android dB I've placed on google drive. Surely they can be merged and I'm missing something!

    From with keepass2android app menu one can tap on sync databases but databases are being synced? It is not obvious to me.

    And finally, is there a way 2 or 3 databases can be cleaned of duplicates and merged without having to do it line by line x3 dB's.

    Thanks

     
  • Paul
    Paul
    2014-10-08

    KeePass V1 databases cannot be opened natively in V2 or synced. To use synchronization you must use KeePass V2.
    When using KeePass V2 you can sync all databases using both KeePass and KeePass2Android.

    To migrate a V1 database to V2:
    1. Create a new, empty (delete the default entries), V2 database.
    2. Select File > Import and import your V1 database, using the "keep existing" option - to retain the entry UUIDs.

    Assuming your 3 databases are all V1 databases, I suggest the following:
    1. Import all of them into a new V2 database using the "overwrite if newer" option. This will compare the UUIDs and time stamps, and merge changes.
    2. Save the database, then select Tools > Database Tools > Delete Duplicate Entries.
    3. Save the database using a new name - this gives you a backup. You may still have a few duplicates but most will have been merged.
    4. To check for duplicates select View > Grouping in entry list > Off. You can set this back to Auto later.
    4.a. Place the cursor in the search box and press Enter. All entries will be displayed, except those in Recycle Bin. Click on the Title column heading to sort by title and scroll through to see any possible duplicates.

    cheers, Paul

     
    Last edit: Paul 2014-10-08