4
votes

I can open my encrypted sqlite database with sqlite maestro application but I can not with fiedac I get this error

[FireDAC][Phys][SQLite] ERROR: Cipher: Invalid password is specified or DB is corrupted

Here is my data module unit:

object DM: TDM
  OldCreateOrder = False
  Height = 306
  Width = 468
  object FDConnection1: TFDConnection
    Params.Strings = (
      'Database=C:\myapps\mydb.db'
      'Password=mypass'
      'DriverID=SQLite')
    LoginPrompt = False
    Left = 48
    Top = 16
  end

I wrote the encryption key as a password but when I not type any password I get error:

[FireDAC][Phys][SQLite] ERROR: file is encrypted or is not a database.

What is the problem ?

1
You missed to tell FireDAC which encryption you use. Use the format <encryption>:<password> like e.g. aes-256:MyPassword for the Password connection parameter. Consult connection definition parameters for that. I cannot give you a direct answer as you haven't mention encyption that you actually use. - Victoria
@Victoria I get invalid password when I do so - William
Well, then you have used invalid password. But you must use that format (unless you used AES-256), that is what I'm sure about. If you tell us the exact steps that you followed, I can try to simulate with SQLite Maestro trial on VM in a few hours (as it's 1AM where I live :) - Victoria
@Victoria It is the correct password I use with sqlite maestro. I only dropped fdconnection component , right click and I set the parameters above: database name, password and driver ... take your time we are in same time zone btw ... thanks - William

1 Answers

4
votes

Found the problem. According to the documentation:

The encrypted database format is not compatible with other similar SQLite encryption extensions. This means that you cannot use an encrypted database, encrypted with non-FireDAC libraries. If you need to do this, then you have to decrypt a database with an original tool and encrypt it with FireDAC.

I can not encrypt with SQLite Maestro (different library) and open it in FireDAC so I must decrypt it then encrypt the database using FireDAC. I used the encryption sample the come with Delphi and now I can open it with FireDAC.