Giter VIP home page Giter VIP logo

sqlcipher / sqlcipher Goto Github PK

View Code? Open in Web Editor NEW
6.0K 251.0 1.3K 50.57 MB

SQLCipher is a standalone fork of SQLite that adds 256 bit AES encryption of database files and other security features.

Home Page: https://www.zetetic.net/sqlcipher/

License: Other

Makefile 1.29% Shell 2.18% C 80.38% Tcl 5.70% C++ 0.08% Batchfile 0.22% Yacc 0.45% M4 1.06% Objective-C 0.01% C# 0.14% Roff 0.03% JavaScript 5.10% CSS 0.02% HTML 0.56% Java 2.78%

sqlcipher's Introduction

SQLCipher

SQLCipher is a standalone fork of the SQLite database library that adds 256 bit AES encryption of database files and other security features like:

  • on-the-fly encryption
  • tamper detection
  • memory sanitization
  • strong key derivation

SQLCipher is based on SQLite and stable upstream release features are periodically integrated. While SQLCipher is maintained as a separate version of the source tree, the project minimizes alterations to core SQLite code whenever possible.

SQLCipher is maintained by Zetetic, LLC, and additional information and documentation is available on the official SQLCipher site.

Features

  • Fast performance with as little as 5-15% overhead for encryption on many operations
  • 100% of data in the database file is encrypted
  • Good security practices (CBC mode, HMAC, key derivation)
  • Zero-configuration and application level cryptography
  • Algorithms provided by the peer reviewed OpenSSL crypto library.
  • Configurable crypto providers

Compatibility

SQLCipher maintains database format compatibility within the same major version number so an application on any platform can open databases created by any other application provided the major version of SQLCipher is the same between them. However, major version updates (e.g. from 3.x to 4.x) often include changes to default settings. This means that newer major versions of SQLCipher will not open databases created by older versions without using special settings. For example, SQLCipher 4 introduces many new performance and security enhancements. The new default algorithms, increased KDF iterations, and larger page size mean that SQLCipher 4 will not open databases created by SQLCipher 1.x, 2.x, or 3.x by default. Instead, an application would either need to migrate the older databases to use the new format or enable a special backwards-compatibility mode. The available options are described in SQLCipher's upgrade documentation.

SQLCipher is also compatible with standard SQLite databases. When a key is not provided, SQLCipher will behave just like the standard SQLite library. It is also possible to convert from a plaintext database (standard SQLite) to an encrypted SQLCipher database using ATTACH and the sqlcipher_export() convenience function.

Contributions

The SQLCipher team welcomes contributions to the core library. All contributions including pull requests and patches should be based on the prerelease branch, and must be accompanied by a contributor agreement. We strongly encourage discussion of the proposed change prior to development and submission.

Compiling

Building SQLCipher is similar to compiling a regular version of SQLite from source, with a couple of small exceptions:

  1. You must define SQLITE_HAS_CODEC and either SQLITE_TEMP_STORE=2 or SQLITE_TEMP_STORE=3
  2. You will need to link against a support cryptographic provider (OpenSSL, LibTomCrypt, CommonCrypto/Security.framework, or NSS)

The following examples demonstrate linking against OpenSSL, which is a readily available provider on most Unix-like systems.

Example 1. Static linking (replace /opt/local/lib with the path to libcrypto.a). Note in this example, --enable-tempstore=yes is setting SQLITE_TEMP_STORE=2 for the build.

$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
	LDFLAGS="/opt/local/lib/libcrypto.a"
$ make

Example 2. Dynamic linking

$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
	LDFLAGS="-lcrypto"
$ make

Testing

The full SQLite test suite will not complete successfully when using SQLCipher. In some cases encryption interferes with low-level tests that require access to database file data or features which are unsupported by SQLCipher. Those tests that are intended to support encryption are intended for non-SQLCipher implementations. In addition, because SQLite tests are not always isolated, if one test fails it can trigger a domino effect with other failures in later steps.

As a result, the SQLCipher package includes it's own independent tests that exercise and verify the core functionality of the SQLCipher extensions. This test suite is intended to provide an abbreviated verification of SQLCipher's internal logic; it does not perform an exhaustive test of the SQLite database system as a whole or verify functionality on specific platforms. Because SQLCipher is based on stable upstream builds of SQLite, it is considered a basic assumption that the core SQLite library code is operating properly (the SQLite core is almost untouched in SQLCipher). Thus, the additional SQLCipher-specific test provide the requisite verification that the library is operating as expected with SQLCipher's security features enabled.

To run SQLCipher specific tests, configure as described here and run the following to execute the tests and receive a report of the results:

$ ./configure --enable-tempstore=yes --enable-fts5 CFLAGS="-DSQLITE_HAS_CODEC -DSQLCIPHER_TEST" \
	LDFLAGS="-lcrypto"
$ make testfixture
$ ./testfixture test/sqlcipher.test

Encrypting a database

To specify an encryption passphrase for the database via the SQL interface you use a PRAGMA. The passphrase you enter is passed through PBKDF2 key derivation to obtain the encryption key for the database

PRAGMA key = 'passphrase';

Alternately, you can specify an exact byte sequence using a blob literal. If you use this method it is your responsibility to ensure that the data you provide is a 64 character hex string, which will be converted directly to 32 bytes (256 bits) of key data without key derivation.

PRAGMA key = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";

To encrypt a database programmatically you can use the sqlite3_key function. The data provided in pKey is converted to an encryption key according to the same rules as PRAGMA key.

int sqlite3_key(sqlite3 *db, const void *pKey, int nKey);

PRAGMA key or sqlite3_key should be called as the first operation when a database is open.

Changing a database key

To change the encryption passphrase for an existing database you may use the rekey PRAGMA after you've supplied the correct database password;

PRAGMA key = 'passphrase'; -- start with the existing database passphrase
PRAGMA rekey = 'new-passphrase'; -- rekey will reencrypt with the new passphrase

The hex rekey pragma may be used to rekey to a specific binary value

PRAGMA rekey = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";

This can be accomplished programmatically by using sqlite3_rekey;

sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey)

Support

The primary source for complete documentation (design, API, platforms, usage) is the SQLCipher website:

https://www.zetetic.net/sqlcipher/documentation

The primary avenue for support and discussions is the SQLCipher discuss site:

https://discuss.zetetic.net/c/sqlcipher

Issues or support questions on using SQLCipher should be entered into the GitHub Issue tracker:

https://github.com/sqlcipher/sqlcipher/issues

Please DO NOT post issues, support questions, or other problems to blog posts about SQLCipher as we do not monitor them frequently.

If you are using SQLCipher in your own software please let us know at [email protected]!

Community Edition Open Source License

Copyright (c) 2020, ZETETIC LLC All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the ZETETIC LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Begin SQLite README.md

SQLite Source Repository

This repository contains the complete source code for the SQLite database engine. Some test scripts are also included. However, many other test scripts and most of the documentation are managed separately.

Version Control

SQLite sources are managed using Fossil, a distributed version control system that was specifically designed and written to support SQLite development. The Fossil repository contains the urtext.

If you are reading this on GitHub or some other Git repository or service, then you are looking at a mirror. The names of check-ins and other artifacts in a Git mirror are different from the official names for those objects. The official names for check-ins are found in a footer on the check-in comment for authorized mirrors. The official check-in name can also be seen in the manifest.uuid file in the root of the tree. Always use the official name, not the Git-name, when communicating about an SQLite check-in.

If you pulled your SQLite source code from a secondary source and want to verify its integrity, there are hints on how to do that in the Verifying Code Authenticity section below.

Contacting The SQLite Developers

The preferred way to ask questions or make comments about SQLite or to report bugs against SQLite is to visit the SQLite Forum at https://sqlite.org/forum/. Anonymous postings are permitted.

If you think you have found a bug that has security implications and you do not want to report it on the public forum, you can send a private email to drh at sqlite dot org.

Public Domain

The SQLite source code is in the public domain. See https://sqlite.org/copyright.html for details.

Because SQLite is in the public domain, we do not normally accept pull requests, because if we did take a pull request, the changes in that pull request might carry a copyright and the SQLite source code would then no longer be fully in the public domain.

Obtaining The SQLite Source Code

If you do not want to use Fossil, you can download tarballs or ZIP archives or SQLite archives as follows:

  • Latest trunk check-in as Tarball, ZIP-archive, or SQLite-archive.

  • Latest release as Tarball, ZIP-archive, or SQLite-archive.

  • For other check-ins, substitute an appropriate branch name or tag or hash prefix in place of "release" in the URLs of the previous bullet. Or browse the timeline to locate the check-in desired, click on its information page link, then click on the "Tarball" or "ZIP Archive" links on the information page.

If you do want to use Fossil to check out the source tree, first install Fossil version 2.0 or later. (Source tarballs and precompiled binaries available here. Fossil is a stand-alone program. To install, simply download or build the single executable file and put that file someplace on your $PATH.) Then run commands like this:

    mkdir -p ~/sqlite ~/Fossils
    cd ~/sqlite
    fossil clone https://www.sqlite.org/src ~/Fossils/sqlite.fossil
    fossil open ~/Fossils/sqlite.fossil

After setting up a repository using the steps above, you can always update to the latest version using:

    fossil update trunk   ;# latest trunk check-in
    fossil update release ;# latest official release

Or type "fossil ui" to get a web-based user interface.

Compiling for Unix-like systems

First create a directory in which to place the build products. It is recommended, but not required, that the build directory be separate from the source directory. Cd into the build directory and then from the build directory run the configure script found at the root of the source tree. Then run "make".

For example:

    tar xzf sqlite.tar.gz    ;#  Unpack the source tree into "sqlite"
    mkdir bld                ;#  Build will occur in a sibling directory
    cd bld                   ;#  Change to the build directory
    ../sqlite/configure      ;#  Run the configure script
    make                     ;#  Builds the "sqlite3" command-line tool
    make sqlite3.c           ;#  Build the "amalgamation" source file
    make devtest             ;#  Run some tests (requires Tcl)

See the makefile for additional targets.

The configure script uses autoconf 2.61 and libtool. If the configure script does not work out for you, there is a generic makefile named "Makefile.linux-gcc" in the top directory of the source tree that you can copy and edit to suit your needs. Comments on the generic makefile show what changes are needed.

Compiling for Windows Using MSVC

On Windows, all applicable build products can be compiled with MSVC. You will also need a working installation of TCL. See the compile-for-windows.md document for additional information about how to install MSVC and TCL and configure your build environment.

If you want to run tests, you need to let SQLite know the location of your TCL library, using a command like this:

    set TCLDIR=c:\Tcl

SQLite uses "tclsh.exe" as part of the build process, and so that utility program will need to be somewhere on your %PATH%. The finished SQLite library does not contain any TCL code, but it does use TCL to help with the build process and to run tests.

Build using Makefile.msc. Example:

    nmake /f Makefile.msc
    nmake /f Makefile.msc sqlite3.c
    nmake /f Makefile.msc devtest
    nmake /f Makefile.msc releasetest

There are many other makefile targets. See comments in Makefile.msc for details.

Source Code Tour

Most of the core source files are in the src/ subdirectory. The src/ folder also contains files used to build the "testfixture" test harness. The names of the source files used by "testfixture" all begin with "test". The src/ also contains the "shell.c" file which is the main program for the "sqlite3.exe" command-line shell and the "tclsqlite.c" file which implements the Tcl bindings for SQLite. (Historical note: SQLite began as a Tcl extension and only later escaped to the wild as an independent library.)

Test scripts and programs are found in the test/ subdirectory. Additional test code is found in other source repositories. See How SQLite Is Tested for additional information.

The ext/ subdirectory contains code for extensions. The Full-text search engine is in ext/fts3. The R-Tree engine is in ext/rtree. The ext/misc subdirectory contains a number of smaller, single-file extensions, such as a REGEXP operator.

The tool/ subdirectory contains various scripts and programs used for building generated source code files or for testing or for generating accessory programs such as "sqlite3_analyzer(.exe)".

Generated Source Code Files

Several of the C-language source files used by SQLite are generated from other sources rather than being typed in manually by a programmer. This section will summarize those automatically-generated files. To create all of the automatically-generated files, simply run "make target_source". The "target_source" make target will create a subdirectory "tsrc/" and fill it with all the source files needed to build SQLite, both manually-edited files and automatically-generated files.

The SQLite interface is defined by the sqlite3.h header file, which is generated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION. The Tcl script at tool/mksqlite3h.tcl does the conversion. The manifest.uuid file contains the SHA3 hash of the particular check-in and is used to generate the SQLITE_SOURCE_ID macro. The VERSION file contains the current SQLite version number. The sqlite3.h header is really just a copy of src/sqlite.h.in with the source-id and version number inserted at just the right spots. Note that comment text in the sqlite3.h file is used to generate much of the SQLite API documentation. The Tcl scripts used to generate that documentation are in a separate source repository.

The SQL language parser is parse.c which is generated from a grammar in the src/parse.y file. The conversion of "parse.y" into "parse.c" is done by the lemon LALR(1) parser generator. The source code for lemon is at tool/lemon.c. Lemon uses the tool/lempar.c file as a template for generating its parser. Lemon also generates the parse.h header file, at the same time it generates parse.c.

The opcodes.h header file contains macros that define the numbers corresponding to opcodes in the "VDBE" virtual machine. The opcodes.h file is generated by scanning the src/vdbe.c source file. The Tcl script at ./mkopcodeh.tcl does this scan and generates opcodes.h. A second Tcl script, ./mkopcodec.tcl, then scans opcodes.h to generate the opcodes.c source file, which contains a reverse mapping from opcode-number to opcode-name that is used for EXPLAIN output.

The keywordhash.h header file contains the definition of a hash table that maps SQL language keywords (ex: "CREATE", "SELECT", "INDEX", etc.) into the numeric codes used by the parse.c parser. The keywordhash.h file is generated by a C-language program at tool mkkeywordhash.c.

The pragma.h header file contains various definitions used to parse and implement the PRAGMA statements. The header is generated by a script tool/mkpragmatab.tcl. If you want to add a new PRAGMA, edit the tool/mkpragmatab.tcl file to insert the information needed by the parser for your new PRAGMA, then run the script to regenerate the pragma.h header file.

The Amalgamation

All of the individual C source code and header files (both manually-edited and automatically-generated) can be combined into a single big source file sqlite3.c called "the amalgamation". The amalgamation is the recommended way of using SQLite in a larger application. Combining all individual source code files into a single big source code file allows the C compiler to perform more cross-procedure analysis and generate better code. SQLite runs about 5% faster when compiled from the amalgamation versus when compiled from individual source files.

The amalgamation is generated from the tool/mksqlite3c.tcl Tcl script. First, all of the individual source files must be gathered into the tsrc/ subdirectory (using the equivalent of "make target_source") then the tool/mksqlite3c.tcl script is run to copy them all together in just the right order while resolving internal "#include" references.

The amalgamation source file is more than 200K lines long. Some symbolic debuggers (most notably MSVC) are unable to deal with files longer than 64K lines. To work around this, a separate Tcl script, tool/split-sqlite3c.tcl, can be run on the amalgamation to break it up into a single small C file called sqlite3-all.c that does #include on about seven other files named sqlite3-1.c, sqlite3-2.c, ..., sqlite3-7.c. In this way, all of the source code is contained within a single translation unit so that the compiler can do extra cross-procedure optimization, but no individual source file exceeds 32K lines in length.

How It All Fits Together

SQLite is modular in design. See the architectural description for details. Other documents that are useful in (helping to understand how SQLite works include the file format description, the virtual machine that runs prepared statements, the description of how transactions work, and the overview of the query planner.

Years of effort have gone into optimizing SQLite, both for small size and high performance. And optimizations tend to result in complex code. So there is a lot of complexity in the current SQLite implementation. It will not be the easiest library in the world to hack.

Key files:

  • sqlite.h.in - This file defines the public interface to the SQLite library. Readers will need to be familiar with this interface before trying to understand how the library works internally.

  • sqliteInt.h - this header file defines many of the data objects used internally by SQLite. In addition to "sqliteInt.h", some subsystems have their own header files.

  • parse.y - This file describes the LALR(1) grammar that SQLite uses to parse SQL statements, and the actions that are taken at each step in the parsing process.

  • vdbe.c - This file implements the virtual machine that runs prepared statements. There are various helper files whose names begin with "vdbe". The VDBE has access to the vdbeInt.h header file which defines internal data objects. The rest of SQLite interacts with the VDBE through an interface defined by vdbe.h.

  • where.c - This file (together with its helper files named by "where*.c") analyzes the WHERE clause and generates virtual machine code to run queries efficiently. This file is sometimes called the "query optimizer". It has its own private header file, whereInt.h, that defines data objects used internally.

  • btree.c - This file contains the implementation of the B-Tree storage engine used by SQLite. The interface to the rest of the system is defined by "btree.h". The "btreeInt.h" header defines objects used internally by btree.c and not published to the rest of the system.

  • pager.c - This file contains the "pager" implementation, the module that implements transactions. The "pager.h" header file defines the interface between pager.c and the rest of the system.

  • os_unix.c and os_win.c - These two files implement the interface between SQLite and the underlying operating system using the run-time pluggable VFS interface.

  • shell.c.in - This file is not part of the core SQLite library. This is the file that, when linked against sqlite3.a, generates the "sqlite3.exe" command-line shell. The "shell.c.in" file is transformed into "shell.c" as part of the build process.

  • tclsqlite.c - This file implements the Tcl bindings for SQLite. It is not part of the core SQLite library. But as most of the tests in this repository are written in Tcl, the Tcl language bindings are important.

  • test*.c - Files in the src/ folder that begin with "test" go into building the "testfixture.exe" program. The testfixture.exe program is an enhanced Tcl shell. The testfixture.exe program runs scripts in the test/ folder to validate the core SQLite code. The testfixture program (and some other test programs too) is built and run when you type "make test".

There are many other source files. Each has a succinct header comment that describes its purpose and role within the larger system.

Verifying Code Authenticity

The manifest file at the root directory of the source tree contains either a SHA3-256 hash or a SHA1 hash for every source file in the repository. The name of the version of the entire source tree is just the SHA3-256 hash of the manifest file itself, possibly with the last line of that file omitted if the last line begins with "# Remove this line". The manifest.uuid file should contain the SHA3-256 hash of the manifest file. If all of the above hash comparisons are correct, then you can be confident that your source tree is authentic and unadulterated. Details on the format for the manifest files are available on the Fossil website.

The process of checking source code authenticity is automated by the makefile:

make verify-source

Or on windows:

nmake /f Makefile.msc verify-source

Using the makefile to verify source integrity is good for detecting accidental changes to the source tree, but malicious changes could be hidden by also modifying the makefiles.

Contacts

The main SQLite website is https://sqlite.org/ with geographically distributed backups at https://www2.sqlite.org/ and https://www3.sqlite.org/.

sqlcipher's People

Contributors

0xflotus avatar billymeltdown avatar cnoon avatar developernotes avatar eighthave avatar eoger avatar indutny-signal avatar jberkel avatar jjlin avatar king6cong avatar likema avatar mkleusberg avatar pinkbyte avatar r4n avatar revolter avatar sc00bz avatar sjlombardo avatar smparkes avatar t8gilb avatar thelfensdrfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqlcipher's Issues

Error: SQL logic error or missing database

Screenshot
On c19c72f I cannot perform any operation on encrypted databases. As soon as PRAGMA key = 'some_key'; is executed, then next SQL operation fails with "Error: SQL logic error or missing database". This error also occurs after performing an ATTACH with a KEY specified.

I am on OSX 10.8.2. I used Xcode 4.6 (with the repo provided project) to generate an amalgamation. I then used the CMakeLists.txt file below to compile shell.c and sqlite3.c, and linked it with the OS provide libcrypto from OpenSSL.

Here's the "CMakeLists.txt" file that I used:

cmake_minimum_required(VERSION 2.8.8)
project(SQLite3)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/CMake ${CMAKE_MODULE_PATH})

find_package(OpenSSL)
if(NOT OPENSSL_FOUND)
message(FATAL_ERROR "OpenSSL is required for SQLCipher")
endif()

set(SQLITE3_FOUND TRUE CACHE INTERNAL "SQLite3 Found")
set(SQLITE3_LIBRARIES SQLite3 ${OPENSSL_LIBRARIES} CACHE INTERNAL "SQLite3 Libraries")
set(SQLITE3_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/include CACHE INTERNAL "SQLite3 Include Directories")
set(SQLITE3_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include CACHE INTERNAL "SQLite3 Include Directories")

add_definitions(
-D_LARGE_FILE=1
-D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE=1
-DSQLITE_ENABLE_RTREE=1
-DSQLITE_HAS_CODEC
-DSQLITE_TEMP_STORE=2
-DSQLITE_THREADSAFE
)

include_directories(${SQLITE3_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})

add_library(SQLite3 STATIC
${CMAKE_CURRENT_LIST_DIR}/sqlite3.c
${CMAKE_CURRENT_LIST_DIR}/include/sqlite3.h
${CMAKE_CURRENT_LIST_DIR}/include/sqlite3ext.h
)

option(BUILD_SQLITE3SHELL "Build the SQLite3 shell (sqlite3 executable)" ON)

if(BUILD_SQLITE3SHELL)
add_executable(SQLite3_Shell ${CMAKE_CURRENT_LIST_DIR}/shell.c)
target_link_libraries(SQLite3_Shell ${SQLITE3_LIBRARIES})
set_target_properties(SQLite3_Shell PROPERTIES OUTPUT_NAME sqlite3)
endif()

segfault on samsung galaxy tab 2 10 - android v. 4.0.4 and nexus 10

SQLCipher version 2.2.0 beta

Logcat from samsung galaxy tab 2 10

06-26 12:17:44.953: I/Database(6897): JNI_OnLoad called
06-26 12:17:44.953: I/Database(6897): JNI_OnLoad register methods
06-26 12:17:44.960: E/dalvikvm(6897): ERROR: couldn't find native method
06-26 12:17:44.960: E/dalvikvm(6897): Requested: Lnet/sqlcipher/CursorWindow;.getType_native:(II)I
06-26 12:17:44.960: E/JNIHelp(6897): RegisterNatives failed for 'net/sqlcipher/CursorWindow', aborting
06-26 12:17:44.960: A/libc(6897): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
06-26 12:17:45.179: D/com.mokafive.filebrowser.data.MoData(6897): #e40ab15 [] java.lang.Thread
06-26 12:17:45.304: D/com.mokafive.filebrowser.data.MoData(6897): #e40ab15 [] java.lang.Thread
06-26 12:17:45.312: D/dalvikvm(6897): Trying to load lib /data/data/com.mokafive.filebrowser/lib/libstlport_shared.so 0x412831e0
06-26 12:17:45.312: D/dalvikvm(6897): Shared lib '/data/data/com.mokafive.filebrowser/lib/libstlport_shared.so' already loaded in same CL 0x412831e0
06-26 12:17:45.312: D/dalvikvm(6897): Trying to load lib /data/data/com.mokafive.filebrowser/lib/libsqlcipher_android.so 0x412831e0
06-26 12:17:45.312: D/dalvikvm(6897): Shared lib '/data/data/com.mokafive.filebrowser/lib/libsqlcipher_android.so' already loaded in same CL 0x412831e0
06-26 12:17:45.312: D/dalvikvm(6897): Trying to load lib /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so 0x412831e0
06-26 12:17:45.312: D/dalvikvm(6897): Shared lib '/data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so' already loaded in same CL 0x412831e0
06-26 12:17:45.312: D/dalvikvm(6897): threadid=1: waiting for /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so OnLoad status
06-26 12:17:45.328: D/dalvikvm(6897): GC_CONCURRENT freed 423K, 8% free 7317K/7943K, paused 1ms+3ms
06-26 12:17:45.460: I/DEBUG(94): SET
06-26 12:17:45.460: I/DEBUG(94): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-26 12:17:45.460: I/DEBUG(94): Build fingerprint: 'samsung/espresso10wifixx/espresso10wifi:4.0.4/IMM76D/P5110XXBLH4:user/release-keys'
06-26 12:17:45.460: I/DEBUG(94): pid: 6897, tid: 6923 >>> com.mokafive.filebrowser <<<
06-26 12:17:45.460: I/DEBUG(94): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
06-26 12:17:45.460: I/DEBUG(94): r0 deadbaad r1 00000001 r2 40000000 r3 00000000
06-26 12:17:45.460: I/DEBUG(94): r4 00000000 r5 00000027 r6 40909c7d r7 00000019
06-26 12:17:45.460: I/DEBUG(94): r8 5d52c154 r9 1d200019 10 00000001 fp 00000000
06-26 12:17:45.460: I/DEBUG(94): ip ffffffff sp 5dc59cc0 lr 40039579 pc 40035908 cpsr 60000030
06-26 12:17:45.460: I/DEBUG(94): d0 74726f6261202c27 d1 2720726f66206465
06-26 12:17:45.460: I/DEBUG(94): d2 726573776f726267 d3 62696c2f62696c69
06-26 12:17:45.460: I/DEBUG(94): d4 532f676e616c2f61 d5 6a4c3b676e697274
06-26 12:17:45.460: I/DEBUG(94): d6 676e616c2f617661 d7 3b676e697274532f
06-26 12:17:45.460: I/DEBUG(94): d8 0000000000000000 d9 0000000000000000
06-26 12:17:45.460: I/DEBUG(94): d10 0000000000000000 d11 0000000000000000
06-26 12:17:45.460: I/DEBUG(94): d12 0000000000000000 d13 0000000000000000
06-26 12:17:45.460: I/DEBUG(94): d14 0000000000000000 d15 0000000000000000
06-26 12:17:45.460: I/DEBUG(94): d16 0000000741335ac8 d17 7e37e43c8800759c
06-26 12:17:45.460: I/DEBUG(94): d18 0000000000000000 d19 3ff0000000000000
06-26 12:17:45.460: I/DEBUG(94): d20 4071700000000000 d21 4074a00000000000
06-26 12:17:45.460: I/DEBUG(94): d22 3ff0000000000000 d23 0000000000000000
06-26 12:17:45.460: I/DEBUG(94): d24 0000000000000000 d25 3ff0000000000000
06-26 12:17:45.460: I/DEBUG(94): d26 4074a00000000000 d27 3ff0000000000000
06-26 12:17:45.460: I/DEBUG(94): d28 c00005c02b53cb8a d29 bf66fdec79316df6
06-26 12:17:45.460: I/DEBUG(94): d30 bc0a42cc192d5632 d31 be23e4f5df600000
06-26 12:17:45.460: I/DEBUG(94): scr 60000013
06-26 12:17:45.625: I/DEBUG(94): #00 pc 00017908 /system/lib/libc.so
06-26 12:17:45.625: I/DEBUG(94): #1 pc 0000c282 /system/lib/libnativehelper.so (jniRegisterNativeMethods)
06-26 12:17:45.625: I/DEBUG(94): #2 pc 000475c0 /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime21registerNativeMethodsEP7_JNIEnvPKcPK15JNINativeMethodi)
06-26 12:17:45.632: I/DEBUG(94): #3 pc 0000529e /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so (_ZN9sqlcipher38register_android_database_CursorWindowEP7_JNIEnv)
06-26 12:17:45.632: I/DEBUG(94): #4 pc 00002f6e /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so (JNI_OnLoad)
06-26 12:17:45.632: I/DEBUG(94): #5 pc 0005ab14 /system/lib/libdvm.so (_Z17dvmLoadNativeCodePKcP6ObjectPPc)
06-26 12:17:45.632: I/DEBUG(94): #6 pc 00072e44 /system/lib/libdvm.so
06-26 12:17:45.632: I/DEBUG(94): #7 pc 00030b8c /system/lib/libdvm.so
06-26 12:17:45.632: I/DEBUG(94): #8 pc 00034370 /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
06-26 12:17:45.632: I/DEBUG(94): #9 pc 0006cb52 /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValueSt9__va_list)
06-26 12:17:45.632: I/DEBUG(94): #10 pc 0006cb74 /system/lib/libdvm.so (_Z13dvmCallMethodP6ThreadPK6MethodP6ObjectP6JValuez)
06-26 12:17:45.632: I/DEBUG(94): #11 pc 0005fc44 /system/lib/libdvm.so
06-26 12:17:45.632: I/DEBUG(94): #12 pc 00012e8c /system/lib/libc.so (__thread_entry)
06-26 12:17:45.632: I/DEBUG(94): #13 pc 000129e0 /system/lib/libc.so (pthread_create)
06-26 12:17:45.632: I/DEBUG(94): code around pc:
06-26 12:17:45.632: I/DEBUG(94): 400358e8 4623b15c 2c006824 e026d1fb b12368db .#F$h.,..&..h#.
06-26 12:17:45.632: I/DEBUG(94): 400358f8 21014a17 6011447a 48124798 24002527 .J.!zD.`.G.H'%.$
06-26 12:17:45.632: I/DEBUG(94): 40035908 f7f47005 2106eeb4 ef50f7f5 460aa901 .p.....!..P....F
06-26 12:17:45.632: I/DEBUG(94): 40035918 f04f2006 94015380 94029303 eb0cf7f5 . O..S..........
06-26 12:17:45.632: I/DEBUG(94): 40035928 4622a905 f7f52002 f7f4eb16 2106eea0 .."F. .........!
06-26 12:17:45.632: I/DEBUG(94): code around lr:
06-26 12:17:45.632: I/DEBUG(94): 40039558 41f0e92d 46804c0c 447c2600 68a56824 -..A.L.F.&|D$h.h
06-26 12:17:45.632: I/DEBUG(94): 40039568 e0076867 300cf9b5 dd022b00 47c04628 gh.....0.+..(F.G
06-26 12:17:45.640: I/DEBUG(94): 40039578 35544306 37fff117 6824d5f4 d1ee2c00 .CT5...7..$h.,..
06-26 12:17:45.640: I/DEBUG(94): 40039588 e8bd4630 bf0081f0 00027fa6 41f0e92d 0F..........-..A
06-26 12:17:45.640: I/DEBUG(94): 40039598 fb01b086 9004f602 461f4815 4615460c .........H.F.F.F
06-26 12:17:45.640: I/DEBUG(94): memory map around addr deadbaad:
06-26 12:17:45.640: I/DEBUG(94): bee8d000-beeae000 [stack]
06-26 12:17:45.640: I/DEBUG(94): (no map for address)
06-26 12:17:45.640: I/DEBUG(94): ffff0000-ffff1000 [vectors]
06-26 12:17:45.640: I/DEBUG(94): stack:
06-26 12:17:45.640: I/DEBUG(94): 5dc59c80 5701ce68 /dev/ashmem/dalvik-LinearAlloc (deleted)
06-26 12:17:45.640: I/DEBUG(94): 5dc59c84 4094c201 /system/lib/libdvm.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59c88 5701c880 /dev/ashmem/dalvik-LinearAlloc (deleted)
06-26 12:17:45.640: I/DEBUG(94): 5dc59c8c 0000001c
06-26 12:17:45.640: I/DEBUG(94): 5dc59c90 40061794 /system/lib/libc.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59c94 40066888
06-26 12:17:45.640: I/DEBUG(94): 5dc59c98 00000000
06-26 12:17:45.640: I/DEBUG(94): 5dc59c9c 40039579 /system/lib/libc.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59ca0 00000000
06-26 12:17:45.640: I/DEBUG(94): 5dc59ca4 5dc59cd4
06-26 12:17:45.640: I/DEBUG(94): 5dc59ca8 40909c7d /system/lib/libdvm.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59cac 00000019
06-26 12:17:45.640: I/DEBUG(94): 5dc59cb0 5d52c154 /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59cb4 400386e5 /system/lib/libc.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59cb8 df0027ad
06-26 12:17:45.640: I/DEBUG(94): 5dc59cbc 00000000
06-26 12:17:45.640: I/DEBUG(94): #00 5dc59cc0 1d20001d
06-26 12:17:45.640: I/DEBUG(94): 5dc59cc4 5fa606d3
06-26 12:17:45.640: I/DEBUG(94): 5dc59cc8 5d529c4c /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59ccc 01752fd8 [heap]
06-26 12:17:45.640: I/DEBUG(94): 5dc59cd0 5d529c4c /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59cd4 fffffbdf
06-26 12:17:45.640: I/DEBUG(94): 5dc59cd8 00000019
06-26 12:17:45.640: I/DEBUG(94): 5dc59cdc 01752fd8 [heap]
06-26 12:17:45.640: I/DEBUG(94): 5dc59ce0 5d529c4c /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59ce4 4021f285 /system/lib/libnativehelper.so
06-26 12:17:45.640: I/DEBUG(94): #1 5dc59ce8 01752fd8 [heap]
06-26 12:17:45.640: I/DEBUG(94): 5dc59cec 1d20001d
06-26 12:17:45.640: I/DEBUG(94): 5dc59cf0 01752fd8 [heap]
06-26 12:17:45.640: I/DEBUG(94): 5dc59cf4 5d52c2a8 /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59cf8 5d529c4c /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59cfc 5d52a018 /data/data/com.mokafive.filebrowser/lib/libdatabase_sqlcipher.so
06-26 12:17:45.640: I/DEBUG(94): 5dc59d00 00000178
06-26 12:17:45.640: I/DEBUG(94): 5dc59d04 401aa5c3 /system/lib/libandroid_runtime.so
06-26 12:17:45.703: E/Watchdog(189): !@sync 92
06-26 12:17:48.351: I/DEBUG(94): EET
06-26 12:17:48.351: I/DEBUG(94): !@dumpstate -k -t -n -z -d -o /data/log/dumpstate_app_native -m 6897

Logcat from nexus 10

06-26 12:54:27.790: A/libc(5170): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 5222 (AsyncTask #5)
06-26 12:54:27.855: D/com.mokafive.filebrowser.data.MoData(5170): #e40ab15 [] java.lang.Thread
06-26 12:54:27.855: D/dalvikvm(5170): Trying to load lib /data/app-lib/com.mokafive.filebrowser-1/libstlport_shared.so 0x423e09f8
06-26 12:54:27.855: D/dalvikvm(5170): Shared lib '/data/app-lib/com.mokafive.filebrowser-1/libstlport_shared.so' already loaded in same CL 0x423e09f8
06-26 12:54:27.855: D/dalvikvm(5170): Trying to load lib /data/app-lib/com.mokafive.filebrowser-1/libsqlcipher_android.so 0x423e09f8
06-26 12:54:27.855: D/dalvikvm(5170): Shared lib '/data/app-lib/com.mokafive.filebrowser-1/libsqlcipher_android.so' already loaded in same CL 0x423e09f8
06-26 12:54:27.855: D/dalvikvm(5170): Trying to load lib /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so 0x423e09f8
06-26 12:54:27.855: D/dalvikvm(5170): Shared lib '/data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so' already loaded in same CL 0x423e09f8
06-26 12:54:27.855: D/dalvikvm(5170): threadid=1: waiting for /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so OnLoad status
06-26 12:54:27.895: I/DEBUG(124): *** *** *** *** *** *** *** *** *** *** *** *** *** *** ** ***
06-26 12:54:27.895: I/DEBUG(124): Build fingerprint: 'google/mantaray/manta:4.2.2/JDQ39/573038:user/release-keys'
06-26 12:54:27.895: I/DEBUG(124): Revision: '8'
06-26 12:54:27.895: I/DEBUG(124): pid: 5170, tid: 5222, name: AsyncTask #5 >>> com.mokafive.filebrowser <<<
06-26 12:54:27.895: I/DEBUG(124): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
06-26 12:54:27.995: I/DEBUG(124): r0 00000027 r1 deadbaad r2 40076258 r3 00000000
06-26 12:54:27.995: I/DEBUG(124): r4 00000000 r5 74b81cbc r6 4078b5cd r7 00000019
06-26 12:54:27.995: I/DEBUG(124): r8 744c4154 r9 1d200019 sl 00000000 fp 00000001
06-26 12:54:27.995: I/DEBUG(124): ip 4039dfe4 sp 74b81cb8 lr 400490d9 pc 40045772 cpsr 60000030
06-26 12:54:27.995: I/DEBUG(124): d0 74726f6261202c27 d1 646e6957726f7372
06-26 12:54:27.995: I/DEBUG(124): d2 6ca0e1986ca0e167 d3 6ca0e2086ca0e169
06-26 12:54:27.995: I/DEBUG(124): d4 6ca982e86ca982b0 d5 6ca983586ca98320
06-26 12:54:27.995: I/DEBUG(124): d6 6ca983c86ca98390 d7 6ca984386ca98400
06-26 12:54:27.995: I/DEBUG(124): d8 4980000000100000 d9 0000000041e80000
06-26 12:54:27.995: I/DEBUG(124): d10 0000000000000000 d11 0000000000000000
06-26 12:54:27.995: I/DEBUG(124): d12 0000000000000000 d13 0000000000000000
06-26 12:54:27.995: I/DEBUG(124): d14 0000000000000000 d15 0000000000000000
06-26 12:54:27.995: I/DEBUG(124): d16 0000000000000013 d17 0000000000000001
06-26 12:54:27.995: I/DEBUG(124): d18 0000000000000000 d19 0000000000000000
06-26 12:54:27.995: I/DEBUG(124): d20 0000000000000840 d21 0000000000000000
06-26 12:54:27.995: I/DEBUG(124): d22 0000000000000000 d23 0000000000000000
06-26 12:54:27.995: I/DEBUG(124): d24 3ff0000000000000 d25 3ff0000000000000
06-26 12:54:27.995: I/DEBUG(124): d26 0000000000000000 d27 c038000000000000
06-26 12:54:27.995: I/DEBUG(124): d28 0000000000000000 d29 3ff0000000000000
06-26 12:54:27.995: I/DEBUG(124): d30 3ff0000000000000 d31 3ff0000000000000
06-26 12:54:27.995: I/DEBUG(124): scr 80000093
06-26 12:54:28.000: I/DEBUG(124): backtrace:
06-26 12:54:28.000: I/DEBUG(124): #00 pc 0001a772 /system/lib/libc.so
06-26 12:54:28.000: I/DEBUG(124): #1 pc 00018070 /system/lib/libc.so (abort+4)
06-26 12:54:28.000: I/DEBUG(124): #2 pc 00000961 /system/lib/libnativehelper.so (jniRegisterNativeMethods+72)
06-26 12:54:28.000: I/DEBUG(124): #3 pc 0000529d /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so (sqlcipher::register_android_database_CursorWindow(JNIEnv)+144)
06-26 12:54:28.000: I/DEBUG(124): #4 pc 00002f6f /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so (JNI_OnLoad+82)
06-26 12:54:28.000: I/DEBUG(124): #5 pc 0004fa47 /system/lib/libdvm.so (dvmLoadNativeCode(char const_, Object_, char__)+470)
06-26 12:54:28.000: I/DEBUG(124): #6 pc 00066785 /system/lib/libdvm.so
06-26 12:54:28.000: I/DEBUG(124): #7 pc 000276a0 /system/lib/libdvm.so
06-26 12:54:28.000: I/DEBUG(124): #8 pc 0002b57c /system/lib/libdvm.so (dvmInterpret(Thread_, Method const_, JValue_)+184)
06-26 12:54:28.000: I/DEBUG(124): #9 pc 0005fc31 /system/lib/libdvm.so (dvmCallMethodV(Thread_, Method const_, Object_, bool, JValue_, std::va_list)+272)
06-26 12:54:28.000: I/DEBUG(124): #10 pc 0005fc5b /system/lib/libdvm.so (dvmCallMethod(Thread
, Method const
, Object_, JValue_, ...)+20)
06-26 12:54:28.000: I/DEBUG(124): #11 pc 000547d7 /system/lib/libdvm.so
06-26 12:54:28.000: I/DEBUG(124): #12 pc 0000e3d8 /system/lib/libc.so (__thread_entry+72)
06-26 12:54:28.000: I/DEBUG(124): #13 pc 0000dac4 /system/lib/libc.so (pthread_create+160)
06-26 12:54:28.000: I/DEBUG(124): stack:
06-26 12:54:28.000: I/DEBUG(124): 74b81c78 00000000
06-26 12:54:28.000: I/DEBUG(124): 74b81c7c 424ab058 /dev/ashmem/dalvik-heap (deleted)
06-26 12:54:28.000: I/DEBUG(124): 74b81c80 6cd2c6d8 /dev/ashmem/dalvik-LinearAlloc (deleted)
06-26 12:54:28.000: I/DEBUG(124): 74b81c84 407cc04a /system/lib/libdvm.so
06-26 12:54:28.000: I/DEBUG(124): 74b81c88 6cd2c0f0 /dev/ashmem/dalvik-LinearAlloc (deleted)
06-26 12:54:28.000: I/DEBUG(124): 74b81c8c 0000001c
06-26 12:54:28.000: I/DEBUG(124): 74b81c90 40073254 /system/lib/libc.so
06-26 12:54:28.000: I/DEBUG(124): 74b81c94 400731b4 /system/lib/libc.so
06-26 12:54:28.000: I/DEBUG(124): 74b81c98 00000000
06-26 12:54:28.000: I/DEBUG(124): 74b81c9c 400490d9 /system/lib/libc.so (_fwalk+32)
06-26 12:54:28.000: I/DEBUG(124): 74b81ca0 00000001
06-26 12:54:28.000: I/DEBUG(124): 74b81ca4 74b81cbc [stack:5222]
06-26 12:54:28.000: I/DEBUG(124): 74b81ca8 4078b5cd /system/lib/libdvm.so
06-26 12:54:28.000: I/DEBUG(124): 74b81cac 00000019
06-26 12:54:28.000: I/DEBUG(124): 74b81cb0 df0027ad
06-26 12:54:28.000: I/DEBUG(124): 74b81cb4 00000000
06-26 12:54:28.000: I/DEBUG(124): #00 74b81cb8 74b81cd4 [stack:5222]
06-26 12:54:28.000: I/DEBUG(124): 74b81cbc fffffbdf
06-26 12:54:28.000: I/DEBUG(124): 74b81cc0 424ab058 /dev/ashmem/dalvik-heap (deleted)
06-26 12:54:28.000: I/DEBUG(124): 74b81cc4 740a9d40
06-26 12:54:28.000: I/DEBUG(124): 74b81cc8 744c1c4c /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so
06-26 12:54:28.000: I/DEBUG(124): 74b81ccc 8eeb4222
06-26 12:54:28.000: I/DEBUG(124): 74b81cd0 740a9d40
06-26 12:54:28.000: I/DEBUG(124): 74b81cd4 740a9d40
06-26 12:54:28.000: I/DEBUG(124): 74b81cd8 744c1c4c /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so
06-26 12:54:28.000: I/DEBUG(124): 74b81cdc 40043074 /system/lib/libc.so (__pthread_clone)
06-26 12:54:28.000: I/DEBUG(124): #1 74b81ce0 8eeb4222
06-26 12:54:28.000: I/DEBUG(124): 74b81ce4 4039b965 /system/lib/libnativehelper.so (jniRegisterNativeMethods+76)
06-26 12:54:28.000: I/DEBUG(124): #2 74b81ce8 740a9d40
06-26 12:54:28.000: I/DEBUG(124): 74b81cec 1d20001d
06-26 12:54:28.000: I/DEBUG(124): 74b81cf0 740a9d40
06-26 12:54:28.000: I/DEBUG(124): 74b81cf4 744c42a8 /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so
06-26 12:54:28.000: I/DEBUG(124): 74b81cf8 744c1c4c /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so
06-26 12:54:28.000: I/DEBUG(124): 74b81cfc 744c2018 /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so
06-26 12:54:28.000: I/DEBUG(124): 74b81d00 00000178
06-26 12:54:28.000: I/DEBUG(124): 74b81d04 744c02a1 /data/app-lib/com.mokafive.filebrowser-1/libdatabase_sqlcipher.so (sqlcipher::register_android_database_CursorWindow(_JNIEnv
)+148)
06-26 12:54:28.005: I/DEBUG(124): memory near r2:
06-26 12:54:28.005: I/DEBUG(124): 40076238 00000007 00000002 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 40076248 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 40076258 00000001 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 40076268 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 40076278 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 40076288 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 40076298 00000000 00000000 0098ed5b 00000000
06-26 12:54:28.005: I/DEBUG(124): 400762a8 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 400762b8 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 400762c8 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 400762d8 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 400762e8 00000000 00000000 00000000 00000000
06-26 12:54:28.005: I/DEBUG(124): 400762f8 00000000 00000000 00000000 00004000
06-26 12:54:28.005: I/DEBUG(124): 40076308 00000000 00000000 00000000 00004000
06-26 12:54:28.005: I/DEBUG(124): 40076318 00000000 00000000 00000000 00004000
06-26 12:54:28.005: I/DEBUG(124): 40076328 00000000 00000000 00000000 00004000
06-26 12:54:28.005: I/DEBUG(124): memory near r5:
06-26 12:54:28.005: I/DEBUG(124): 74b81c9c 400490d9 00000001 74b81cbc 4078b5cd
06-26 12:54:28.005: I/DEBUG(124): 74b81cac 00000019 df0027ad 00000000 74b81cd4
06-26 12:54:28.005: I/DEBUG(124): 74b81cbc fffffbdf 424ab058 740a9d40 744c1c4c
06-26 12:54:28.005: I/DEBUG(124): 74b81ccc 8eeb4222 740a9d40 740a9d40 744c1c4c
06-26 12:54:28.005: I/DEBUG(124): 74b81cdc 40043074 8eeb4222 4039b965 740a9d40
06-26 12:54:28.005: I/DEBUG(124): 74b81cec 1d20001d 740a9d40 744c42a8 744c1c4c
06-26 12:54:28.005: I/DEBUG(124): 74b81cfc 744c2018 00000178 744c02a1 744bdf1d
06-26 12:54:28.005: I/DEBUG(124): 74b81d0c 00000001 00000000 744c0c10 41b5fe90
06-26 12:54:28.005: I/DEBUG(124): 74b81d1c 423e09f8 77052998 744bdf73 40020df4
06-26 12:54:28.005: I/DEBUG(124): 74b81d2c 740a9d40 71e76458 71e76458 74525460
06-26 12:54:28.005: I/DEBUG(124): 74b81d3c 4078da49 423e09f8 424b10a8 0000006e
06-26 12:54:28.010: I/DEBUG(124): 74b81d4c 7452546c 74525470 407ec1b0 71e76458
06-26 12:54:28.010: I/DEBUG(124): 74b81d5c 71e76458 00000000 770529a8 74b81d84
06-26 12:54:28.010: I/DEBUG(124): 74b81d6c 423e09f8 00000000 743cacd8 00000041
06-26 12:54:28.010: I/DEBUG(124): 74b81d7c 407a4789 743cacec 00000000 6dab306a
06-26 12:54:28.010: I/DEBUG(124): 74b81d8c 743cad08 77052998 41bd2fc0 4075c400
06-26 12:54:28.010: I/DEBUG(124): memory near r6:
06-26 12:54:28.010: I/DEBUG(124): 4078b5ac 43f8e8bd bdd1f01b 0005c762 fffffe60
06-26 12:54:28.010: I/DEBUG(124): 4078b5bc fffffe5c 00059d9a fffffe98 fffffcdb
06-26 12:54:28.010: I/DEBUG(124): 4078b5cc 4ff0e92d b0854605 a803460c 469b4629
06-26 12:54:28.010: I/DEBUG(124): 4078b5dc f7fb4617 4621fdfd f7fc9803 4604fdf5
06-26 12:54:28.010: I/DEBUG(124): 4078b5ec 4478483f f8906800 b13b3031 2004493d
06-26 12:54:28.010: I/DEBUG(124): 4078b5fc 44794a3d 447a69a3 e956f7d0 0800f04f
06-26 12:54:28.010: I/DEBUG(124): 4078b60c e897e063 f1ba0460 d05b0f00 29217831
06-26 12:54:28.010: I/DEBUG(124): 4078b61c f04fbf18 d1020900 f04f3601 46200901
06-26 12:54:28.010: I/DEBUG(124): 4078b62c 46324629 fe72f01d 4620bb08 46324629
06-26 12:54:28.010: I/DEBUG(124): 4078b63c fdfdf01d 4f2db9d8 4a2d2006 447a447f
06-26 12:54:28.010: I/DEBUG(124): 4078b64c f7d04639 4a2be932 0060e88d 69a34639
06-26 12:54:28.010: I/DEBUG(124): 4078b65c 2006447a e928f7d0 6ea16ee0 f7fb462a
06-26 12:54:28.010: I/DEBUG(124): 4078b66c 6e60fc43 462a6e21 fc3ef7fb 6843e02a
06-26 12:54:28.010: I/DEBUG(124): 4078b67c d40705d9 20054920 44794a20 0060e88d
06-26 12:54:28.010: I/DEBUG(124): 4078b68c e012447a 0f00f1b9 069ad013 491cd504
06-26 12:54:28.010: I/DEBUG(124): 4078b69c 44794a1c e005447a d40a071b 4a1b491a
06-26 12:54:28.010: I/DEBUG(124): memory near r8:
06-26 12:54:28.010: I/DEBUG(124): 744c4134 744c0c0c 744bf315 744c1a2c 744c1428
06-26 12:54:28.010: I/DEBUG(124): 744c4144 744bf3dd 744c1a3c 744c1a50 744bf369
06-26 12:54:28.010: I/DEBUG(124): 744c4154 744c1d8c 744c1d98 744c0135 744c1d8c
06-26 12:54:28.010: I/DEBUG(124): 744c4164 744c1da0 744c0375 744c1db8 744c1dcc
06-26 12:54:28.010: I/DEBUG(124): 744c4174 744c0441 744c1de4 744c0c0c 744c01b9
06-26 12:54:28.010: I/DEBUG(124): 744c4184 744c1df4 744c0c0c 744c00f5 744c1e04
06-26 12:54:28.015: I/DEBUG(124): 744c4194 744c1e14 744c0005 744c1e1c 744c1e2c
06-26 12:54:28.015: I/DEBUG(124): 744c41a4 744bfb11 744c1e34 744c1e44 744bf715
06-26 12:54:28.015: I/DEBUG(124): 744c41b4 744c1e4c 744c1e60 744bfbe1 744c1e78
06-26 12:54:28.015: I/DEBUG(124): 744c41c4 744c1e94 744bfd39 744c1ec0 744c1ed4
06-26 12:54:28.015: I/DEBUG(124): 744c41d4 744bfa31 744c1edc 744c1e44 744bf9f5
06-26 12:54:28.015: I/DEBUG(124): 744c41e4 744c1eec 744c143c 744bf50d 744c1f00
06-26 12:54:28.015: I/DEBUG(124): 744c41f4 744c1f18 744bf54d 744c1f20 744c1f30
06-26 12:54:28.015: I/DEBUG(124): 744c4204 744bf9d5 744c1f34 744c1f44 744bf90d
06-26 12:54:28.015: I/DEBUG(124): 744c4214 744c1f4c 744c1f60 744bf82d 744c1f78
06-26 12:54:28.015: I/DEBUG(124): 744c4224 744c1f88 744bf801 744c1f90 744c1fa4
06-26 12:54:28.015: I/DEBUG(124): memory near r9:
06-26 12:54:28.015: I/DEBUG(124): 1d1ffff8 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200008 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200018 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200028 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200038 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200048 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200058 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200068 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200078 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200088 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d200098 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d2000a8 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d2000b8 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d2000c8 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d2000d8 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): 1d2000e8 ffffffff ffffffff ffffffff ffffffff
06-26 12:54:28.015: I/DEBUG(124): memory near ip:
06-26 12:54:28.015: I/DEBUG(124): 4039dfc4 00000000 00000000 00000000 4004c761
06-26 12:54:28.015: I/DEBUG(124): 4039dfd4 4004c651 40043d49 40049a7d 40027319
06-26 12:54:28.015: I/DEBUG(124): 4039dfe4 4004306c 40050061 40047e91 400270fd
06-26 12:54:28.015: I/DEBUG(124): 4039dff4 40037f09 4003d771 4004c29d 4039e000
06-26 12:54:28.015: I/DEBUG(124): 4039e004 1d2000a6 6ca1cd18 6ca1ccc8 00000000
06-26 12:54:28.015: I/DEBUG(124): 4039e014 00000000 00000000 00000000 00000000
06-26 12:54:28.015: I/DEBUG(124): 4039e024 00000000 00000000 00000000 00000000
06-26 12:54:28.015: I/DEBUG(124): 4039e034 00000000 00000000 00000000 00000000
06-26 12:54:28.015: I/DEBUG(124): 4039e044 00000000 00000000 00000000 00000000
06-26 12:54:28.015: I/DEBUG(124): 4039e054 00000000 00000000 00000000 00000000
06-26 12:54:28.015: I/DEBUG(124): 4039e064 00000000 00000000 00000000 00000000
06-26 12:54:28.020: I/DEBUG(124): 4039e074 00000000 00000000 00000000 00000000
06-26 12:54:28.020: I/DEBUG(124): 4039e084 00000000 00000000 00000000 00000000
06-26 12:54:28.020: I/DEBUG(124): 4039e094 00000000 00000000 00000000 00000000
06-26 12:54:28.020: I/DEBUG(124): 4039e0a4 00000000 00000000 00000000 00000000
06-26 12:54:28.020: I/DEBUG(124): 4039e0b4 00000000 00000000 00000000 00000000
06-26 12:54:28.020: I/DEBUG(124): memory near sp:
06-26 12:54:28.020: I/DEBUG(124): 74b81c98 00000000 400490d9 00000001 74b81cbc
06-26 12:54:28.020: I/DEBUG(124): 74b81ca8 4078b5cd 00000019 df0027ad 00000000
06-26 12:54:28.020: I/DEBUG(124): 74b81cb8 74b81cd4 fffffbdf 424ab058 740a9d40
06-26 12:54:28.020: I/DEBUG(124): 74b81cc8 744c1c4c 8eeb4222 740a9d40 740a9d40
06-26 12:54:28.020: I/DEBUG(124): 74b81cd8 744c1c4c 40043074 8eeb4222 4039b965
06-26 12:54:28.020: I/DEBUG(124): 74b81ce8 740a9d40 1d20001d 740a9d40 744c42a8
06-26 12:54:28.020: I/DEBUG(124): 74b81cf8 744c1c4c 744c2018 00000178 744c02a1
06-26 12:54:28.020: I/DEBUG(124): 74b81d08 744bdf1d 00000001 00000000 744c0c10
06-26 12:54:28.020: I/DEBUG(124): 74b81d18 41b5fe90 423e09f8 77052998 744bdf73
06-26 12:54:28.020: I/DEBUG(124): 74b81d28 40020df4 740a9d40 71e76458 71e76458
06-26 12:54:28.020: I/DEBUG(124): 74b81d38 74525460 4078da49 423e09f8 424b10a8
06-26 12:54:28.020: I/DEBUG(124): 74b81d48 0000006e 7452546c 74525470 407ec1b0
06-26 12:54:28.020: I/DEBUG(124): 74b81d58 71e76458 71e76458 00000000 770529a8
06-26 12:54:28.020: I/DEBUG(124): 74b81d68 74b81d84 423e09f8 00000000 743cacd8
06-26 12:54:28.020: I/DEBUG(124): 74b81d78 00000041 407a4789 743cacec 00000000
06-26 12:54:28.020: I/DEBUG(124): 74b81d88 6dab306a 743cad08 77052998 41bd2fc0
06-26 12:54:28.020: I/DEBUG(124): code around pc:
06-26 12:54:28.020: I/DEBUG(124): 40045750 e000b164 6823461c d1fb2b00 68e3e026
06-26 12:54:28.020: I/DEBUG(124): 40045760 4a17b123 447a2401 47986014 20274911
06-26 12:54:28.020: I/DEBUG(124): 40045770 70082400 eb86f7fc f7fd2106 a902ecea
06-26 12:54:28.020: I/DEBUG(124): 40045780 f04f2006 460a5380 94029304 f7fd9403
06-26 12:54:28.020: I/DEBUG(124): 40045790 4629e8d0 20024622 e8d8f7fd eb72f7fc
06-26 12:54:28.020: I/DEBUG(124): 400457a0 f7fd2106 2001ecd6 e892f7fc 2a006962
06-26 12:54:28.020: I/DEBUG(124): 400457b0 e7d4d1dc deadbaad 0002d826 00030b0a
06-26 12:54:28.020: I/DEBUG(124): 400457c0 00030aee 2400b510 aa04b088 46699002
06-26 12:54:28.020: I/DEBUG(124): 400457d0 94014620 94039400 e830f7fd bfb842a0
06-26 12:54:28.020: I/DEBUG(124): 400457e0 db054620 b1139b07 1c489906 98069006
06-26 12:54:28.020: I/DEBUG(124): 400457f0 bd10b008 4604b510 e9c6f7fc d10542a0
06-26 12:54:28.025: I/DEBUG(124): 40045800 447b4b04 6018681b bd102000 30fff04f
06-26 12:54:28.025: I/DEBUG(124): 40045810 bf00bd10 0002d75a 460db538 481eb928
06-26 12:54:28.025: I/DEBUG(124): 40045820 f7fc4478 2800edc4 b9fdd130 2102481b
06-26 12:54:28.025: I/DEBUG(124): 40045830 f0014478 2800faae db274604 f7fc4629
06-26 12:54:28.025: I/DEBUG(124): 40045840 2800ec4e 2101db0b f7fc4620 2800ec48
06-26 12:54:28.025: I/DEBUG(124): code around lr:
06-26 12:54:28.025: I/DEBUG(124): 400490b8 41f0e92d 4c0b2600 447c4680 68a56824
06-26 12:54:28.025: I/DEBUG(124): 400490c8 e0076867 300cf9b5 dd022b00 47c04628
06-26 12:54:28.025: I/DEBUG(124): 400490d8 35544306 d5f53f01 2c006824 4630d1ef
06-26 12:54:28.025: I/DEBUG(124): 400490e8 81f0e8bd 00029ec2 43f0e92d fb01461f
06-26 12:54:28.025: I/DEBUG(124): 400490f8 f8dff602 b0878058 44f8460c 8000f8d8
06-26 12:54:28.025: I/DEBUG(124): 40049108 9001a901 f8d84615 20013000 96059602
06-26 12:54:28.025: I/DEBUG(124): 40049118 90049103 4638b113 fa35f7ff a9034638
06-26 12:54:28.025: I/DEBUG(124): 40049128 fe9bf7ff 2000f8d8 b1124681 f7ff4638
06-26 12:54:28.025: I/DEBUG(124): 40049138 f1b9fa37 d0050f00 46219d05 f01a1b70
06-26 12:54:28.025: I/DEBUG(124): 40049148 4605ed46 b0074628 83f0e8bd 00029e3a
06-26 12:54:28.025: I/DEBUG(124): 40049158 1e4b6841 2b006043 f000da01 6803bbab
06-26 12:54:28.025: I/DEBUG(124): 40049168 2b01f813 46106003 00004770 4604b570
06-26 12:54:28.025: I/DEBUG(124): 40049178 447e4e0d 68336836 f7ffb10b 6861fa04
06-26 12:54:28.025: I/DEBUG(124): 40049188 60601e48 bfa22800 f8106820 60205b01
06-26 12:54:28.025: I/DEBUG(124): 40049198 4620da03 fb8ef000 68324605 4620b112
06-26 12:54:28.025: I/DEBUG(124): 400491a8 f9fef7ff bd704628 00029dc2 447b4b07
06-26 12:54:28.025: I/DEBUG(124): memory map around fault addr deadbaad:
06-26 12:54:28.025: I/DEBUG(124): bee74000-bee95000 [stack]
06-26 12:54:28.025: I/DEBUG(124): (no map for address)
06-26 12:54:28.025: I/DEBUG(124): ffff0000-ffff1000 [vectors]

cannot ATTACH database within transaction

Hi,
I'm on an android machine.
I try to save a table from an encrypted database to another database.
Therefor I need to attach it first. I call

db.rawExecSQL("ATTACH DATABASE '"+tempdbfile.getAbsolutePath()+"' AS encrypted KEY 'empty_key_or_a_key_same_behavior');

I only get the
sqlite returned: error code = 1, msg = statement aborts at 5: [ATTACH DATABASE '/data/data/test/databases/temp.db' AS encrypted KEY '...'] cannot ATTACH database within transaction

Do you know whats wrong? Thanks
Herold

wrong expression

In file os_win.c in line 2052 must be:
if( locktype==PENDING_LOCK && res ){
instead of:
if( locktype==EXCLUSIVE_LOCK && res ){

xcode project

Oops... Accidentally closed the last issue, but if I open the sqlcipher project directly in xcode (3.2) and build I get the following.

Build sqlcipher of project sqlcipher with configuration Debug

CompileC /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/Objects-normal/i386/sqlite3.o sqlite3.c normal i386 c com.apple.compilers.gcc.4_2
cd /Users/tmanners/Dev/sqlcipher
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x c -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -mfix-and-continue -gdwarf-2 -iquote /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-generated-files.hmap -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-own-target-headers.hmap -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-all-target-headers.hmap -iquote /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-project-headers.hmap -F/Users/tmanners/Dev/xcode-build/Debug -I/Users/tmanners/Dev/xcode-build/Debug/include -I/Users/tmanners/dev/openssl-1.0.0a/include -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/DerivedSources/i386 -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/DerivedSources -DSQLITE_HAS_CODEC -DNDEBUG -DSQLITE_TEMP_STORE=2 -c /Users/tmanners/Dev/sqlcipher/sqlite3.c -o /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/Objects-normal/i386/sqlite3.o

i686-apple-darwin10-gcc-4.2.1: /Users/tmanners/Dev/sqlcipher/sqlite3.c: No such file or directory
i686-apple-darwin10-gcc-4.2.1: warning: '-x c' after last input file has no effect
i686-apple-darwin10-gcc-4.2.1: no input files
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1

CompileC /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/Objects-normal/ppc/sqlite3.o sqlite3.c normal ppc c com.apple.compilers.gcc.4_2
cd /Users/tmanners/Dev/sqlcipher
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x c -arch ppc -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -mfix-and-continue -mtune=G5 -gdwarf-2 -iquote /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-generated-files.hmap -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-own-target-headers.hmap -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-all-target-headers.hmap -iquote /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/sqlcipher-project-headers.hmap -F/Users/tmanners/Dev/xcode-build/Debug -I/Users/tmanners/Dev/xcode-build/Debug/include -I/Users/tmanners/dev/openssl-1.0.0a/include -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/DerivedSources/ppc -I/Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/DerivedSources -DSQLITE_HAS_CODEC -DNDEBUG -DSQLITE_TEMP_STORE=2 -c /Users/tmanners/Dev/sqlcipher/sqlite3.c -o /Users/tmanners/Dev/xcode-build/sqlcipher.build/Debug/sqlcipher.build/Objects-normal/ppc/sqlite3.o

powerpc-apple-darwin10-gcc-4.2.1: /Users/tmanners/Dev/sqlcipher/sqlite3.c: No such file or directory
powerpc-apple-darwin10-gcc-4.2.1: warning: '-x c' after last input file has no effect
powerpc-apple-darwin10-gcc-4.2.1: no input files
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1

problem in reading already existing encrypted database in android application

Hi,
I encrypted my already existing sqlite database using sqlcipher_export like here

$ ./sqlite3 plaintext.db
sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey';
sqlite> SELECT sqlcipher_export('encrypted');
sqlite> DETACH DATABASE encrypted;

while trying to read this database in my android application using

            SQLiteDatabase db = getReadableDatabase("testkey");
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    String [] sqlSelect = {"0 _id", "Name"}; 
    String sqlTables = "name_names";

    qb.setTables(sqlTables);
    Cursor c = qb.query(db, sqlSelect, "Name LIKE ?", new String[]{"%John%"},
            null, null, null);

results in no table found error, while I'm able to access the data using sqlcipher commandline on my mac with same key.
any reasong why this is happening ?

getting unencrypted database..

hey,
am trying to use sqlcipher for encrypted my unencrypted database ,
I followed the tutorial on sqcipher.net ,,,
and every thing looks ok with no obvious issues
but when I try to encrypt the db using the attached approach or sqlite_key..
I get the same original db with no encryption at all ...
I am using Xcode 4.1 with MAC OS X Lion V10.7
I tried and got the following
ddadmac1:sqlcipher apple$ make clean
rm -f .lo *.la *.o sqlite3 libsqlite3.la
rm -f sqlite3.h opcodes.

rm -rf .libs .deps
rm -f lemon lempar.c parse.* sqlite*.tar.gz
rm -f mkkeywordhash keywordhash.h
rm -f
rm -f *.da *.bb *.bbg gmon.out
rm -rf tsrc .target_source
rm -f testfixture test.db
rm -f sqlite3.dll sqlite3.lib sqlite3.def
rm -f sqlite3.c
ddadmac1:sqlcipher apple$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2" LDFLAGS="/users/apple/desktop/arabicnames/lib/libcrypto.a"
checking build system type... i386-apple-darwin11.0.0
checking host system type... i386-apple-darwin11.0.0
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... no
checking for -exported_symbols_list linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uintptr_t... yes
checking for sys/types.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for usleep... yes
checking for fdatasync... yes
checking for localtime_r... yes
checking for gmtime_r... yes
checking for localtime_s... no
checking for tclsh8.5... tclsh8.5
configure: Version set to 3.7
configure: Release set to 3.7.2
configure: Version number set to 3007002
checking whether to support threadsafe operation... yes
checking for library containing pthread_create... none required
checking whether to allow connections to be shared across threads... no
checking whether threads can override each others locks... no
checking whether to support shared library linked as release mode or not... no
checking whether to use an in-ram database for temporary tables... yes
checking if executables have the .exe suffix... unknown
checking host system type... (cached) i386-apple-darwin11.0.0
checking for Tcl configuration... found /usr/lib/tclConfig.sh
checking for existence of /usr/lib/tclConfig.sh... loading
checking for library containing tgetent... -lncurses
checking for readline in -lreadline... yes
checking readline.h usability... no
checking readline.h presence... no
checking for readline.h... no
checking for /usr/include/readline.h... no
checking for /usr/include/readline/readline.h... yes
checking for library containing fdatasync... none required
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
ddadmac1:sqlcipher apple$ make
tclsh ./tool/mksqlite3h.tcl . >sqlite3.h
gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -o mkkeywordhash -DSQLITE_OMIT_LOAD_EXTENSION=1 ./tool/mkkeywordhash.c
: warning: missing whitespace after the macro name
./mkkeywordhash >keywordhash.h
gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -o lemon ./tool/lemon.c
: warning: missing whitespace after the macro name
cp ./src/lempar.c .
cp ./src/parse.y .
rm -f parse.h
./lemon -DSQLITE_OMIT_LOAD_EXTENSION=1 parse.y
mv parse.h parse.h.temp
awk -f ./addopcodes.awk parse.h.temp >parse.h
cat parse.h ./src/vdbe.c | awk -f ./mkopcodeh.awk >opcodes.h
sort -n -b -k 3 opcodes.h | awk -f ./mkopcodec.awk >opcodes.c
rm -rf tsrc
mkdir tsrc
cp -f ./src/crypto.h ./src/crypto.c ./src/alter.c ./src/analyze.c ./src/attach.c ./src/auth.c ./src/backup.c ./src/bitvec.c ./src/btmutex.c ./src/btree.c ./src/btree.h ./src/btreeInt.h ./src/build.c ./src/callback.c ./src/complete.c ./src/ctime.c ./src/date.c ./src/delete.c ./src/expr.c ./src/fault.c ./src/fkey.c ./src/func.c ./src/global.c ./src/hash.c ./src/hash.h ./src/hwtime.h ./src/insert.c ./src/journal.c ./src/legacy.c ./src/loadext.c ./src/main.c ./src/malloc.c ./src/mem0.c ./src/mem1.c ./src/mem2.c ./src/mem3.c ./src/mem5.c ./src/memjournal.c ./src/mutex.c ./src/mutex.h ./src/mutex_noop.c ./src/mutex_os2.c ./src/mutex_unix.c ./src/mutex_w32.c ./src/notify.c ./src/os.c ./src/os.h ./src/os_common.h ./src/os_os2.c ./src/os_unix.c ./src/os_win.c ./src/pager.c ./src/pager.h ./src/parse.y ./src/pcache.c ./src/pcache.h ./src/pcache1.c ./src/pragma.c ./src/prepare.c ./src/printf.c ./src/random.c ./src/resolve.c ./src/rowset.c ./src/select.c ./src/status.c ./src/shell.c ./src/sqlite.h.in ./src/sqlite3ext.h ./src/sqliteInt.h ./src/sqliteLimit.h ./src/table.c ./src/tclsqlite.c ./src/tokenize.c ./src/trigger.c ./src/utf.c ./src/update.c ./src/util.c ./src/vacuum.c ./src/vdbe.c ./src/vdbe.h ./src/vdbeapi.c ./src/vdbeaux.c ./src/vdbeblob.c ./src/vdbemem.c ./src/vdbetrace.c ./src/vdbeInt.h ./src/vtab.c ./src/wal.c ./src/wal.h ./src/walker.c ./src/where.c ./ext/fts1/fts1.c ./ext/fts1/fts1.h ./ext/fts1/fts1_hash.c ./ext/fts1/fts1_hash.h ./ext/fts1/fts1_porter.c ./ext/fts1/fts1_tokenizer.h ./ext/fts1/fts1_tokenizer1.c ./ext/fts2/fts2.c ./ext/fts2/fts2.h ./ext/fts2/fts2_hash.c ./ext/fts2/fts2_hash.h ./ext/fts2/fts2_icu.c ./ext/fts2/fts2_porter.c ./ext/fts2/fts2_tokenizer.h ./ext/fts2/fts2_tokenizer.c ./ext/fts2/fts2_tokenizer1.c ./ext/fts3/fts3.c ./ext/fts3/fts3.h ./ext/fts3/fts3Int.h ./ext/fts3/fts3_expr.c ./ext/fts3/fts3_hash.c ./ext/fts3/fts3_hash.h ./ext/fts3/fts3_icu.c ./ext/fts3/fts3_porter.c ./ext/fts3/fts3_snippet.c ./ext/fts3/fts3_tokenizer.h ./ext/fts3/fts3_tokenizer.c ./ext/fts3/fts3_tokenizer1.c ./ext/fts3/fts3_write.c ./ext/icu/sqliteicu.h ./ext/icu/icu.c ./ext/rtree/rtree.h ./ext/rtree/rtree.c keywordhash.h opcodes.c opcodes.h parse.c parse.h config.h sqlite3.h tsrc
rm tsrc/sqlite.h.in tsrc/parse.y
tclsh8.5 ./tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
mv vdbe.new tsrc/vdbe.c
touch .target_source
tclsh8.5 ./tool/mksqlite3c.tcl
./libtool --mode=compile --tag=CC gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c
libtool: compile: gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c -fno-common -DPIC -o .libs/sqlite3.o
: warning: missing whitespace after the macro name
sqlite3.c: In function ‘activate_openssl’:
sqlite3.c:11783: warning: ‘EVP_get_cipherbyname’ is deprecated (declared at /usr/include/openssl/evp.h:848)
sqlite3.c:11784: warning: ‘OPENSSL_add_all_algorithms_noconf’ is deprecated (declared at /usr/include/openssl/evp.h:828)
sqlite3.c: In function ‘codec_key_derive’:
sqlite3.c:11948: warning: ‘PKCS5_PBKDF2_HMAC_SHA1’ is deprecated (declared at /usr/include/openssl/evp.h:920)
sqlite3.c: In function ‘codec_cipher’:
sqlite3.c:11981: warning: ‘RAND_pseudo_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:105)
sqlite3.c:11986: warning: ‘EVP_CipherInit’ is deprecated (declared at /usr/include/openssl/evp.h:598)
sqlite3.c:11987: warning: ‘EVP_CIPHER_CTX_set_padding’ is deprecated (declared at /usr/include/openssl/evp.h:641)
sqlite3.c:11988: warning: ‘EVP_CipherInit’ is deprecated (declared at /usr/include/openssl/evp.h:598)
sqlite3.c:11989: warning: ‘EVP_CipherUpdate’ is deprecated (declared at /usr/include/openssl/evp.h:603)
sqlite3.c:11992: warning: ‘EVP_CipherFinal’ is deprecated (declared at /usr/include/openssl/evp.h:604)
sqlite3.c:11994: warning: ‘EVP_CIPHER_CTX_cleanup’ is deprecated (declared at /usr/include/openssl/evp.h:637)
sqlite3.c: In function ‘codec_set_cipher_name’:
sqlite3.c:12035: warning: ‘EVP_get_cipherbyname’ is deprecated (declared at /usr/include/openssl/evp.h:848)
sqlite3.c:12036: warning: ‘EVP_CIPHER_key_length’ is deprecated (declared at /usr/include/openssl/evp.h:494)
sqlite3.c:12037: warning: ‘EVP_CIPHER_iv_length’ is deprecated (declared at /usr/include/openssl/evp.h:495)
sqlite3.c: In function ‘sqlite3CodecAttach’:
sqlite3.c:12163: warning: ‘RAND_pseudo_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:105)
sqlite3.c: In function ‘sqlite3_rekey’:
sqlite3.c:12253: warning: ‘RAND_pseudo_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:105)
libtool: compile: gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c -o sqlite3.o >/dev/null 2>&1
./libtool --mode=link gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 /users/apple/desktop/arabicnames/lib/libcrypto.a -o libsqlite3.la sqlite3.lo
-rpath "/usr/local/lib" -version-info "8:6:8"

*** Warning: Linking the shared library libsqlite3.la against the
*** static library /users/apple/desktop/arabicnames/lib/libcrypto.a is not portable!
libtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libsqlite3.0.dylib .libs/sqlite3.o /users/apple/desktop/arabicnames/lib/libcrypto.a -install_name /usr/local/lib/libsqlite3.0.dylib -compatibility_version 9 -current_version 9.6
libtool: link: dsymutil .libs/libsqlite3.0.dylib || :
warning: no debug symbols in executable (-arch x86_64)
libtool: link: (cd ".libs" && rm -f "libsqlite3.dylib" && ln -s "libsqlite3.0.dylib" "libsqlite3.dylib")
libtool: link: ar cru .libs/libsqlite3.a /users/apple/desktop/arabicnames/lib/libcrypto.a sqlite3.o
libtool: link: ranlib .libs/libsqlite3.a
libtool: link: ( cd ".libs" && rm -f "libsqlite3.la" && ln -s "../libsqlite3.la" "libsqlite3.la" )
./libtool --mode=link gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 /users/apple/desktop/arabicnames/lib/libcrypto.a -DHAVE_READLINE=1 -I/usr/include/readline
-o sqlite3 ./src/shell.c libsqlite3.la
-lreadline -lncurses -rpath "/usr/local/lib"
libtool: link: gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DHAVE_READLINE=1 -I/usr/include/readline -o .libs/sqlite3 ./src/shell.c /users/apple/desktop/arabicnames/lib/libcrypto.a ./.libs/libsqlite3.dylib -lreadline -lncurses
: warning: missing whitespace after the macro name
./libtool --mode=compile --tag=CC gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_TCL_STUBS=1 -c ./src/tclsqlite.c
libtool: compile: gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_TCL_STUBS=1 -c ./src/tclsqlite.c -fno-common -DPIC -o .libs/tclsqlite.o
: warning: missing whitespace after the macro name
./src/tclsqlite.c: In function ‘DbObjCmd’:
./src/tclsqlite.c:2326: warning: passing argument 3 of ‘tclStubsPtr->tcl_GetWideIntFromObj’ from incompatible pointer type
libtool: compile: gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_TCL_STUBS=1 -c ./src/tclsqlite.c -o tclsqlite.o >/dev/null 2>&1
./libtool --mode=link gcc -DSQLITE_HAS_CODEC-SQLITE_TEMP_STORE=2 -DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_OMIT_LOAD_EXTENSION=1 /users/apple/desktop/arabicnames/lib/libcrypto.a -o libtclsqlite3.la tclsqlite.lo
libsqlite3.la -L/System/Library/Frameworks/Tcl.framework/Versions/8.5 -ltclstub8.5
-rpath "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/sqlite3"
-version-info "8:6:8"
-avoid-version

*** Warning: Linking the shared library libtclsqlite3.la against the
*** static library /users/apple/desktop/arabicnames/lib/libcrypto.a is not portable!
libtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libtclsqlite3.dylib .libs/tclsqlite.o /users/apple/desktop/arabicnames/lib/libcrypto.a ./.libs/libsqlite3.dylib -L/System/Library/Frameworks/Tcl.framework/Versions/8.5 -ltclstub8.5 -install_name /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/sqlite3/libtclsqlite3.dylib
libtool: link: dsymutil .libs/libtclsqlite3.dylib || :
warning: no debug symbols in executable (-arch x86_64)
libtool: link: ar cru .libs/libtclsqlite3.a /users/apple/desktop/arabicnames/lib/libcrypto.a tclsqlite.o
libtool: link: ranlib .libs/libtclsqlite3.a
libtool: link: ( cd ".libs" && rm -f "libtclsqlite3.la" && ln -s "../libtclsqlite3.la" "libtclsqlite3.la" )
ddadmac1:sqlcipher apple$ sqlite3 test.db
SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table t1(a,b);
sqlite> insrt into t1 values(1,2);
Error: near "insrt": syntax error
sqlite> insert into t1 values(1,2);
sqlite> attach database 'enc.db' as enc key 'secret';
sqlite> create table enc.t1(a,b);
sqlite> insert into enc.t1 select * from main.t1;
sqlite> select * from enc.t1;
1|2
sqlite> .schema
CREATE TABLE t1(a,b);
sqlite> .quit

ddadmac1:sqlcipher apple$ sqlite3 enc.db
SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
CREATE TABLE t1(a,b);//still not encrypted!!!
sqlite> select * from t1;
1|2

I hope u can see where is my problem located ,,, I am sure it worked with many but i just dunno why its not working with me :(

thnx alot ,,, I hope my issue is clear !!

password that ends in a double-quote causes exception

For SQLCipher.net (x86), setting the connection property Password to a string that ends in a double-qoute causes, upon conn.Open(), an exception to be thrown:

Invalid ConnectionString format for parameter "password"

Encrypted database created with Iphone simulator/Device non functional across platforms

Hi Stephen,

I ran into this error where I can create non-encrypted database and it can be passed between platforms (Windows/Iphone Device/Simulator) without errors. Now with encrypted version, I am confined to work on the platform that generated the database. i.e. database created under Windows environment can only work with Windows code and same for Iphone simulator/Device.

Any clues?

Thanks,
George

Unable to compile on Ubuntu 11.10

Hi,

I'm trying to compile with:

./configure --disable-tcl --enable-tempstore=yes --enable-releasemode --disable-amalgamation

But the final link failed with:

./.libs/libsqlite3.so: undefined reference to `sqlcipher_exportFunc'

Any clue ?

sqlite 3.7.17 merge question?

after compare sqlite 3.7.17 and sqlcipher-prerelease branch, I found these is difference in pragma.c here:
...
--- Vdbe v = sqlite3GetVdbe(pParse); / Prepared statement /
+++ Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(db); /
Prepared statement /
/
* BEGIN CRYPTO **/

ifdef SQLITE_HAS_CODEC

.....

but diff from 3.6.16 to 3.6.17 gives:
--- Vdbe v = pParse->pVdbe = sqlite3VdbeCreate(db); / Prepared statement /
+++ Vdbe *v = sqlite3GetVdbe(pParse); /
Prepared statement */

which line should be used ?is this a git merge problem ?

Does SQLCipher pod requires adding openssl-xcode and OPENSSL_SRC manually *Rubymotion

I have added the SQLCipher pod in the rake file of a rubymotion project and running into issues now.
When I try to compile the application it throws an error 👎

***** executing ranlib on libraries in /Users/ashish/Documents/Workspace/iOS/Rubymotion/firm_directory/vendor/openssl-xcode/.build *****

  • ranlib /Users/ashish/Documents/Workspace/iOS/Rubymotion/firm_directory/vendor/openssl-xcode/.build/libcrypto.a
    ranlib: can't open file: /Users/ashish/Documents/Workspace/iOS/Rubymotion/firm_directory/vendor/openssl-xcode/.build/libcrypto.a (No such file or directory)
  • ranlib /Users/ashish/Documents/Workspace/iOS/Rubymotion/firm_directory/vendor/openssl-xcode/.build/libssl.a
    ranlib: can't open file: /Users/ashish/Documents/Workspace/iOS/Rubymotion/firm_directory/vendor/openssl-xcode/.build/libssl.a (No such file or directory)

** BUILD FAILED **

The following build commands failed:
PhaseScriptExecution "Run Script" build/openssl.build/Release-iphonesimulator/crypto.build/Script-9038ACD812DCAC96004FA0D0.sh
(1 failure)
rake aborted!
Command failed with status (65): [/usr/bin/xcodebuild -project "openssl.xcod...]
/Library/RubyMotion/lib/motion/project/vendor.rb:163:in block in build_xcode' /Library/RubyMotion/lib/motion/project/vendor.rb:132:inchdir'
/Library/RubyMotion/lib/motion/project/vendor.rb:132:in build_xcode' /Library/RubyMotion/lib/motion/project/vendor.rb:41:inbuild'
/Library/RubyMotion/lib/motion/project/builder.rb:57:in block in build' /Library/RubyMotion/lib/motion/project/builder.rb:56:ineach'
/Library/RubyMotion/lib/motion/project/builder.rb:56:in build' /Library/RubyMotion/lib/motion/project/app.rb:72:inbuild'
/Library/RubyMotion/lib/motion/project.rb:51:in block (2 levels) in <top (required)>' /Users/ashish/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:ineval'
/Users/ashish/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `

'
Tasks: TOP => default => simulator => build:simulator
(See full trace by running task with --trace)

How do I configure the project settings to pull openssl-xcode and openssl and compile then on build ?

Please help me out!

Hi, I am a naive user with SQLCipher. I am having problems in understanding it initially.

I am using the following method for rekeying my database:

  • (void) reKey:(NSString *)masterKey
    {
    sqlite3_exec(_db, [[NSString stringWithFormat:@"PRAGMA rekey = '%@'", masterKey] UTF8String], NULL, NULL, NULL);

}

With the above method I am able to encrypt my database by calling the method with the masterkey value as e.g. @"112"

Now also I have to decrypt my database.
To do this first I am opening my database with the existing key,

Then rekeying it by calling the above method with the masterKey parameter as nil.

but then also I am not able to get the decrypted data.
& now when I am opening the database with key as nil, I am getting an error in opening the database.
Please reply soon!

Error in opening the database file

@sjlombardo

Hi......Hope you are doing well.

Thanks for the this tutorial "tutorial-iphone-sqlite-encryption-with-sqlcipher".

I am trying to encrypt my database by following your tutorial. While in the process i am able to build it with out any errors. And after that i created a database outside the xcode project (i.e stored in desktop location). And now opened my terminal and done the following process as you mention in one of the issue:

1)went to the SQLCipher source directory and
2)then ./configure CFLAGS="-DSQLITE_HAS_CODEC -lcrypto
3)/sqlite3 /path/to/your/database

When it loads then run some commands:

4)sqlite> pragma key = '43ec78dec5e8805d143bb1a1452d274ff49cb';
5)sqlite> select * from sqlite_master;

After this i copied the sqlite database file into xcode project and done with the following code:

-(void) checkAndCreateDatabase{// in this method i am copying the TerminalDb.sqlite file from resource folder to document folder of the app.

// Check if the SQL database has already been saved to the users phone, if not then copy it over
BOOL success;

// Create a FileManager object, we will use this to check the status
// of the database and to copy it over if required
NSFileManager *fileManager = [NSFileManager defaultManager];

databaseName = @"TerminalDb.sqlite";

// Get the path to the documents directory and append the databaseName
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

// Check if the database has already been created in the users filesystem
success = [fileManager fileExistsAtPath:databasePath];

// If the database already exists then return without doing anything
if(success) return;

// If not then proceed to copy the database from the application to the users filesystem

// Get the path to the database in the application package
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];

// Copy the database from the package to the users filesystem
[fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil];
[fileManager release];

}

-(void) check{
NSString *databasePath1 = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
stringByAppendingPathComponent: @"TerminalDb.sqlite"];
sqlite3 *db;

if (sqlite3_open([databasePath1 UTF8String], &db) == SQLITE_OK) {

    sqlite3_exec(db, "pragma key = '43ec78dec5e8805d143bb1a1452d274ff49cb'", NULL, NULL, NULL);

             if (sqlite3_exec(db, (const char*) "SELECT count(*) FROM sqlite_master;", NULL, NULL, NULL) == SQLITE_OK) {
                     NSLog(@"Entered the if condition");
                 // password is correct, or, database has been initialized
                 } else {
                     NSLog(@"Entered the else condition");
                 // incorrect password!
                 }
                 }

//ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'secret'; //-- create a new encrypted database

// CREATE TABLE encrypted.t1(a,b); //-- recreate the schema in the new database (you can inspect all objects using SELECT * FROM sqlite_master)
// INSERT INTO encrypted.t1 SELECT * FROM t1; ///-- copy data from the existing tables to the new tables in the encrypted database
// DETACH DATABASE encrypted;

}
-(void)createPatientTempTable // here i am creating a table in TerminalDb.sqlite.
{

NSArray *arrDocPath1 =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
// b create the actual destination path

NSString *strDestPath1 = [NSString stringWithFormat:@"%@/TerminalDb.sqlite",[arrDocPath1 objectAtIndex:0]];

if (sqlite3_open([strDestPath1 UTF8String], &database) != SQLITE_OK)
{
    sqlite3_close(database); // in case partially opened
    database = nil; // signal open error
}
sqlite3_exec(database, "pragma key = '43ec78dec5e8805d143bb1a1452d274ff49cb'", NULL, NULL, NULL);

BOOL ret;
int rc;
// SQL to create new database
const char *createItemsSQL = 
"CREATE TABLE 'temp_patient_table' ('id' INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , 'firstname' TEXT, 'secondname' TEXT, 'temppatient_id' TEXT)";

sqlite3_stmt *stmt;
rc = sqlite3_prepare_v2(database, createItemsSQL, -1, &stmt, NULL);

ret = (rc == SQLITE_OK);
if (ret)
{ // statement built, execute
    rc = sqlite3_step(stmt);
    ret = (rc == SQLITE_DONE);
}

sqlite3_finalize(stmt); // free statement

}
-(void)copyPatientDetailsToTempTable{ // here inserting data into the table

NSArray *arrDocPath1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
//    // Create the actual destination path
NSString *strDestPath1 = [NSString stringWithFormat:@"%@/TerminalDb.sqlite",[arrDocPath1 objectAtIndex:0]];

if(sqlite3_open([strDestPath1 UTF8String], &database) == SQLITE_OK)
{
    sqlite3_exec(database, "pragma key = '43ec78dec5e8805d143bb1a1452d274ff49cb'", NULL, NULL, NULL);



        NSString *insertQuery = @"INSERT INTO temp_patient_table(firstname,secondname,temppatient_id) VALUES('chakra','gemb','8')";


        void *v;
        char *err_msg;

        if(sqlite3_exec(database, [insertQuery UTF8String] , 0 , v , &err_msg) == SQLITE_OK)
        {
            NSLog(@"inserted successfully ");



        }
        else {

            NSLog(@"insertion has some problem %s",sqlite3_errmsg(database));

        }

    }



}

-(void)getAllPhysicianDetails{ // here for getting the data inside the table

NSArray *arrDocPath1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
//    // Create the actual destination path
NSString *strDestPath1 = [NSString stringWithFormat:@"%@/TerminalDb.sqlite",[arrDocPath1 objectAtIndex:0]];


if(sqlite3_open([strDestPath1 UTF8String], &database) == SQLITE_OK) {

    sqlite3_exec(database, "pragma key = '43ec78dec5e8805d143bb1a1452d274ff49cb'", NULL, NULL, NULL);
    NSString *query;

    query = @"select firstname,secondname,temppatient_id from temp_patient_table";




    const char *sql = [query UTF8String];

    sqlite3_stmt *statement = nil;

    if(sqlite3_prepare_v2(database,sql, -1, &statement, NULL)!= SQLITE_OK){

        NSLog(@"error");

    }
    //NSAssert1(0,@”error preparing statement”,sqlite3_errmsg(database));

    else

    {
        while(sqlite3_step(statement)==SQLITE_ROW){

            NSString *strTempPhysicianId = [NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement, 0)];
            NSLog(@"%@",strTempPhysicianId);

            NSString *first = [NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement, 1)];

            NSLog(@"%@",first);

            NSString *last=[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement, 2)];

            NSLog(@"%@",last);


        }


    }

    sqlite3_finalize(statement);
}

}

All the four methods work fine with out any error....and i am able insert and retrieve the data back from the table.

But while opening the sqlite file in the application's document folder from firefox it is showing the following error:

"SQLiteManager: Error in opening file TerminalDb.sqlite - either the file is encrypted or corrupt
Exception Name: NS_ERROR_FILE_CORRUPTED
Exception Message: Component returned failure code: 0x8052000b (NS_ERROR_FILE_CORRUPTED) [mozIStorageService.openUnsharedDatabase]"

Can i know the reason behind the error and solution to see database (TerminalDb.sqlite) file in encrypted formatting if everything done up to now is correct. if any thing went wrong please give detailed solution for it.

Thanks for reading everything which i mentioned above.

Hope you reply me soon.

Cheers
Radhar.

Link Error in XCode 4

I have followed the tutorial very carefully a few times now, and I seem to get to the same point every time, when I get a link error saying "Library not found for -lcrypto". It seems to go through the entire build process, running the scripts, then at the very end of the build process the error pops up.

libcrypto.a and libsqlcipher.a are both listed (respectively) at the top of my Link Binary With Libraries list. crypto and sqlcipher are both listed under my Target Dependencies list as well.

For my build location under the "Locations" tab in Preferences, I have selected "Place build products in locations specified by targets" and I changed the "Build Products Path" to the directory path with the libraries in it.

The Header Search Paths look to be correct as I've checked them many times, and my path references in the Source Trees tab in Preferences for SQLCIPHER_SRC and OPENSSL_SRC are correct. They show up in the Header Search Paths like this : path/to/directory/openssl/** and the same for sqlcipher.

The only part of the tutorial that I wasn't able to complete in Xcode 4 was to change the Path Type to "Relative to SQLCIPHER_SRC" or for the OPENSSL_SRC, because I couldnt find the option in Xcode 4. Could this be my problem?

Any help would be great, and I can provide you with any more information if you'd like, I've been stuck on this for days.

Thanks,

Brian

Crash when using Android SDK Emulator with Intel x86 Atom System Image

As mentioned, this occurs on an emulator running the Intel x86 Image, API Level 15.

The error is:

E/AndroidRuntime(2957): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1453]: 794 unknown reloc type 22 @ 0xacf97b1c (0)

Relevant StackTrace:

12-18 03:04:36.504: E/AndroidRuntime(2957): at java.lang.Runtime.loadLibrary(Runtime.java:370)

12-18 03:04:36.504: E/AndroidRuntime(2957): at java.lang.System.loadLibrary(System.java:535)

12-18 03:04:36.504: E/AndroidRuntime(2957): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:142)

12-18 03:04:36.504: E/AndroidRuntime(2957): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:137)

I am using SQLCipher for Android 2.0.8

Regards, Michael

crash inside activate_openssl() in multithreaded application

Crash occur when SqlCipher is used in multithreaded Qt application (embedded inside qsqlite driver) and two threads prepares "PRAGMA key=..." statement using two different sqlite connections.

Debugger shows problem deep inside OpenSSL_add_all_algorithms(), witch seems not to be thread-safe function, called exactly at the same time by two threads.

We have avoided crash by implementing following changes inside crypto.c:


  static void activate_openssl() {
+   sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); 
    if(EVP_get_cipherbyname(CIPHER) == NULL) {
      OpenSSL_add_all_algorithms();
    } 
+   sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
  }

Error while compiling PHP with sqlcipher sqlite3.so extension

Hi!

I am compiling php after following instructions at http://sqlcipher.net/sqlcipher-for-php. I get following errors when I run make command.

/home/haisum/sqlcipher/php-5.4.0/ext/sqlite3/sqlite3.c:124: undefined reference to `php_checkuid'
ext/sqlite3/.libs/sqlite3.o: In function `php_sqlite3_authorizer':
/home/haisum/sqlcipher/php-5.4.0/ext/sqlite3/sqlite3.c:1966: undefined reference to `php_checkuid'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_activate':
sqlite3.c:(.text+0x1112): undefined reference to `EVP_get_cipherbyname'
sqlite3.c:(.text+0x1139): undefined reference to `OPENSSL_add_all_algorithms_noconf'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_deactivate':
sqlite3.c:(.text+0x1188): undefined reference to `EVP_cleanup'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_random':
sqlite3.c:(.text+0x12aa): undefined reference to `RAND_bytes'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_codec_ctx_set_cipher':
sqlite3.c:(.text+0x1957): undefined reference to `EVP_get_cipherbyname'
sqlite3.c:(.text+0x196b): undefined reference to `EVP_CIPHER_key_length'
sqlite3.c:(.text+0x1982): undefined reference to `EVP_CIPHER_iv_length'
sqlite3.c:(.text+0x1999): undefined reference to `EVP_CIPHER_block_size'
sqlite3.c:(.text+0x19a7): undefined reference to `EVP_sha1'
sqlite3.c:(.text+0x19af): undefined reference to `EVP_MD_size'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_codec_ctx_get_cipher':
sqlite3.c:(.text+0x1a40): undefined reference to `EVP_CIPHER_nid'
sqlite3.c:(.text+0x1a48): undefined reference to `OBJ_nid2sn'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_page_hmac':
sqlite3.c:(.text+0x2296): undefined reference to `HMAC_CTX_init'
sqlite3.c:(.text+0x229b): undefined reference to `EVP_sha1'
sqlite3.c:(.text+0x22d2): undefined reference to `HMAC_Init_ex'
sqlite3.c:(.text+0x22f1): undefined reference to `HMAC_Update'
sqlite3.c:(.text+0x2311): undefined reference to `HMAC_Update'
sqlite3.c:(.text+0x2331): undefined reference to `HMAC_Final'
sqlite3.c:(.text+0x2341): undefined reference to `HMAC_CTX_cleanup'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_page_cipher':
sqlite3.c:(.text+0x258d): undefined reference to `EVP_CipherInit'
sqlite3.c:(.text+0x25a3): undefined reference to `EVP_CIPHER_CTX_set_padding'
sqlite3.c:(.text+0x25d4): undefined reference to `EVP_CipherInit'
sqlite3.c:(.text+0x25fe): undefined reference to `EVP_CipherUpdate'
sqlite3.c:(.text+0x2626): undefined reference to `EVP_CipherFinal'
sqlite3.c:(.text+0x263a): undefined reference to `EVP_CIPHER_CTX_cleanup'
ext/sqlite3/libsqlite/.libs/sqlite3.o: In function `sqlcipher_cipher_ctx_key_derive':
sqlite3.c:(.text+0x27a6): undefined reference to `PKCS5_PBKDF2_HMAC_SHA1'
sqlite3.c:(.text+0x287e): undefined reference to `PKCS5_PBKDF2_HMAC_SHA1'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

HMAC check fails when endianness is different

SQLCipher includes the page number in the HMAC check for a page. This is intended to prevent an attacker from swapping a page from one position in a file to another. However the implementation of sqlcipher_page_hmac() adds the raw page number without converting it to a platform-independent representation. This will cause checks to fail when opening a database on big-endian that that was created on little-endian, or the other way around.

To fix this, SQLCipher should convert the page number to a consistent byte ordering before calculating the HMAC for a page so that the byte representation of the page number is the same regardless of endianness.

Reported by Pawel Marciniak [email protected]

SQLCipher in ios6 Undefined symbols for architecture armv7s (architecture already changed)

Hi,

I have a problem building sqlcipher with xcode 4.5.2. Basically I followed the examples at http://mobileorchard.com/tutorial-iphone-sqlite-encryption-with-sqlcipher/ and http://sqlcipher.net/ios-tutorial/ . Unfortunately I end up with a message telling me that the ssl lib and the sqlcipher lib are not build for armv7s.

Error message:

ld: warning: ignoring file /Users/jeven/Library/Developer/<...>/Debug-iphoneos/libsqlcipher.a, file was built for archive which is not the architecture being linked (armv7s): /Users/jeven/Library/Developer/<...>/Debug-iphoneos/libsqlcipher.a
ld: warning: ignoring file /Users/jeven/Library/Developer/<...>/Debug-iphoneos/libcrypto.a, file was built for archive which is not the architecture being linked (armv7s): /Users/jeven/Library/Developer/<...>/Debug-iphoneos/libcrypto.a

Undefined symbols for architecture armv7s:
      "_sqlite3_prepare_v2", referenced from:
...

I know this has been posted a couple of times but I already changed the target architecture for the openssl and the sqlcipher projects, as you can see in the following screen shots.

openssl:
openssl

sqlcipher:
sqlcipher

I am really kind of stuck here :( Does anyone has a hint for me?

(I posted this question also at stack overflow.com and I promise to cross link the answer ;) )

SqlCipher reading data from encrypt database issue

Hi Stephen,

Hope you doing good!.

I have unencrypted database and i encrypt the same database using below code:

BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:@"MapOutAnalytics.sqlite"];
// Check if the database has already been created in the users filesystem
success = [fileManager fileExistsAtPath:databasePath];
// If the database already exists then return without doing anything
if(success) return;
// If not then proceed to copy the database from the application to the users filesystem
// Get the path to the database in the application package
NSString *databasePathFromApp = [[NSBundle mainBundle] pathForResource:@"MapOutAnalytics" ofType:@"sqlite"];

// Copy the database from the package to the users filesystem
BOOL val = [fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil];
if (sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
{
    int result;
    NSString *encryptedPath = [NSString stringWithFormat:@"%@/Documents/MapOutAnaltics_encrypted.sqlite",NSHomeDirectory()];
    result = sqlite3_exec(database, [[NSString stringWithFormat:@"attach database '%@' as encrypted key '%@';",encryptedPath, @"test123"] UTF8String], NULL, NULL, NULL);

    if (result == SQLITE_OK){
        result = sqlite3_exec(database,[@"PRAGMA encrypted.cipher_page_size = 4096;" UTF8String], NULL, NULL, NULL);
        if (result == SQLITE_OK){
            result = sqlite3_exec(database,[@"SELECT sqlcipher_export('encrypted');" UTF8String], NULL, NULL, NULL);
            if (result == SQLITE_OK){
                result = sqlite3_exec(database, [@"DETACH DATABASE encrypted;" UTF8String], NULL, NULL, NULL);
                if (result == SQLITE_OK){
                    NSLog(@"DONE");
                }else{
                    NSLog(@"fail to detach database code == %d",result);
                }
            }else{
                NSLog(@"fail to export database with code == %d",result);
            }
        }else{
            NSLog(@"fail to set page size == %d",result);
        }
    }else{
        NSLog(@"fail to attach database with code == %d",result);
    }

sqlite3_close(database);
}else{
    NSLog(@"fail to open the database");
}

Above program in separate method works fine and it creates an encrypt database.

As of now no issue.
Now issues start now:

  1. opening the encrypt database from terminal:
    ./configure CFLAGS="-DSQLITE_HAS_CODEC -lcrypto"
    make
    idc-srikanth:sqlcipher ICSS-IOS4$ ./sqlite3 /Users/ICSS-IOS4/Library/Application\ Support/iPhone\ Simulator/5.1/Applications/53B95563-1B56-4970-8EE2-E5051317203C/Documents/MapOutAnaltics_encrypted.sqlite
    SQLite version 3.7.14.1 2012-10-04 19:37:12
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> pragma key = 'test123';
    sqlite> select * from sqlite_master;
    Error: file is encrypted or is not a database
    sqlite> .tables

i can't open the database and check. Please help if i am missing anything.

  1. From code: after encrypt an database i am calling below method:

-(void)readDataBase{

databasePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]stringByAppendingPathComponent: @"MapOutAnalytics_encrypted.sqlite"];
NSLog(@"the DataBasePath is ::%@",databasePath);

sqlite3 *db;
if (sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK) {

    const char* key = [@"test123" UTF8String];
    char *error = nil;
    sqlite3_key(db, key, strlen(key));
    if (sqlite3_exec(db, (const char*) "SELECT count(*) FROM sqlite_master;", NULL, NULL, &error) == SQLITE_OK) {
        // password is correct, or, database has been initialized
        NSLog(@"correct password");
    } else {
        // incorrect password!
        NSLog(@"incorrect password");
    }
    NSString * query = [NSString stringWithFormat:@"select * from dimDistricts;"];
    sqlite3_stmt *statement = NULL;

    int rec = sqlite3_prepare_v2(db, [query UTF8String], -1, &statement, NULL);
    if (rec == SQLITE_OK){
        int row = sqlite3_step(statement);
        while ( row == SQLITE_ROW){
            NSLog(@" column name == %s ",sqlite3_column_name(statement,0));
            NSLog(@" column text == %s ",sqlite3_column_text(statement, 0));
        }
    }
    else{
        NSLog(@"Error");
    }
    sqlite3_finalize(statement);
    sqlite3_close(db);
}

}

Output:

  1. printing the correct password. -> Good
  2. Now on the prepare query its giving the error. I checked that table name 'dimDistricts' is present in original plain database. -> Need help here.
    I just want to get the data from database.

Your small hint would be save a lot of effort. Please let me know if i am missing anything.

Issue 3:
While converting the encrypted database to plain database i am getting the below error:

./sqlite3 /Users/ICSS-IOS4/Library/Application\ Support/iPhone\ Simulator/5.1/Applications/53B95563-1B56-4970-8EE2-E5051317203C/Documents/MapOutAnaltics_encrypted.sqlite
SQLite version 3.7.14.1 2012-10-04 19:37:12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key = 'test123';
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY '';
Error: file is encrypted or is not a database

Please suggest.

Thanks,
Sandeep

Android SQLCipher DB Size

I am using SQLCipher in a new product. I am finding that the DB Size on ICS Devices is around 20-50KB as it should be. On version 2.x devices, this DB balloons to 6.78MB. What could possibly be the issue here.

I have even taken all the table creation out of the onCreate and the blank db is still around that same size.

I have used SQLCipher in quite a few iOS projects and never seen an issue like this. It is critical that I find a fix, or I all have to pull the use of the product which I do not want.

Currently the app has over 600,000 installs and a majority of the people are complaining about the size.

Database corruption due to broken page size init

Sometimes after using an sqlcipher encrypted database continuously for some period of time (up to a couple of days usually), it spontaneously becomes unopenable with a "File is encrypted or not a database" error. This happens because of a bug in the way the btree class initialises its page size -- it expects the first 100 bytes of the file to be in the clear, but when they are encrypted the results are unreliable, leading to this corruption.

The encrypted header is accessed by the SQLite btree class during initialisation. The file is accessed directly via sqlite3OsRead rather than via a codec. It tries to read the page size from bytes 16 and 17 of the file, which is of course an arbitrary value since the entire file is encrypted, including the first page. Usually, this arbitrary value does not happen to be a power of two, and therefore it fails validation and is overridden by the default page size (1024). However, occasionally this happens to be a power of two within SQLite's page size limits, and SQLite tries to read the file with this (incorrect) page size. This results in an "File is encrypted or not a database" when trying to open the database.

In the 1.1.7 tarball, the problem is at btree.c:1819
To bodge around this issue, change that line to simply assign pageSize to 0 -- that leads to the default values being used instead of any read from the file header.

Application crash in android version 2.2

Hi
When i am using sqlcipher with android version 2.2 the app get crashed.and it works well with 2.3 and above versions.As i have included the icudt46l.zip in assets folder but the issue is still there.I just copy paste the zip to assets folder is that enough?
Please any one give me a good solution .below is my crash log in android 2.2

03-24 05:04:26.440: E/AndroidRuntime(15069): FATAL EXCEPTION: main 03-24 05:04:26.440: E/AndroidRuntime(15069): info.guardianproject.database.sqlcipher.SQLiteException: not an error 03-24 05:04:26.440: E/AndroidRuntime(15069): at info.guardianproject.database.sqlcipher.SQLiteDatabase.dbopen(Native Method) 03-24 05:04:26.440: E/AndroidRuntime(15069): at info.guardianproject.database.sqlcipher.SQLiteDatabase.(SQLiteDatabase.java:1870) 03-24 05:04:26.440: E/AndroidRuntime(15069): at info.guardianproject.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:863) 03-24 05:04:26.440: E/AndroidRuntime(15069): at info.guardianproject.database.sqlcipher.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:183) 03-24 05:04:26.440: E/AndroidRuntime(15069): at android.view.View.performClick(View.java:2408) 03-24 05:04:26.440: E/AndroidRuntime(15069): at android.view.View$PerformClick.run(View.java:8818) 03-24 05:04:26.440: E/AndroidRuntime(15069): at android.os.Handler.handleCallback(Handler.java:587) 03-24 05:04:26.440: E/AndroidRuntime(15069): at android.os.Handler.dispatchMessage(Handler.java:92) 03-24 05:04:26.440: E/AndroidRuntime(15069): at android.os.Looper.loop(Looper.java:123) 03-24 05:04:26.440: E/AndroidRuntime(15069): at android.app.ActivityThread.main(ActivityThread.java:4627) 03-24 05:04:26.440: E/AndroidRuntime(15069): at java.lang.reflect.Method.invokeNative(Native Method) 03-24 05:04:26.440: E/AndroidRuntime(15069): at java.lang.reflect.Method.invoke(Method.java:521) 03-24 05:04:26.440: E/AndroidRuntime(15069): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871) 03-24 05:04:26.440: E/AndroidRuntime(15069): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 03-24 05:04:26.440: E/AndroidRuntime(15069): at dalvik.system.NativeStart.main(Native Method)

java.lang.NoClassDefFoundError: net/sqlcipher/database/SQLiteDatabase

I am trying to implement sqlcipher library to make my database encrypted
I am following tutorial provided at
http://sqlcipher.net/sqlcipher-for-android/
but when ever I am trying to run my application I am getting
java.lang.NoClassDefFoundError: net/sqlcipher/database/SQLiteDatabase

I have done with all clean up of project and every thing but not able to locate this library.

secondly, there is some thing mentioned for NDK also but as it is not clear and unable to understand.
can some on please provide steps to implement sqlcipher.

sqlcipher encrypt but does not decrypt

Hi ,

I have used sqlcipher successfully in one of my apps , Now am trying to use it a gain in my new app ... I've done every thing I ad done before ,, the issue now that it is not decrypting after encrypting using the same key and the same procedure I've done before!!! but it is not working now ..

actually I've updated the Xcode 4.1 to Xcode 4.3 and the OS X from Lion 10.7 to 10.7.3 ..

also am using sqlcipher v2 .and i followed the tutorial ,, \ I am using dynamic linking

I hope you can help me ,, and thanx alot

sqlcipher built on solaris 10 sparc platform failed to decrypt

We downloaded sqlcipher-sqlcipher-v2.0.6-1-gceee996.zip and built it on our Solaris 10 SPARC-Enterprise-T5220 platform. The built went okay. We can also decrypt sqlcipher-1.1.8-testkey.db but when we tried to decrypt a sqlite3 database, we got the following error: "Error: file is encrypted or is not a database". On the contrary, we used the same source code sqlcipher-sqlcipher-v2.0.6-1-gceee996.zip, built it on a linux fedora 12 i686 machine and the decryption of both sqlcipher-1.1.8-testkey.db and sqlite3 database is working. Would you please help investigate this issue?

Here is the built information for your investigation. Many thanks!

-bash-3.00# ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
checking build system type... sparc-sun-solaris2.10
checking host system type... sparc-sun-solaris2.10
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/sfw/bin/ggrep
checking for egrep... /usr/sfw/bin/ggrep -E
checking for fgrep... /usr/sfw/bin/ggrep -F
checking for ld used by gcc... /usr/ccs/bin/ld
checking if the linker (/usr/ccs/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/ccs/bin/nm -p
checking the name lister (/usr/ccs/bin/nm -p) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786240
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... no
checking for /usr/ccs/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/ccs/bin/nm -p output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... solaris2.10 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for a BSD-compatible install... ./install-sh -c
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uintptr_t... yes
checking for sys/types.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for usleep... yes
checking for fdatasync... no
checking for localtime_r... yes
checking for gmtime_r... yes
checking for localtime_s... no
checking for utime... yes
checking for malloc_usable_size... no
checking for tclsh8.5... tclsh8.5
configure: Version set to 3.7
configure: Release set to 3.7.12.1
configure: Version number set to 3007012
checking whether to support threadsafe operation... yes
checking for library containing pthread_create... none required
checking whether to allow connections to be shared across threads... no
checking whether to support shared library linked as release mode or not... no
checking whether to use an in-ram database for temporary tables... yes
checking if executables have the .exe suffix... unknown
checking host system type... (cached) sparc-sun-solaris2.10
checking for Tcl configuration... found /usr/local/lib/tclConfig.sh
checking for existence of /usr/local/lib/tclConfig.sh... loading
checking for library containing tgetent... -lcurses
checking for readline in -lreadline... no
checking readline.h usability... no
checking readline.h presence... no
checking for readline.h... no
checking for /usr/include/readline.h... no
checking for /usr/include/readline/readline.h... no
checking for /usr/local/include/readline.h... no
checking for /usr/local/include/readline/readline.h... no
checking for /usr/local/readline/include/readline.h... no
checking for /usr/local/readline/include/readline/readline.h... no
checking for /usr/contrib/include/readline.h... no
checking for /usr/contrib/include/readline/readline.h... no
checking for /mingw/include/readline.h... no
checking for /mingw/include/readline/readline.h... no
checking for library containing fdatasync... -lrt
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: creating config.h
config.status: executing libtool commands
-bash-3.00# make
tclsh8.5 ./tool/mksqlite3h.tcl . >sqlite3.h
gcc -DSQLITE_HAS_CODEC -o mkkeywordhash -DSQLITE_OMIT_LOAD_EXTENSION=1 ./tool/mkkeywordhash.c
./mkkeywordhash >keywordhash.h
gcc -DSQLITE_HAS_CODEC -o lemon ./tool/lemon.c
cp ./src/lempar.c .
cp ./src/parse.y .
rm -f parse.h
./lemon -DSQLITE_OMIT_LOAD_EXTENSION=1 parse.y
mv parse.h parse.h.temp
nawk -f ./addopcodes.awk parse.h.temp >parse.h
cat parse.h ./src/vdbe.c | nawk -f ./mkopcodeh.awk >opcodes.h
nawk -f ./mkopcodec.awk opcodes.h >opcodes.c
rm -rf tsrc
mkdir tsrc
cp -f ./src/crypto.h ./src/crypto.c ./src/crypto_impl.c ./src/alter.c ./src/analyze.c ./src/attach.c ./src/auth.c ./src/backup.c ./src/bitvec.c ./src/btmutex.c ./src/btree.c ./src/btree.h ./src/btreeInt.h ./src/build.c ./src/callback.c ./src/complete.c ./src/ctime.c ./src/date.c ./src/delete.c ./src/expr.c ./src/fault.c ./src/fkey.c ./src/func.c ./src/global.c ./src/hash.c ./src/hash.h ./src/hwtime.h ./src/insert.c ./src/journal.c ./src/legacy.c ./src/loadext.c ./src/main.c ./src/malloc.c ./src/mem0.c ./src/mem1.c ./src/mem2.c ./src/mem3.c ./src/mem5.c ./src/memjournal.c ./src/mutex.c ./src/mutex.h ./src/mutex_noop.c ./src/mutex_os2.c ./src/mutex_unix.c ./src/mutex_w32.c ./src/notify.c ./src/os.c ./src/os.h ./src/os_common.h ./src/os_os2.c ./src/os_unix.c ./src/os_win.c ./src/pager.c ./src/pager.h ./src/parse.y ./src/pcache.c ./src/pcache.h ./src/pcache1.c ./src/pragma.c ./src/prepare.c ./src/printf.c ./src/random.c ./src/resolve.c ./src/rowset.c ./src/select.c ./src/status.c ./src/shell.c ./src/sqlite.h.in ./src/sqlite3ext.h ./src/sqliteInt.h ./src/sqliteLimit.h ./src/table.c ./src/tclsqlite.c ./src/tokenize.c ./src/trigger.c ./src/utf.c ./src/update.c ./src/util.c ./src/vacuum.c ./src/vdbe.c ./src/vdbe.h ./src/vdbeapi.c ./src/vdbeaux.c ./src/vdbeblob.c ./src/vdbemem.c ./src/vdbesort.c ./src/vdbetrace.c ./src/vdbeInt.h ./src/vtab.c ./src/wal.c ./src/wal.h ./src/walker.c ./src/where.c ./ext/fts1/fts1.c ./ext/fts1/fts1.h ./ext/fts1/fts1_hash.c ./ext/fts1/fts1_hash.h ./ext/fts1/fts1_porter.c ./ext/fts1/fts1_tokenizer.h ./ext/fts1/fts1_tokenizer1.c ./ext/fts2/fts2.c ./ext/fts2/fts2.h ./ext/fts2/fts2_hash.c ./ext/fts2/fts2_hash.h ./ext/fts2/fts2_icu.c ./ext/fts2/fts2_porter.c ./ext/fts2/fts2_tokenizer.h ./ext/fts2/fts2_tokenizer.c ./ext/fts2/fts2_tokenizer1.c ./ext/fts3/fts3.c ./ext/fts3/fts3.h ./ext/fts3/fts3Int.h ./ext/fts3/fts3_aux.c ./ext/fts3/fts3_expr.c ./ext/fts3/fts3_hash.c ./ext/fts3/fts3_hash.h ./ext/fts3/fts3_icu.c ./ext/fts3/fts3_porter.c ./ext/fts3/fts3_snippet.c ./ext/fts3/fts3_tokenizer.h ./ext/fts3/fts3_tokenizer.c ./ext/fts3/fts3_tokenizer1.c ./ext/fts3/fts3_write.c ./ext/icu/sqliteicu.h ./ext/icu/icu.c ./ext/rtree/rtree.h ./ext/rtree/rtree.c keywordhash.h opcodes.c opcodes.h parse.c parse.h config.h sqlite3.h tsrc
rm tsrc/sqlite.h.in tsrc/parse.y
tclsh8.5 ./tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
mv vdbe.new tsrc/vdbe.c
touch .target_source
tclsh8.5 ./tool/mksqlite3c.tcl
./libtool --mode=compile --tag=CC gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c
libtool: compile: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c -fPIC -DPIC -o .libs/sqlite3.o
libtool: compile: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c -o sqlite3.o >/dev/null 2>&1
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -lcrypto -o libsqlite3.la sqlite3.lo -lrt
-rpath "/usr/local/lib" -version-info "8:6:8"
libtool: link: gcc -shared -Wl,-z -Wl,text -Wl,-h -Wl,libsqlite3.so.0 -o .libs/libsqlite3.so.0.8.6 .libs/sqlite3.o -lcrypto -lrt -lc
libtool: link: (cd ".libs" && rm -f "libsqlite3.so.0" && ln -s "libsqlite3.so.0.8.6" "libsqlite3.so.0")
libtool: link: (cd ".libs" && rm -f "libsqlite3.so" && ln -s "libsqlite3.so.0.8.6" "libsqlite3.so")
libtool: link: ar cru .libs/libsqlite3.a sqlite3.o
libtool: link: ranlib .libs/libsqlite3.a
libtool: link: ( cd ".libs" && rm -f "libsqlite3.la" && ln -s "../libsqlite3.la" "libsqlite3.la" )
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -lcrypto -DHAVE_READLINE=0
-o sqlite3 ./src/shell.c libsqlite3.la
-lrt -rpath "/usr/local/lib"
libtool: link: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DHAVE_READLINE=0 -o .libs/sqlite3 ./src/shell.c ./.libs/libsqlite3.so -lcrypto -lrt -R/usr/local/lib
./libtool --mode=compile --tag=CC gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_TCL_STUBS=1 -c ./src/tclsqlite.c
libtool: compile: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_TCL_STUBS=1 -c ./src/tclsqlite.c -fPIC -DPIC -o .libs/tclsqlite.o
libtool: compile: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_TCL_STUBS=1 -c ./src/tclsqlite.c -o tclsqlite.o >/dev/null 2>&1
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/local/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -lcrypto -o libtclsqlite3.la tclsqlite.lo
libsqlite3.la -L/usr/local/lib -ltclstub8.5 -lrt
-rpath "/usr/local/lib/tcl8.5/sqlite3"
-version-info "8:6:8"
-avoid-version
libtool: link: gcc -shared -Wl,-z -Wl,text -Wl,-h -Wl,libtclsqlite3.so -o .libs/libtclsqlite3.so .libs/tclsqlite.o -R/export/home/root/sqlcipher-sqlcipher-ceee996/.libs -R/usr/local/lib ./.libs/libsqlite3.so -lcrypto -L/usr/local/lib -ltclstub8.5 -lrt -lc
libtool: link: ar cru .libs/libtclsqlite3.a tclsqlite.o
libtool: link: ranlib .libs/libtclsqlite3.a
libtool: link: ( cd ".libs" && rm -f "libtclsqlite3.la" && ln -s "../libtclsqlite3.la" "libtclsqlite3.la" )
-bash-3.00#
-bash-3.00$ ldd /usr/local/bin/sqlite3
libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0
libcrypto.so.0.9.7 => /usr/sfw/lib/libcrypto.so.0.9.7
librt.so.1 => /lib/librt.so.1
libc.so.1 => /lib/libc.so.1
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libaio.so.1 => /lib/libaio.so.1
libmd.so.1 => /lib/libmd.so.1
libmp.so.2 => /lib/libmp.so.2
libscf.so.1 => /lib/libscf.so.1
libdoor.so.1 => /lib/libdoor.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
libcrypto_extra.so.0.9.7 => /usr/sfw/lib/libcrypto_extra.so.0.9.7
libm.so.2 => /lib/libm.so.2
/platform/SUNW,SPARC-Enterprise-T5220/lib/libc_psr.so.1
/platform/SUNW,SPARC-Enterprise-T5220/lib/libmd_psr.so.1
-bash-3.00$
-bash-3.00$ sqlite3 sqlcipher-1.1.8-testkey.db
SQLite version 3.7.12.1 2012-05-22 02:45:53
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key = 'testkey';
sqlite> PRAGMA cipher_use_hmac = OFF;
sqlite> .schema
CREATE TABLE t1(a,b);
sqlite> .quit
-bash-3.00$
-bash-3.00$ sqlite3 resourceLibrary.sqlite
SQLite version 3.7.12.1 2012-05-22 02:45:53
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma key = 'password';
sqlite> pragma kdf_iter = '10000';
sqlite> .schema
Error: file is encrypted or is not a database
sqlite> .quit
-bash-3.00$ gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with: /gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
-bash-3.00$
-bash-3.00$ type ld
ld is /usr/ccs/bin/ld
-bash-3.00$
-bash-3.00# uname -a
SunOS dslasfaldg2 5.10 Generic_137111-01 sun4v sparc SUNW,SPARC-Enterprise-T5220

static link ICU?

By the way,
It seems like you are using a complicated build for ICU - have you considered just building ICU as a static library and then letting the linker do the hard work? Otherwise you have a very fragile build.

However, it seems like you're trying to use exactly the build in android- that may be the reason. Anyways, just a curiosity.

Steven, ICU Project

net.sqlcipher.database.SQLiteException: variable number must be between ?1 and ?999

Hello,

In our app we have the primary key value of user-created rows in a particular table set to relatively high integer values (100000 and above).

When running a query against this table using rawQuery(whereClause, whereArgs), the argument value in the whereArgs parameter is set to a correspondingly high value.

As a resut the following exception is generated:

02-27 13:35:01.819: E/AndroidRuntime(14175): FATAL EXCEPTION: main
02-27 13:35:01.819: E/AndroidRuntime(14175): net.sqlcipher.database.SQLiteException: variable number must be between ?1 and ?999: , while compiling:

We are running SQLCipher 2.1.1

Here is the relevant part of the stacktrace.

02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteCompiledSql.(SQLiteCompiledSql.java:64)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteProgram.(SQLiteProgram.java:83)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteQuery.(SQLiteQuery.java:49)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1449)
02-27 13:35:01.819: E/AndroidRuntime(14175): at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1418)

Regards,

Michael

Make PRAGMA kdf_iter automatically iterations adaptive

I think that it would be awesome if PRAGMA kdf_iter was adaptive on a per device basis. My G1 phone is crappy but my newest phone isn't - I'd like them to use a different kdf_iter value. If adaptive isn't possible, I'd prefer something randomly generated in a range - so that brute force is highly impractical before the database is acquired.

Moxie Marlinspike has done something similar to this with WhisperCore's full disk encryption. I think his implementation was adaptive by some number of seconds of computation, so the value was likely within a given distribution for a given device.

Build ok but does not encrypt

I am not sure if anyone monitoring mobileorchard.com section of the SQLCipher. I left a comment there few days back about SQLCipher. I dont get compile errors and the build is ok, but the engine treats standard database as if it was already encrypted so when using the key after open it does not allow interaction with the database as if the supplied key was wrong.

Is there a way i can encrypt the database outside iPhone simulator then supply db file already encrypted to xcode resources, this will confirm if the above is true as if i supply the correct key and it worked then something not letting the key encrypt standard database on first run.

Use RAND_bytes() for IVs, not RAND_pseudo_bytes()

CBC mode relies for many of its security properties on having IVs that the attacker cannot predict. But according to OpenSSL's documentation, RAND_pseudo_bytes() shouldn't be used in cases where the output needs to be unpredictable.

RAND_pseudo_bytes() puts num pseudo-random bytes into buf. Pseudo-
random byte sequences generated by RAND_pseudo_bytes() will be unique
if they are of sufficient length, but are not necessarily
unpredictable. They can be used for non-cryptographic purposes and for
certain purposes in cryptographic protocols, but usually not for key
generation etc.

Fortunately, this isn't currently a security hole for most OpenSSL users: The default RAND_pseudo_bytes implementation is ssleay_rand_pseudo_bytes, which just calls RAND_bytes. But if somebody's overridden the default RNG with some engine, they might wind up with bad IVs here. Also, if some future version of OpenSSL provides a faster (but more predictable) RAND_pseudo_bytes implementation, sqlcipher's security would be affected.

SQLite 3.7.16

Hello,

I would like to ask for an update to SQLite 3.7.16 because of the new features, improvements and bug fixes in SQLite.

It would be nice although I understand it may be time consuming... anyway I leave my humble request to the developers.

Best wishes,

Qatan

Link error if we use sqlite3_key or rekey

Hi Stephan,

We have followed all steps as explained in tutorial (http://www.mobileorchard.com/tutorial-iphone-sqlite-encryption-with-sqlcipher/).

openssl: openssl-0.9.8n (also tried with 0.9.8k)
Sqlcipher: as pointed out in your tutorial

Also compiled sqlcipher with static linking using commands,
./configure CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/opt/local/lib/libcrypto.a"
make

When we try to compile our project, we get errors as below,
(Note, we get this error if we use key, rekey method from sqlite3)

Ld /Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug-iphonesimulator/LC_Mobile.app/LC_Mobile normal i386
cd /Users/pspl/AdobeLc/iPhone2010050401/LC_Mobile
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -L/Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug-iphonesimulator -L/Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug -L/Users/pspl/AdobeLc/iPhone2010050401/LC_Mobile/../xcode-build/Debug -F/Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug-iphonesimulator -filelist /Users/pspl/AdobeLc/iPhone2010050401/xcode-build/LC_Mobile.build/Debug-iphonesimulator/LC_Mobile.build/Objects-normal/i386/LC_Mobile.LinkFileList -mmacosx-version-min=10.5 /Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug-iphonesimulator/libsqlcipher.a -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -lxml2 -framework CoreLocation -lsqlite3 -framework SystemConfiguration -framework MediaPlayer -framework MessageUI /Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug-iphonesimulator/libcrypto.a -o /Users/pspl/AdobeLc/iPhone2010050401/xcode-build/Debug-iphonesimulator/LC_Mobile.app/LC_Mobile

Undefined symbols:
"_bn_sub_part_words", referenced from:
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
_bn_mul_part_recursive in libcrypto.a(bn_mul.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

Could you please look into this issue and help us out?

Thanks,
Manikandan

how to use external database

hello all,
i need to know how to crypt my external database with your sdk
i read about it and i found tutorial with create new database but how with external ..

have problem

public void onUpgrade(SQLiteDatabase db,
int oldVersion, int newVersion) {

db.endTransaction();
//updgading the db
//which cannot be done in a transaction
db.beginTransaction();
}

This was working on my test system but now I get permanent error traces from my life system. Seems on most systems it is working, but on not one some.

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:278)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.IllegalStateException: no transaction pending
at net.sqlcipher.database.SQLiteDatabase.endTransaction(SourceFile:640)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SourceFile:128)
at com.myApp.j.q(SourceFile:339) ...

what is wrong here? thanks tata

edit: this is where the crash occurs. SQLiteOpenHelper.getWritableDatabase(SourceFile:128)

int version = db.getVersion();
if (version != mNewVersion) {
db.beginTransaction();
try {
if (version == 0) {
onCreate(db);
} else {
onUpgrade(db, version, mNewVersion);
}
db.setVersion(mNewVersion);
db.setTransactionSuccessful();
} finally {
db.endTransaction(); //L. 128 crash
}
}

SQLCipherforAndroid1.1.0 VFY error after updating sdk tools to revision 17

my project is compiled under API 2.2 and was using SQLCipher for Android 0.0.6 RC1 without any problems.

I upgraded SQLCipher for Android 1.1.0 in my project two days ago and it worked without problems (and it is much faster!).

this morning I updated my Android SDK, which upgraded the SDK tools and ADT to revision 17. From that time on, the application compiles OK but crashes on runtime on the first access on the database.

I include the logcat below, and let me tell you what I have tried so far:

  • I compiled a slightly older revision of my application (before the integration of SQLCipher) and works OK so I put SQLCipher back in my project for further investigation.
  • I was using apache common lang 2.6 and updated to 3.1. The problem persists.
  • apache common lang 3 uses a new namespace (org.apache.commons.lang3.StringUtils) so I renamed my imports from org.apache.commons.lang.StringUtils to org.apache.commons.lang3.StringUtils (just in case). Problem is still there.

In my project, the *.so files are under /libs/armeabi since day 1 but the .jars are in /lib . This configuration worked OK since the SDK-update.

this is the first time I am getting java VFY errors...Are there any ideas? If I manage to find a linux machine and compile from source , is there any case for the problem to go away?

this is the logcat (gr.globo.citrongo.enterprise.client.ui.screens.Startup is my first Activity)

=================== START OF LOGCAT==========================
03-23 12:32:35.929: W/dalvikvm(6770): VFY: unable to resolve static method 5006: Lorg/apache/commons/lang3/StringUtils;.equalsIgnoreCase (Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z
03-23 12:32:35.939: W/dalvikvm(6770): VFY: unable to resolve static method 5006: Lorg/apache/commons/lang3/StringUtils;.equalsIgnoreCase (Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z
03-23 12:32:35.959: W/dalvikvm(6770): VFY: unable to find class referenced in signature (Linfo/guardianproject/database/sqlcipher/SQLiteDatabase;)
03-23 12:32:35.969: W/dalvikvm(6770): VFY: unable to resolve virtual method 4571: Linfo/guardianproject/database/sqlcipher/SQLiteDatabase;.execSQL (Ljava/lang/String;)V
03-23 12:32:35.969: W/dalvikvm(6770): VFY: unable to resolve exception class 751 (Linfo/guardianproject/database/SQLException;)
03-23 12:32:35.969: W/dalvikvm(6770): VFY: unable to find exception handler at addr 0x35
03-23 12:32:35.969: W/dalvikvm(6770): VFY: rejected Lgr/globo/citrongo/enterprise/client/core/storage/DBStorage;.createTable (Lgr/globo/citrongo/enterprise/client/core/storage/DBStorage$Table;)V
03-23 12:32:35.969: W/dalvikvm(6770): VFY: rejecting opcode 0x0d at 0x0035
03-23 12:32:35.969: W/dalvikvm(6770): VFY: rejected Lgr/globo/citrongo/enterprise/client/core/storage/DBStorage;.createTable (Lgr/globo/citrongo/enterprise/client/core/storage/DBStorage$Table;)V
03-23 12:32:35.969: W/dalvikvm(6770): Verifier rejected class Lgr/globo/citrongo/enterprise/client/core/storage/DBStorage;
03-23 12:32:35.969: D/AndroidRuntime(6770): Shutting down VM
03-23 12:32:35.969: W/dalvikvm(6770): threadid=1: thread exiting with uncaught exception (group=0x40018578)
03-23 12:32:35.969: E/AndroidRuntime(6770): FATAL EXCEPTION: main
03-23 12:32:35.969: E/AndroidRuntime(6770): java.lang.VerifyError: gr.globo.citrongo.enterprise.client.core.storage.DBStorage
03-23 12:32:35.969: E/AndroidRuntime(6770): at gr.globo.citrongo.enterprise.client.ui.screens.Startup.onCreate(Startup.java:114)
03-23 12:32:35.969: E/AndroidRuntime(6770): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-23 12:32:35.969: E/AndroidRuntime(6770): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

=================== END OF LOGCAT==========================

Regards

Error trying to compile SQLCiper iOS project

Hi,

I'm getting this error while trying to build my iOS project:

/bin/sh -c /Volumes/Work/workspace/ios/webappskeleton/sqlcipher/build/sqlcipher.build/Release-iphoneos/amalgamation.build/Script-9069D08A0FCE185A0042E34C.sh
checking build system type... i386-apple-darwin11.4.2
checking host system type... i386-apple-darwin11.4.2
checking for gcc... /usr/bin/gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make: *** No rule to make target `sqlite3.c'.  Stop.

I'm new to objective-c. If you have any ideas about to solve this problem please let me know it.

Thanks in advance

Want to use sql cipher ?

I have one .db file ,, how i can apply sql cipher using sqlite for the encryption and decryption
let me know the step by step process for that ,, i gone through net but there is no example related to that ,, there is only 2 examples which is related to the iphone ,,

i want this in adobe air 1.5 let me know if you want to reqire some more info,, ??

sqlcipher has some valgrind issues

Hello,

SqlCipher raises some erorrs on valgrind :

  • it points to uninitialized bytes. It can be fixed by replacing malloc by calloc in mem1.c and mem2.c in sqlite3MemMalloc function.
  • At close, it lacks some free (this is one of them, you can have all with valgrind --show-reachable=yes) :
    ==27211== 24 bytes in 1 blocks are still reachable in loss record 53 of 212
    ==27211== at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==27211== by 0x1F82C3: CRYPTO_malloc (in app.exe)
    ==27211== by 0x210F22: lh_insert (in app.exe)
    ==27211== by 0x1F8ECB: OBJ_NAME_add (in app.exe)
    ==27211== by 0x1F0607: EVP_add_digest (in app.exe)
    ==27211== by 0x1662CA: sqlcipher_activate (in app.exe)
    ==27211== by 0x165EE2: sqlite3CodecAttach (in app.exe)
    ==27211== by 0x166039: sqlite3_key (in app.exe)

So, sqlcipher can be even better with fixing those memory issues !

what makes no such function: sqlcipher_export

here is the infomartion;$ ./sqlite3 aa.db
SQLite version 3.6.23.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> ATTACH DATABASE 'dd.db' AS encrypted KEY '';
sqlite> SELECT sqlcipher_export('dd');
Error: no such function: sqlcipher_export
sqlite> DETACH DATABASE dd;
Error: no such database: dd

Help!

Hi Stephan,
I have followed all steps as explained in tutorial,but When I try to compile the project, get errors as below:
i686-apple-darwin9-gcc-4.2.1: /iPhone Development/sjlombardo-sqlcipher-9b9dbc0/build/Debug-iphonesimulator/libsqlcipher.a: No such file or directory

project information like below:
openssl: openssl-1.0.0a 
Sqlcipher: sjlombardo-sqlcipher-9b9dbc0(v1.1.7)
Xcode:3.1.4
Simulator - 3.1.3 Debug

Could you please help me to resolve the problem?
Thanks a lot,

yourswx

xcode project

Trying to use the tutorial I found at mobileorchard to use openssl & sqlcipher in my project but am getting compile errors. I'm fairly new to working with xcode & mac / iphone platforms so it might just be a noob error on my part, but after opening the xcode project for SQLCipher I noticed that it was referencing a source file "sqlite3.c" which is missing. Is that file supposed to exist or was it accidentally not uploaded in the latest source tree? Thx Tony.

After Decrypt a SQLCipher db to a Plaintext db then Encrypt it back, Android app cannot run

After Decrypt a SQLCipher db to a Plaintext db then Encrypt it back, Android app cannot run-able.

I successful decrypt a DB, then encrypty it back by same password for Android app. The app exception(the DB is writable):

08-26 10:42:01.036: E/Database(30050): Failure 8 (attempt to write a readonly database) on 0x1d992e8 when executing 'BEGIN EXCLUSIVE;'
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): Couldn't open constants.db for writing (will try read-only):
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): net.sqlcipher.database.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at net.sqlcipher.database.SQLiteDatabase.native_execSQL(Native Method)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at net.sqlcipher.database.SQLiteDatabase.execSQL(SQLiteDatabase.java:1836)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at net.sqlcipher.database.SQLiteDatabase.beginTransactionWithListener(SQLiteDatabase.java:609)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at net.sqlcipher.database.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:563)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:173)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at com.commonsware.android.sqlcipher.Provider.query(Provider.java:90)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.ContentResolver.query(ContentResolver.java:317)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.CursorLoader.loadInBackground(CursorLoader.java:56)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.CursorLoader.loadInBackground(CursorLoader.java:42)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:255)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:66)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:55)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at android.os.AsyncTask$2.call(AsyncTask.java:264)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-26 10:42:01.076: E/SQLiteOpenHelper(30050): at java.lang.Thread.run(Thread.java:856)
08-26 10:42:04.019: E/AndroidRuntime(30050): FATAL EXCEPTION: AsyncTask #1
08-26 10:42:04.019: E/AndroidRuntime(30050): java.lang.RuntimeException: An error occured while executing doInBackground()
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.os.AsyncTask$3.done(AsyncTask.java:278)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.lang.Thread.run(Thread.java:856)
08-26 10:42:04.019: E/AndroidRuntime(30050): Caused by: net.sqlcipher.database.SQLiteException: Can't upgrade read-only database from version 0 to 1: /data/data/com.commonsware.android.sqlcipher/databases/constants.db
08-26 10:42:04.019: E/AndroidRuntime(30050): at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:197)
08-26 10:42:04.019: E/AndroidRuntime(30050): at com.commonsware.android.sqlcipher.Provider.query(Provider.java:90)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.ContentResolver.query(ContentResolver.java:317)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.CursorLoader.loadInBackground(CursorLoader.java:56)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.CursorLoader.loadInBackground(CursorLoader.java:42)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:255)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:66)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:55)
08-26 10:42:04.019: E/AndroidRuntime(30050): at android.os.AsyncTask$2.call(AsyncTask.java:264)
08-26 10:42:04.019: E/AndroidRuntime(30050): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-26 10:42:04.019: E/AndroidRuntime(30050): ... 4 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.