Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » sqlite3 encryption (Has anyone looked into this?)
Re: sqlite3 encryption [message #59059 is a reply to message #59058] Sun, 23 October 2022 15:04 Go to previous messageGo to previous message
coolman is currently offline  coolman
Messages: 119
Registered: April 2006
Location: Czech Republic
Experienced Member
You can check encrypted Sqlite before Open() the DB using the function

bool Sqlite::IsFileEncrypted(const char *DBfilename) {
    FileIn in(DBfilename);

    if (!in) {
        return false;
    }

    String SqlVersion = "SQLite format 3";
    int SqlVersionLength = SqlVersion.GetCount();
    in.Seek(0);
    String version = in.Get(SqlVersionLength);
    in.Close();

    return (!version.IsEqual(SqlVersion));
}


With combination of returned code from Open() function

...
        int errCode = sqlite3db.GetErrorCode();
        String errMsg = Format("[ %s&&Error: %d (%s)]", t_("Loading the database has failed!"), errCode, sqlite3db.GetErrorCodeString());
        if (SQLITE_NOTADB == errCode) {
            errMsg = t_("The database is encrypted but decryption failed!&[= Did you use the correct password?");
        }
        ErrorOK(errMsg);
...


BR, Radek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PostgreSQL and clang: error: linker command failed with exit code 1 on MacOS X
Next Topic: Transfer compress data
Goto Forum:
  


Current Time: Thu Jul 31 21:17:30 CEST 2025

Total time taken to generate the page: 0.07916 seconds