Could anyone post code sample of how to open sqlcipher database? I guess that we need to call the key function in some way.
2 Answers
Assuming you've installed SQLite.swift with SQLCipher support (if not, follow these instructions), you merely need to call the key function on your Database object:
import SQLite
let db = Database("path/to/ciphered.sqlite3")
db.key("your_key")
Once keyed, you can change the encryption key using rekey:
db.rekey("your_new_key")
1 Comment
leolobato
The instructions are to include SQLCipher on your Podfile:
pod 'SQLite.swift/SQLCipher'Take a look at SQLite.swift.
- To see how to call the underlying sqlcipher functions. e.g.
sqlite3_key(), see Cipher.swift - To see how to open a sqlcipher database in SQlite.swift with a key: CipherTests.swift