├── .gitignore ├── DecryptSQLite.cs ├── DecryptSQLite.csproj ├── README.md └── bin └── Release └── DecryptSQLite.exe /.gitignore: -------------------------------------------------------------------------------- 1 | System.Data.SQLite.DLL 2 | -------------------------------------------------------------------------------- /DecryptSQLite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.SQLite; 3 | using System.Windows.Forms; 4 | using System.IO; 5 | using Microsoft.VisualBasic; 6 | 7 | namespace DecryptSQLite 8 | { 9 | public class DecryptSQLite 10 | { 11 | static void Main () 12 | { 13 | try { 14 | start (); 15 | } catch (Exception e) { 16 | MessageBox.Show ("Une erreur inattendue s'est produite:\n" + e, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); 17 | } 18 | } 19 | 20 | static void start () 21 | { 22 | String sourceFile = null; 23 | String destinationFile = null; 24 | String sourcePassword = "password"; 25 | String destinationPassword = ""; 26 | 27 | const string FILTER = "Base de données (*.db3)|*.db3|Tous les fichiers (*.*)|*.*"; 28 | FileDialog sourceFileSelection = new OpenFileDialog (); 29 | sourceFileSelection.Filter = FILTER; 30 | sourceFileSelection.Title = "Ouvrir la base de données"; 31 | if (sourceFileSelection.ShowDialog () != DialogResult.OK) { 32 | return; 33 | } 34 | sourceFile = sourceFileSelection.FileName; 35 | 36 | FileDialog destinationFileSelection = new SaveFileDialog (); 37 | destinationFileSelection.Filter = FILTER; 38 | destinationFileSelection.DefaultExt = "db3"; 39 | destinationFileSelection.FileName = Path.GetDirectoryName (sourceFile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension (sourceFile) + "-decrypte.db3"; 40 | destinationFileSelection.Title = "Enregistrer la base de données"; 41 | if (destinationFileSelection.ShowDialog () != DialogResult.OK) { 42 | return; 43 | } 44 | destinationFile = destinationFileSelection.FileName; 45 | 46 | sourcePassword = Interaction.InputBox ("Mot de passe pour\n" + sourceFile, "Ancien mot de passe", sourcePassword); 47 | destinationPassword = Interaction.InputBox ("Mot de passe pour\n" + destinationFile, "Nouveau mot de passe", destinationPassword); 48 | 49 | const string CONNECTION_STRING = "URI=file:{0};Version=3;Password={1};"; 50 | const string CONNECTION_STRING_NO_PASSWORD = "URI=file:{0};Version=3;"; 51 | if (!sourceFile.Equals (destinationFile)) { 52 | File.Copy (sourceFile, destinationFile); 53 | } 54 | String connectionString = sourcePassword.Length > 0 ? 55 | String.Format (CONNECTION_STRING, destinationFile, sourcePassword) : 56 | String.Format (CONNECTION_STRING_NO_PASSWORD, destinationFile); 57 | 58 | try { 59 | SQLiteConnection connection = new SQLiteConnection (connectionString); 60 | connection.Open (); 61 | try { 62 | connection.ChangePassword (destinationPassword); 63 | connection.Close (); 64 | MessageBox.Show ("Mot de passe changé avec succès!", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information); 65 | } catch (Exception e) { 66 | MessageBox.Show ("Erreur lors du changement de mot de passe:\n" + e, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); 67 | } 68 | } catch (Exception e) { 69 | MessageBox.Show ("Erreur lors de l'ouverture de la base de données:\n" + e, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /DecryptSQLite.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 10.0.0 7 | 2.0 8 | {7A9E9A0D-65DD-4BEB-8A51-A32A67CD6E52} 9 | WinExe 10 | DecryptSQLite 11 | DecryptSQLite 12 | DecryptSQLite.DecryptSQLite 13 | 65001 14 | v3.5 15 | 16 | 17 | True 18 | full 19 | False 20 | bin\Debug 21 | DEBUG; 22 | prompt 23 | 4 24 | False 25 | x86 26 | 27 | 28 | none 29 | True 30 | bin\Release 31 | prompt 32 | 4 33 | False 34 | x86 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | System.Data.SQLite.DLL 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DecryptSQLite 2 | 3 | This repository contains a simple utility, written in C#, which allows to change the password of 4 | an encrypted SQLite database (created with [System.Data.SQLite](https://system.data.sqlite.org)). 5 | 6 | Note that you have to know the old password in order to change it (the goal of this utility is 7 | not to help recovering a lost password). 8 | 9 | ## How to build 10 | 11 | DecryptSQLite depends on [System.Data.SQLite](https://system.data.sqlite.org), but this dependency 12 | is not included in this repository. 13 | 14 | Before opening or building this project, please put `System.Data.SQLite.DLL` at the root of the 15 | project (next to this `README.md` file). 16 | 17 | You can then use [MonoDevelop](http://monodevelop.com/) to open and build this project. 18 | 19 | Note that this project was built and tested with version 1.0.66.0 of `System.Data.SQLite.DLL`. 20 | It might not be compatible with other versions. 21 | 22 | ## How to use 23 | 24 | * Make sure `DecryptSQLite.exe` and the correct version of `System.Data.SQLite.DLL` are in the same folder. 25 | 26 | * Execute `DecryptSQLite.exe` (e.g. by double-clicking on it). 27 | 28 | * A dialog box to select the database file is displayed. Please select the source SQLite database 29 | file (.db3) and click on Open. 30 | 31 | * Another dialog box then asks where to save the changed database. You can change the default path 32 | (if needed) and validate by clicking on Save. 33 | 34 | * Another dialog box then asks for the password of the source database to decrypt it. Type 35 | the password and click on OK. If the source database is not encrypted, you can either click on Cancel 36 | or empty the field and click on OK. 37 | 38 | * Another dialog box then asks for the new password to encrypt the database. Type the new password 39 | and click on OK. If you don't want to encrypt the changed database, you can either click on Cancel, 40 | or make sure the field is empty and click on OK. 41 | 42 | * When the password removal operation completes successfully, a success message is displayed. 43 | Otherwise, an error message can be displayed. 44 | 45 | ## Copyright 46 | 47 | The content of this repository is in the [Public domain](http://en.wikipedia.org/wiki/Public_Domain). 48 | -------------------------------------------------------------------------------- /bin/Release/DecryptSQLite.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davdiv/DecryptSQLite/927c3c276f5679b7cdea46dff42b2d6e94270191/bin/Release/DecryptSQLite.exe --------------------------------------------------------------------------------