Titanium JIRA Archive
Appcelerator Community (AC)

[AC-877] Unable to open encrypted database

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2014-06-24T21:51:34.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules, Titanium SDK & CLI
Labelsn/a
ReporterScott Mason
AssigneeMauro Parra-Miranda
Created2014-06-11T14:09:01.000+0000
Updated2016-03-08T07:37:10.000+0000

Description

We have a project that consists of the following components: 1) Alloy project 2) Photo Module (custom appcelerator module) 3) Transmission Module (custom appcelerator module) All three components need read/write access to the sqlite database. We just converted the alloy project to use the encrypted.database module version 1.0.1 and can no longer access the database from the custom modules. We have integrated sqlcipher into the custom modules and entered the same key, but the decryption in the custom module fails. We would like to know how to configure sqlcipher in the custom modules to be compatible with the Appcelerator encrypted database module Here is the output from CODEC_DEBUG when the modules tries to open the encrypted database: sqlite3_key entered: db=0xcba8c00 pKey=abc123 nKey=6 sqlite3_key_v2: entered db=0xcba8c00 zDb=main pKey=abc123 nKey=6 sqlite3CodecAttach: entered nDb=0 zKey=abc123, nKey=6 sqlcipher_codec_ctx_set_use_hmac: use=1 block_sz=16 md_size=20 reserve=48 sqlcipher_cipher_ctx_copy: entered target=0xc0cc660, source=0xc0cc540 codec_set_btree_to_codec_pagesize: sqlite3BtreeSetPageSize() size=1024 reserve=48 SELECT count(*) from sqlite_master executed here sqlite3Codec: entered pgno=1, mode=3, page_sz=1024 cipher_ctx_key_derive: entered c_ctx->pass=abc123, c_ctx->pass_sz=6 ctx->kdf_salt=0xc0cc520 ctx->kdf_salt_sz=16 c_ctx->kdf_iter=64000 ctx->hmac_kdf_salt=0xc0cc530, c_ctx->fast_kdf_iter=2 c_ctx->key_sz=32 cipher_ctx_key_derive: deriving key using full PBKDF2 with 64000 iterations cipher_ctx_key_derive: deriving hmac key from encryption key using PBKDF2 with 2 iterations sqlcipher_cipher_ctx_cmp: entered c1=0xc0cc660 c2=0xc0cc540 cipher_ctx_key_derive: entered c_ctx->pass=abc123, c_ctx->pass_sz=6 ctx->kdf_salt=0xc0cc520 ctx->kdf_salt_sz=16 c_ctx->kdf_iter=64000 ctx->hmac_kdf_salt=0xc0cc530, c_ctx->fast_kdf_iter=2 c_ctx->key_sz=32 cipher_ctx_key_derive: deriving key using full PBKDF2 with 64000 iterations cipher_ctx_key_derive: deriving hmac key from encryption key using PBKDF2 with 2 iterations sqlite3Codec: switch mode=3 offset=16 codec_cipher:entered pgno=1, mode=0, size=960 codec_cipher: comparing hmac on in=0xe389fe0 out=0xcbc07e0 hmac_sz=20 codec_cipher: hmac check failed for pgno=1 returning SQLITE_ERROR sqlcipher_codec_ctx_set_error: ctx=0xc0cc4f0, error=1 codec_ctx_free: entered iCtx=0xbfffcce0 cipher_ctx_free: entered iCtx=0xc0cc508 cipher_ctx_free: entered iCtx=0xc0cc50c

Comments

  1. Mauro Parra-Miranda 2014-06-24

JSON Source