2

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 2

2

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")
Sign up to request clarification or add additional context in comments.

1 Comment

The instructions are to include SQLCipher on your Podfile: pod 'SQLite.swift/SQLCipher'
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.