Willena / sqlite-jdbc-crypt

SQLite JDBC Driver with encryption support
Apache License 2.0
172 stars 33 forks source link

Backup and Restore command should take ciphers parameters #12

Open Willena opened 5 years ago

Willena commented 5 years ago

When you're trying to backup the database using the "backup to " non standard command, the destination database is opened clear all the time. If the source is encrypted you might want to keep your backup encrypted or encrypt it with another cipher algorithm. The "backup to" command should provide a way to choose the algorithm parameters like when the user opens the database.

The same thing apply for the "restore from" command.

Possible workaround ( not tested ):

You can try putting cipher parameters after the name like when you're opening the database. Ex:

If that doesn't work you can still cipher it after backup using the standard way:

After that it should be now encrypted.

If you want to restore the database, might need to rekey the backup before restore

Rekeying the backup might be also needed since at this stage it is clear

Another workaround would be to:

  1. open the database
  2. dump it as sql file
  3. execute the sql file in a new database