Open MelodyD opened 5 years ago
The public sqlite source code has no encryption support. Which module did you use ?
@rouault thanks for reply.
Public Sqlite3 source code has interfaces that need Implement oneself for encrypting data , just add define ‘SQLITE3_HAS_CODEC’ to open this extension.
For example interface sqlite3_key()
for decrypt database .I expect to be able to open encrypted sqlite database use gdal .
I have changed some GDAL source, so now i can open encrypted sqlite/spatialite database in the following way.
CPLSetConfigOption("OGR_SQLITE_KEY", "123");//set key
GDALDataset* pNaviDataset = NULL;
GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("SQLite");
GDALOpenInfo* pOpeninfo = new GDALOpenInfo("E://testspatialite.sqlite", GDAL_OF_UPDATE | GDAL_OF_VECTOR, NULL);
unsigned char* header = (unsigned char*)"SQLite format 3";
OGRLayer *poLayer;
pOpeninfo->pabyHeader = header;
pNaviDataset = pDriver->pfnOpen(pOpeninfo);
I guess that for using the SQLITE_HAS_CODEC option the user should have their special build of SQLite on their computer. And that build should support just the right codec that was used when the database was encrypted https://stackoverflow.com/questions/5669905/sqlite-with-encryption-password-protection.
@MelodyD You can provide your proposed changes as a pull request if you wish and if they can integrate well with default builds of GDAL Note: you should use GDALOpenEx() instead of using pfnOpen which isn't intended for public use.
I expected to be able to open sqlite/spatialite database which is encrypted, and i have the key.