This is so strange, key/rekey before starting the backup didn't work for me,
what work is to call sqlite3_rekey after sqlite3_backup_finish, but what I
don't like is that the backup database is not encrypted until the backup
finishes.
Can SQLite team comment on this?
Thanks
Ulric
int backupDb(sqlite3 *pDb, const char *zFilename, const char *zKey)
{
int rc;
sqlite3 *pBackupDb;
sqlite3_backup *pBackup;
rc = sqlite3_open(zFilename, &pBackupDb);
if( rc==SQLITE_OK )
{
pBackup = sqlite3_backup_init(pBackupDb, "main", pDb, "main");
if( pBackup )
{
do
{
rc = sqlite3_backup_step(pBackup, 100);
if( rc==SQLITE_OK || rc==SQLITE_BUSY || rc==SQLITE_LOCKED ){
sqlite3_sleep(10);
}
}
while( rc==SQLITE_OK || rc==SQLITE_BUSY || rc==SQLITE_LOCKED );
sqlite3_backup_finish(pBackup);
}
rc = sqlite3_errcode(pBackupDb);
if (zKey != NULL)
sqlite3_rekey(pBackupDb, zKey, strlen(zKey));
}
sqlite3_close(pBackupDb);
return rc;
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Marcus Grimm
Sent: April 7, 2011 10:13
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Bug: SQLite Encryption Extension And Backup API
Hi,
sorry.. my fault. It should be:
if (zKey != NULL)
{
sqlite3_key(pBackupDb, NULL, 0);
sqlite3_rekey(pBackupDb, zKey, strlen(zKey));
}
Thats works for me..
Marcus
On 07.04.2011 15:58, Ulric Auger wrote:
> It didn't change anything to call sqlite3_key twice as you suggested.
>
> I'm using SQLite 3.7.4 with SEE (SEE v3.7.5 is not available from the SEE
> download page, that is strange)
>
> I hope SQLite team can look into this.
>
> Ulric
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
--
Marcus Grimm
MedCom GmbH Darmstadt, Rundeturmstr. 12, 64283 Darmstadt
Tel: +49(0)6151-95147-10
Fax: +49(0)6151-95147-20
web: www.medcom-online.de
--------------------------------------------------
MedCom slogans of the month:
"Vacation ? -- Every day at MedCom is a paid vacation!"
"Friday I have monday in my mind."
"MedCom -- Every week a vacation, every day an event, every hour a
cliffhanger,
every minute a climax."
"Damned, it's weekend again!"
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users