Encrypted Sqlite: password validation on screen

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jota
Posts: 34
Joined: Tue 22 Nov 2011 19:21

Encrypted Sqlite: password validation on screen

Post by jota » Wed 23 Jan 2013 10:37

Hi

I´m using UniDAC 4.3.8

I do not know how to validate the password. Can someone help me with an example of code is needed to indicate if the entered password is correct or not?

Thanks in advance

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Encrypted Sqlite: password validation on screen

Post by AlexP » Wed 23 Jan 2013 13:25

hello,

When attempting to connect to an encrypted DB, password is validated by the library, and you cannot validate the password by yourself. You can wrap the Connect method call with a Try...Except block and analyze the codes of the occurred errors. I.e.:

Code: Select all

  UniConnection1.SpecificOptions.Values['EncryptionKey'] := 'test';
  try
    UniConnection1.Connect;
  except
    on E: EUniError do
      case E.ErrorCode of
        26: ShowMessage('Invalid Password');
        else
          ShowMessage('Other Error');
      end;
  end;
P.S. Retrieving of error code in this version is available only when working with the client library. We will add this functionality in the next build. For the time being, the following error is returned in the Direct mode:
'Invalid EncryptionKey and/or EncryptionAlgorithm specified" with no code.

Post Reply