Topic: Encrypt and Decrypt Whole database

Is there a way to encrypt and decrypt whole the database ?
What I mean is that we have a database also ready and it is not easy to write a new code to secure it.
Is there a way to encrypt whole the database and then using a script  only once to verify with a code whole the database to decrypt.

I believe it's better to do that for software we have created and use it instead to write a new code.

Re: Encrypt and Decrypt Whole database

You can encrypt the database file before application will be closed, and decrypt the database file if application catch error that database is encrypted. Example:

// global event for all exceptions related database
function OnSQLException(Sender: TObject; Msg: string; SQL: string): boolean;
begin
    if Pos('file is encrypted or is not a database', Msg)>0 then
    begin
        result := True; // to prevent system message
        Form1.SQLConnection.Connected := False;
        DecryptFileRC5('sqlite.db', 'password');
    end;
end;

procedure Form1_OnClose (Sender: TObject; Action: string);
begin
    Form1.SQLConnection.Connected := False;
    EncryptFileRC5('sqlite.db', 'password');
end;

Also you can check out more advanced solutions
https://stackoverflow.com/questions/566 … protection



If you want to protect your data, you can use MySQL DMBS, so your data will be stored on remote server.
Also you can use SSL connection to MySQL, to protect your data more strong.
http://myvisualdatabase.com/forum/viewtopic.php?id=4274

Dmitry.

Re: Encrypt and Decrypt Whole database

Hi Dmitry. Thanks for your quick response.  Can you give me a small example with just one table to understand the encrypt and decrypt?
About using MYSQL unfortunately I don't have the skills. I understand a fiew about sql database  and that because I start to use your MVDB.  Thanks again and wait about an a example if it's possible.

Re: Encrypt and Decrypt Whole database

Now I see, that a database file may be very easy to damage, if you enter wrong password.


Unfortunately there is no easy way to protect data using only script. If you really need to protect data, you should choose another method.

Dmitry.

Re: Encrypt and Decrypt Whole database

What for a method do you suggest?  I hope something I can understand ando something free if it's possible

Re: Encrypt and Decrypt Whole database

v_pozidis wrote:

What for a method do you suggest?  I hope something I can understand ando something free if it's possible

MySQL remote server with SSL connection.

Dmitry.