Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlcipher not work? #387

Open
xuzhiming opened this issue Jul 2, 2015 · 2 comments
Open

sqlcipher not work? #387

xuzhiming opened this issue Jul 2, 2015 · 2 comments

Comments

@xuzhiming
Copy link

Hi, I pod the FMDB/SQLCipher, and i use the FMDatabaseQueue like this:

[self.dbQueue inTransaction:^(FMDatabase *db, BOOL *rollback) {
      [db setKey:TEST_SECRET_KEY];
      //create table ...
    }];

then got the message: "Unknown error calling sqlite3_step (11: database disk image is malformed) eu".
Btw, I looked up the setKey method, and here is the notation:

///-------------------------
/// @name Encryption methods
///-------------------------

/** Set encryption key.

 @param key The key to be used.

 @return `YES` if success, `NO` on error.

 @see http://www.sqlite-encrypt.com/develop-guide.htm

 @warning You need to have purchased the sqlite encryption extensions for this method to work.
 */
- (BOOL)setKey:(NSString*)key;

So could someone tell me
1.Do I need to purchase the encryption extension to make this work?(Or is there another way to use this?)
2.The link http://www.sqlite-encrypt.com/develop-guide.html seems can not open.

@xuzhiming xuzhiming reopened this Jul 2, 2015
@billymeltdown
Copy link

I'm not exactly hip with the Cocoapods just yet so you'll need to look up the command syntax (perhaps someone else can chime in here?), but the FMDB podspec includes a subspec named SQLCipher to ensure that the library is built and added to your project when you use that option:

https://github.com/ccgus/fmdb/blob/master/FMDB.podspec

@clemensg
Copy link
Contributor

clemensg commented Aug 5, 2015

@xuzhiming Please have a look at: https://www.zetetic.net/sqlcipher/open-source/

You do not have to buy it, but in that case you have to include their license text "prominently" in application and documentation.

You could be missing the SQLITE_TEMP_STORE=2 build flag. It is documented on the SQLCipher GitHub page. You could try cloning the FMDB repo, replacing line 50 in FMDB.podspec with ss.xcconfig = { 'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2' } and then specifying the FMDB/SQLCipher dependency in your Podfile with a path argument to your local FMDB clone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants