Swiftpack.co - SQLEnclave/SQLEnclave as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by SQLEnclave.
SQLEnclave/SQLEnclave 0.0.6
An encrypted data substrate for Swift apps
⭐️ 0
🕓 3 weeks ago
iOS macOS watchOS tvOS linux windows android
.package(url: "https://github.com/SQLEnclave/SQLEnclave.git", from: "0.0.6")

SQL Enclave

SQL Enclave is an encrypted data substrate for Swift apps based on SQLite and SQLCipher. It is a cross-platform Darwin (macOS, iOS, tvOS, watchOS) and Linux SPM module with no external dependencies.

SQLEnclave can be included in your project with:


SQLEnclave databases feature:

  • Fast performance with as little as 5-15% overhead for encryption on many operations
  • complete file-level encryption (.enclave files are opaque blobs)
  • CBC mode, HMAC, key derivation
  • Zero-configuration and application level cryptography
  • Configurable crypto providers

Connecting to an encrypted database

Changing the key of an encrypted database

Binding Swift types to database schema


SQL Enclave is mostly a re-packaging of multiple independent projects:

  • SQLite: the ubiquitous embedded SQL database
  • SQLCipher: 256 bit AES encryption for SQLite databases
  • GRDB and GRDBQuery: Swift bindings for SQLite
  • DDG GRDB: GRDB fork with SQLCipher support

Browse the API Documentation.

Frequently Asked Questions

  1. What cryptography libraries does SQLEnclave use?

    SQLCipher (and therefore also SQLEnclave) uses CommonCrypto on Darwin platforms and OpenSSL on Linux to implement cryptography features.

  2. Is SQLEnclave compatible with SQLite?

    SQLEnclave is compatible with standard SQLite databases. When a key is not provided, SQLEnclave will behave just like the standard SQLite library. It is also possible to convert from a plaintext database (standard SQLite) to an encrypted SQLCipher database using ATTACH and the sqlcipher_export() convenience function.

    Note, however, that an encrypted database will not be readable by most sqlite3 executables found on other platforms.

  3. How does SQLEnclave compare with the built-in SQLite framework on iOS?

    The version of SQLite that ships with Darwin platforms does not have any encryption capabilities. Other than that, the two frameworks are identical.

    SQLEnclave will run slower in Debug mode than the built-in SQLite module, but in Release mode the performance of unencrypted operations should be comparable. Encrypted operations will, naturally, be slower. Profiling has shown an average slowdown of encrypted operations by around 10–20%.

  4. Can I trust the format of the SQLEnclave/SQLite database for long-term data storage?

    SQLEnclave databases are simply encrypted SQLite databases, and SQLite is one of four formats (along with XML, JSON, and CSV) recommended for long-term storage of datasets by the United States Library of Congress.

SQLCipher Community Edition


Stars: 0
Last commit: 7 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics