Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implicit declaration of function 'sqlite3_key'?

I am working on SQLite File Encryption. I have added sqlCipher & crypto frameworks successfully in my project.

Now when I try to compile my application on this line

int rc = sqlite3_key(database, [key UTF8String], strlen([key UTF8String]));

it says Implicit declaration of function 'sqlite3_key'

So above line "implicit declaration" sounds to me like function is defined but not declared. But where I have to declared ?

While searching over Internet, under this article, it says like SQLite Encryption Extension(SEE) is not available publically. I have to purchase it of cost around $2000.

SEE -> http://www.hwaci.com/sw/sqlite/see.html

So this is the only reason I am getting Implicit declaration & False response while sqlite encryption process ?

like image 582
Tariq Avatar asked Jun 15 '11 09:06

Tariq


2 Answers

If you are using SQLCipher, you need to define SQLITE_HAS_CODEC in your application's C Flags. Thats all.

like image 174
adiman Avatar answered Oct 25 '22 05:10

adiman


Yes, that is the reason you are getting that compiler warning. The function sqlite3_key() is not defined in the version of libsqlite3 included with iOS. Adding in a function declaration isn't going to help-- it would fix that compiler warning, but it would just mean you'll get a linker error since the function isn't defined anywhere.

If you purchased SEE you could probably build your own copy of SQLite, embed it in your app, and just not use the system's libsqlite3. That this would mean you'd have to say "yes" when the app store submission process asks if your app includes encryption, meaning extra paperwork and time before you could submit the app. I'm not certain whether there's any clear indication of whether Apple would accept it even then-- probably they would, but they've been known to surprise people.

like image 22
Tom Harrington Avatar answered Oct 25 '22 03:10

Tom Harrington