Skip to content

Commit 1aaad8e

Browse files
authored
Update README.md
1 parent d44b31c commit 1aaad8e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,18 @@ Then add this code right after opening or creating the db, and before any other
177177
```c#
178178
string key = "yourCryptingKey";
179179
var db = new SQLiteConnection(filePath);
180-
var ok = db.Execute<string>($"PRAGMA key = '{key}';");
180+
var ok = db.ExecuteScalar<string>($"PRAGMA key = '{key}';");
181181
if(ok != "ok")
182182
throw new Exception("Bad key");
183183
```
184184

185185
Then use the db as usual.
186+
187+
You can read the version of the cypher lib using the code. Check the [Zenetik](//https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_version) website for more information.
188+
189+
```c#
190+
var cipherVer = db.ExecuteScalar<string>("PRAGMA cipher_version");
191+
if (String.IsNullOrWhiteSpace(cipherVer))
192+
throw new Exception("This build is not using SQL CIPHER");
193+
```
194+

0 commit comments

Comments
 (0)