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

failed to open existing encrypted database encrypted use SQLCipher 4 defaults configuration #514

Closed
zhouzhongguang opened this issue May 17, 2019 · 4 comments

Comments

@zhouzhongguang
Copy link

commented May 17, 2019

The language of WCDB

Objective-C

The version of WCDB

V 1.0.7.5

The platform of WCDB

iOS

The installation of WCDB

Cocoapods

What's the issue?

As the title says, I have a existing encrypted database file use SQLCipher 4 default configurations.
sqlite3_key(_database, [key UTF8String], (int)key.length);
I can open it use DB Browser App by input the encryption key string and select SQLCipher 4 default configurations, as follows:
屏幕快照 2019-05-17 上午11 18 42

But when set the same key use WCDB and run create table code it logs error:
屏幕快照 2019-05-17 上午11 35 33

error:
[WCDB][DEBUG]Code:26, Type:SQLiteGlobal, Msg:file is encrypted or is not a database [WCDB][ERROR]Code:26, Type:SQLite, Tag:0, Op:4, ExtCode:26, Msg:file is encrypted or is not a database, SQL:PRAGMA synchronous='NORMAL', Path:/var/mobile/Containers/Data/Application/DAEECA1F-09DD-40BD-88FC-F87AE72DF416/Library/hikMoaDataBase_zhouzhongguang.sqlite

Is there some APIs to configure the three options : "KDF iterations"
、"HMAC algorithm" and "KDF algorithm"

@RingoD

This comment has been minimized.

Copy link
Collaborator

commented May 17, 2019

Try sqlcipher 3.

@zhouzhongguang

This comment has been minimized.

Copy link
Author

commented May 17, 2019

But the problem is the existing encrypted database file is already on user's device by old version APP. And next version i want migrate the DB code library to WCDB library. What should i do?

If migrate the data in the existing database file, it should open database use SQLCipher 4. But the SQLCipher4 and WCDBOptimizedSQLCipher cant appear in the same project.😢

@RingoD

This comment has been minimized.

Copy link
Collaborator

commented May 17, 2019

Unfortunately, I think there is hard work to be done.

At the moment WCDB released, the newest sqlcipher version was v3. And v4 was released 2018.12.1, which is not too long ago.

We have no plan for upgrading sqlcipher to v4 recently, especially considering this compatible issue.

@zhouzhongguang

This comment has been minimized.

Copy link
Author

commented May 20, 2019

Thank you, i know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.