mirror of
https://github.com/status-im/sqlcipher.git
synced 2025-02-23 09:18:11 +00:00
notes about implementation of rekey functionality
This commit is contained in:
parent
211a71ea9c
commit
694dfbb47b
19
src/crypto.c
19
src/crypto.c
@ -266,8 +266,25 @@ int sqlite3_key(sqlite3 *db, const void *pKey, int nKey) {
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME - this should change the password for the database! */
|
||||
/* sqlite3_rekey
|
||||
** Given a database, this will reencrypt the database using a new key.
|
||||
** There are two possible modes of operation. The first is rekeying
|
||||
** an existing database that was not previously encrypted. The second
|
||||
** is to change the key on an existing database.
|
||||
**
|
||||
** The proposed logic for this function follows:
|
||||
** 1. Determine if there is already a key present
|
||||
** 2. If there is NOT already a key present, create one and attach a codec (key would be null)
|
||||
** 3. Initialize a ctx->new_key parameter of the codec
|
||||
** 3. Create a transaction on the database
|
||||
** 4. Iterate through each page, reading it and then writing it.
|
||||
** 5. If that goes ok then commit and put ctx->new_key into ctx->key
|
||||
**
|
||||
** Note: this will require modifications to the sqlite3Codec to support new_key
|
||||
**
|
||||
*/
|
||||
int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) {
|
||||
/* FIXME - this should change the password for the database! */
|
||||
printf("sorry sqlite3_rekey is not implemented yet\n");
|
||||
sqlite3_key(db, pKey, nKey);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user