|
-
Mar 17th, 2021, 07:05 AM
#3
Thread Starter
Lively Member
Re: RC6 - New encrypt option for Sqlite DB: SqlCipher
 Originally Posted by Schmidt
Since RC-version 6.0.4 I'm using Ulrich Telles SQLite-MultipleCyphers-module...
And by default the Codec-Property sits at the "RC4"-option
(for backwards-compatibility with enrypted RC4/RC5 and also System.Data.SQLite produced DB-Files).
When you switch the Codec-Prop away from "RC4" - to one of the other Codecs, you will have to set the
"special, extended Cypher-Config-Options" (via the SQLite-Pragma-interface).
And for SqlCipher, there's quite a few, as documented here:
https://utelle.github.io/SQLite3Mult...her_sqlcipher/
The Pragma-interface (commands need to be applied via cConnection.Execute, shortly after Opening the DB):
https://utelle.github.io/SQLite3Mult...g_sql_pragmas/
HTH
Olaf
Now it worked!
I tested it with the SqlCipher version 3 and 4.
Here are some notes, in case anyone needs...
Code:
Dim sCn As New cConnection
Dim sRs As New cRecordset
'*** Define 'CodecType' before 'OpenDB'
sCn.CodecType = CODEC_TYPE_SQLCIPHER
'*** Inform the Path and DB File to open
'*** Do not enter the 'EncrKey' parameter here
sCn.OpenDB "C:\Users\Th\Desktop\Cipher3.db"
'*** Indicate that the file is a 'SqlCipher 3' (if the file is 'SqlCipher 4', it is also necessary to indicate here: legacy=4)
sCn.Execute "PRAGMA legacy=3;"
'*** Inform 'EncrKey' here, that way and after setting the 'legacy' parameter
sCn.Execute "PRAGMA key=123;"
'*** TEST
sCn.Execute "CREATE TABLE Tab_TesteTeste(fld1 INTEGER PRIMARY KEY, fld2 TEXT);"
sCn.Execute "INSERT INTO Tab_TesteTeste(fld1, fld2) VALUES(1,'a');"
sRs.OpenRecordset "SELECT fld1 || fld2 FROM Tab_TesteTeste", sCn
MsgBox "Ok!" & vbCrLf & "fld1 || fld2: " & sRs(0)
sCn.Execute "DROP TABLE Tab_TesteTeste;"
Set sRs = Nothing
Set sCn = Nothing
Note: Even though all SqlCipher encryption parameters are pre-defined for version 4 (https://utelle.github.io/SQLite3Mult...her_sqlcipher/), to open a DB SqlCipher 4 it was necessary to inform 'legacy=4'
Thank you very much!
--
Thiago Peres Sanches
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|