Re: [sqlite] advice about opening an encrypted database

2009-03-11 Thread D. Richard Hipp

On Mar 10, 2009, at 8:31 PM, Dave Dyer wrote:

> using the standard sqlite encryption option:
>
> If I open a database I expect to be encrypted, and call
> sqlite_key to establish the expected key, how should I verify
> that the database is now open for business? Ie that the key
> was correct.
>
> Similarly, if I open a database might or might not be encrypted,
> how can I definitively determine that is the case, so I can ask
> the client for a password.
>
>
> It's not really satisfactory to just wait for some downstream
> query to fail, or to make a dummy query and assume that if it
> fails the reason is the lack of proper encryption keys.


The only thing you can do is to run an query and check to see if you  
get back SQLITE_NOTADB.  I suggest this query:

SELECT rowid FROM sqlite_master LIMIT 1;


D. Richard Hipp
d...@hwaci.com



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] advice about opening an encrypted database

2009-03-10 Thread Dave Dyer
using the standard sqlite encryption option:

If I open a database I expect to be encrypted, and call
sqlite_key to establish the expected key, how should I verify
that the database is now open for business? Ie that the key
was correct.

Similarly, if I open a database might or might not be encrypted,
how can I definitively determine that is the case, so I can ask
the client for a password.


It's not really satisfactory to just wait for some downstream
query to fail, or to make a dummy query and assume that if it
fails the reason is the lack of proper encryption keys.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users