Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27371] Can't crypt an existing SQLITE database

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterThomas Lemaitre
AssigneeEric Merriman
Created2019-08-13T05:36:32.000+0000
Updated2019-08-30T23:19:41.000+0000

Description

I've use the appcelerator.encrypteddatabase to encrypt a database into an existing application. The application is already in production and have one encrpyt database. For an update, we want crypt the actual database but it's not wokring if the databas ealready exist. I've attach a sample app code for your test : https://drive.google.com/file/d/1O-vz9xwwZMUT5FWjXS8vU9mgAMNn79dC/view?usp=sharing This is the message we received :
[ERROR] file is not a database
[ERROR] A SQLite database error occurred on database '/Users/didier/Library/Developer/CoreSimulator/Devices/ECB074E6-601F-4598-94D6-64F6865BACF7/data/Containers/Data/Application/E2C38BDE-D58D-4886-A3D7-B5661CAF458D/Library/Private Documents/myDb.sql': Error Domain=com.plausiblelabs.EncPLDatabase Code=4 "Cipher migrate: failed to attach new database." UserInfo={com.plausiblelabs.EncPLDatabase.error.vendor.string=file is not a database, NSLocalizedDescription=Cipher migrate: failed to attach new database., com.plausiblelabs.EncPLDatabase.error.vendor.code=26} (SQLite #26: file is not a database) (query: '<none>')

[ERROR] Error: Couldn't open database and migrate
[ERROR] File: /alloy/models/Books.js
[ERROR] Line: 386
[ERROR] SourceId: <null>
[ERROR] Backtrace:
[ERROR]  undefined

Attachments

FileDateSize
Screenshot 2019-08-13 at 12.48.03 PM.png2019-08-13T06:48:22.000+000029834

Comments

  1. Jan Vennemann 2019-08-13

    [~gmathews], [~vsingh], you guys have more experience with the encrypted db module. Is this even something we support? I couldn't find any info regarding migrating an unencrypted db to an encrypted one.
  2. Joshua Quick 2019-08-13

    The encrypted database module does not support copying an app embedded pre-made database file. This is not currently supported on Android or iOS. The module's install() method really does an open() instead. Please see: [MOD-2508] Your only option is to set up the database's tables/indexes/rows/etc. dynamically via code.

JSON Source