1
- == SQLCipher ==
1
+ ## SQLCipher
2
2
3
3
SQLCipher is an SQLite extension that provides transparent 256-bit AES encryption of
4
4
database files. Pages are encrypted before being written to disk and are decrypted
@@ -11,7 +11,7 @@ SQLCipher was initially developed by Stephen Lombardo at Zetetic LLC
11
11
(sjlombardo@zetetic.net ) as the encrypted database layer for Strip,
12
12
an iPhone data vault and password manager (http://getstrip.com ).
13
13
14
- [ Features]
14
+ ## Features
15
15
16
16
- Fast performance with as little as 5-15% overhead for encryption on many operations
17
17
- 100% of data in the database file is encrypted
@@ -20,7 +20,7 @@ an iPhone data vault and password manager (http://getstrip.com).
20
20
- Algorithms provided by the peer reviewed OpenSSL crypto library.
21
21
- Configurable crypto providers
22
22
23
- [ Compiling]
23
+ ## Compiling
24
24
25
25
Building SQLCipher is almost the same as compiling a regular version of
26
26
SQLite with two small exceptions:
@@ -30,57 +30,56 @@ SQLite with two small exceptions:
30
30
31
31
Example Static linking (replace /opt/local/lib with the path to libcrypto.a)
32
32
33
- $ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
34
- LDFLAGS="/opt/local/lib/libcrypto.a"
35
- $ make
33
+ $ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_C
8000
ODEC" \
34
+ LDFLAGS="/opt/local/lib/libcrypto.a"
35
+ $ make
36
36
37
37
Example Dynamic linking
38
38
39
- $ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
40
- LDFLAGS="-lcrypto"
41
- $ make
39
+ $ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
40
+ LDFLAGS="-lcrypto"
41
+ $ make
42
42
43
- [ Encrypting a database]
43
+ ## Encrypting a database
44
44
45
45
To specify an encryption passphrase for the database via the SQL interface you
46
46
use a pragma. The passphrase you enter is passed through PBKDF2 key derivation to
47
47
obtain the encryption key for the database
48
48
49
- PRAGMA key = 'passphrase';
49
+ PRAGMA key = 'passphrase';
50
50
51
51
Alternately, you can specify an exact byte sequence using a blob literal. If you
52
52
<
8000
code class="diff-text syntax-highlighted-line">use this method it is your responsibility to ensure that the data you provide a
53
53
64 character hex string, which will be converted directly to 32 bytes (256 bits) of
54
54
key data without key derivation.
55
55
56
- PRAGMA key = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
56
+ PRAGMA key = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
57
57
58
58
To encrypt a database programatically you can use the sqlite3_key function.
59
59
The data provided in pKey is converted to an encryption key according to the
60
60
same rules as PRAGMA key.
61
61
62
-
63
- int sqlite3_key(sqlite3 * db, const void * pKey, int nKey);
62
+ int sqlite3_key(sqlite3 *db, const void *pKey, int nKey);
64
63
65
64
PRAGMA key or sqlite3_key should be called as the first operation when a database is open.
66
65
67
- [ Changing a database key]
66
+ ## Changing a database key
68
67
69
68
To change the encryption passphrase for an existing database you may use the rekey pragma
70
69
after you've supplied the correct database password;
71
70
72
- PRAGMA key = 'passphrase'; -- start with the existing database passphrase
73
- PRAGMA rekey = 'new-passphrase'; -- rekey will reencrypt with the new passphrase
71
+ PRAGMA key = 'passphrase'; -- start with the existing database passphrase
72
+ PRAGMA rekey = 'new-passphrase'; -- rekey will reencrypt with the new passphrase
74
73
75
74
The hexrekey pragma may be used to rekey to a specific binary value
76
75
77
- PRAGMA rekey = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
76
+ PRAGMA rekey = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
78
77
79
78
This can be accomplished programtically by using sqlite3_rekey;
80
79
81
- sqlite3_rekey(sqlite3 * db, const void * pKey, int nKey)
80
+ sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey)
82
81
83
- [ Support]
82
+ ## Support
84
83
85
84
The primary avenue for support and discussions is the SQLCipher users mailing list:
86
85
@@ -97,7 +96,7 @@ posts about SQLCipher as we do not monitor them frequently.
97
96
If you are using SQLCipher in your own software please let us know at
98
97
support@zetetic.net !
99
98
100
- [ License]
99
+ ## License
101
100
102
101
Copyright (c) 2008, ZETETIC LLC
103
102
All rights reserved.
@@ -128,7 +127,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
128
127
129
128
This directory contains source code to
130
129
131
- SQLite: An Embeddable SQL Database Engine
130
+ SQLite: An Embeddable SQL Database Engine
132
131
133
132
To compile the project, first create a directory in which to place
134
133
the build products. It is recommended, but not required, that the
@@ -138,7 +137,7 @@ script found at the root of the source tree. Then run "make".
138
137
139
138
For example:
140
139
141
- tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
140
+ tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
142
141
mkdir bld ;# Build will occur in a sibling directory
143
142
cd bld ;# Change to the build directory
144
143
../sqlite/configure ;# Run the configure script
164
163
165
164
Contacts:
166
165
167
- http://www.sqlite.org/
166
+ http://www.sqlite.org/
0 commit comments