Skip to content

Entitlement error when keying database with SQLCipher #1351

@jcmanke

Description

@jcmanke

I currently have a project working with SQLite.swift 0.15.4 and SQLCipher 4.10.0. To work around the issues with SPM and SQLCipher compatibility, we copied the entire source code of SQLite.swift into the repo and are getting SQLCipher community edition from GitHub.

I am now attempting to update to SQLite.swift 0.15.5 with the SQLCipher trait through Swift Package Manager. However, when I try to key my database I am getting an error I was not seeing before, about a sqlite-encryption entitlement being required.

This is my code to apply the key:

do {
    let db = try Connection(dbPath)
    let password = getPassword()
    try db.key(password)
} catch {
    logger.error("DB Init: encryption key failed - \(error.localizedDescription)")
    throw SQLiteInitializationError.encryptionKeyFailed(underlying: error)
}

This is what I see in the logs:

entitlement "com.apple.private.sqlite.sqlite-encryption" required to activate SEE
2026-02-18T13:25:29.818-06:00 [Error] [SQLiteManager.swift:153] [259] - DB Init: encryption key failed - The operation couldn’t be completed. (SQLite.Result error 0.)

In the debugger, the caught error has a message of "not an error" and the code is 21.

I am on Xcode 16.3 targeting a minimum version of iOS 17.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions