The question 开发者_JS百科should be clear right :)
I followed this tutorial: http://mobileorchard.com/tutorial-iphone-sqlite-encryption-with-sqlcipher/
Would be glad to know if and how I'm able to open my db after adding the key to it. As I receive following error atm:
"file is encrypted or is not a database"
Thanks in advance!
Grtz,
Lewion
To create a new encrypted SQLite database or to open an existing encrypted SQLite database you have to call the function sqlite3_key or to execute a "pragma key=" command immediately after opening the database before performing any other database operation.
I suspect that you tried to open an existing, but not encrypted SQLite database and expected to encrypt it by using one of the above methods. This doesn't work but results in the error message you experienced.
To encrypt an existing not encrypted SQLite database you have to use function sqlite3_rekey or "pragma rekey=" command.
To change the encryption key of an existing encrypted SQLite database you have to open the database, then to use sqlite3_key (or "pragma key=") and then to apply sqlite3_rekey (or "pragma rekey=").
精彩评论