Giter Site home page Giter Site logo

wlltmrt / sqlcipher Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 2.93 MB

Provides transparent 256-bit AES full database encryption

License: MIT License

Swift 0.03% C 99.95% Shell 0.02%
swift xcode swift-package-manager sqlite3 sql ios sqlcipher database-encryption

sqlcipher's Introduction

SQLCipher

Build Status Swift 5 Version Software License Swift Package Manager Compatible

A framework provides transparent 256-bit AES full database encryption, additional information and documentation is available on the official SQLCipher site. Special thanks for Zetetic.

Requirements

Swift 5 and beyond.

Usage

import SQLCipher

func main() {
    var db: COpaquePointer = nil
    
    let key = "key"
    let sql = "CREATE TABLE test(id INTEGER, field1 TEXT, field2 TEXT)"

    sqlite3_open_v2("db.sqlite3", &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, nil)
    sqlite3_key(db, key, Int32(key.utf8.count))

    if sqlite3_exec(db, sql, nil, nil, nil) != SQLITE_OK {
        print("Error on execute")
    }
}

To encrypt a database programmatically you can use the sqlite3_key function. The data provided in pKey is converted to an encryption key according to the same rules as PRAGMA key.

int sqlite3_key(sqlite3 *db, const void *pKey, int nKey)

License

MIT

sqlcipher's People

Contributors

wlltmrt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.