How to deal with result of PRAGMA cipher_license


#1

I am not sure how to interpret the result value of the cipher_license pragma. I’m doing this, but it seems not completely sensible:

var stmtLicense: OpaquePointer? = nil
    if (sqlite3_prepare(db, "PRAGMA cipher_license = 'foobar';", -1, &stmtLicense, nil) != SQLITE_OK) {
        let errmsg = String(cString: sqlite3_errmsg(db))
        NSLog("Error preparing SQL for cipher_license code provision: \(errmsg)")
    }
    if (sqlite3_step(stmtLicense) == SQLITE_ROW) {
        NSLog("License result %d", sqlite3_column_int(stmtLicense, 0))
    } else {
        let errmsg = String(cString: sqlite3_errmsg(db))
        NSLog("Unable to provide SQLCipher license code. Error: \(errmsg)")
    }

#2

Hello @fschneider

The license evaluation is deferred until the first SQL execution. The demo application with the commercial packages contain an example of the usage. If you have any further questions, please feel free to reach out to our support at support@zetetic.net. Thanks!