-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of URI parameters #23
Comments
From the user's perspective, I find
The probability of I first considered using Sorry if this causes extra effort in your project. Users of wxSQLite3 are probably capable of doing
Yes, the difference can be confusing. The documentation of sqleet could be clearer about the distinction between the two. |
Yes, I felt the same ... until I read the description of the error code in the SQLite documentation. In wxSQLite3 I chose to use
IMHO using the SQLite logging mechanism at least allows to better debug a failing SQLite application. I definitely intend to enhance the wxSQLite3 encryption extension by using this feature. In the end however, it is up to the user/developer to implement a hook intercepting the logging messages.
Well, for the multi-cipher implementation in wxSQLite3 it would certainly be nice to use the same parameter name for the same purpose for all affected cipher schemes (and probably I will follow this route somehow). However, I can understand your point.
Probably the SQLCipher developers will agree with you. However, from my point of view
Naturally my objective is a bit different, because I intend to support the most common cipher schemes within a single library. Currently, SQLCipher doesn't make use of URI parameters at all. No idea whether they plan to change that in the future. One option I'm considering is to use some sort of prefix for all encryption related parameters.
You are right: it is my problem to define a reasonable set of URI parameter names. If someone will be using the wxSQLite3 encryption extension he/she will have to know the differences between the various cipher schemes anyway.
Thanks for the clarifications. |
Commit ea466e4 somewhat improved the README documentation of existing URI parameters. The distinction between I'm closing this issue. The brief parameter names are nice IMO and I do not care so much about the common SQLCipher naming convention. The abuse of Edit: typos |
Regarding the error codes it would be nice if SQLite officially offered a few additional error codes to choose from. But since this is not the case, one either has to sort of abuse an existing error code or to choose a very generic error code. Of course it helps to track down problems using a rather specific / exotic error code. However, probably the same could be achieved using additional logging. BTW I will have to check the wxSQLite implementation as well whether it is affected by similar issues as sqleet, although I didn't get any error reports so far. Unfortunately, I currently have very limited chances to work on my projects due to personal matters. |
Sorry that I give rather late feedback regarding the new URI parameter feature of sqleet.
You decided to use the return code
SQLITE_MISUSE
to signal the use of erroneous URI parameter values. Looking at the SQLite documentation, I'm not convinced that using this return code is really the best choice:Especially the last paragraph indicates that a shipped application should never happen to experience a return code
SQLITE_MISUSE
. However, this is difficult to accomplish, because the valid range of parameters could potentially change from version to version and there is no interface available to query the allowed range in advance, so that the application could check user input and only pass valid data to the interface.Unfortunately, using another return code (for example,
SQLITE_ERROR
orSQLITE_CANTOPEN
) wouldn't solve the problem either. IMHO the main problem is that no detailed error diagnostics are available, that is, there is no indication which URI parameter(s) is(are) in error.Maybe one idea could be to add appropriate calls to
sqlite3_log
, thus giving an application a chance to get a more detailed information.In my own implementation I chose to silently ignore invalid URI parameters. However, I admit that I'm not happy with that approach either.
One major problem in SQLite itself is that
sqlite3_key_v2
is called internally in some cases (for example, if the URI parameterkey
is used, or if an encrypted database is attached), but its return code is silently ignored. That is, the application will not be informed properly, if anything goes wrong during initializing the codec.Of course you are free to name the URI parameters used in sqleet as you please. However, in my own encryption extension (which handles various different ciphers) it makes things harder to understand and use. For example, what you called
salt
for sqleet is namedcipher_salt
for SQLCipher; and while you offer 2 variation of the salt parameter (namely,salt
andhexsalt
), SQLCipher only accepts hex values - and IMHO this makes sense, because the salt is usually a binary value which is difficult to pass as an URI parameter in non-hex form anyway.Another problem can arise from name clashes, because any SQLite extension may allow configuration parameters via URI parameters. That's the main reason why I decided to silently ignore URI parameters which do not provide valid values for the encryption extension: they might belong to another extension, for which the given values are acceptable. At the moment I have no conclusive idea how this problem could or should be tackled.
salt
vsheader
I have to admit that I have not yet fully understood the implications of specifying both parameters,
salt
andheader
, or just one of them. Could you please elaborate in greater detail how it is meant to use these 2 parameters in sqleet? Thanks.The text was updated successfully, but these errors were encountered: