Self-contained Go sqlite3 driver with an AES-256 encrypted sqlite3 database
Go to file
Frank Braun c9a3a061e2 add test util
Related to issue #15
2020-08-28 18:11:58 +00:00
.github/workflows add missing newline 2020-08-20 02:50:22 +00:00
_example make imported package name explicit 2020-08-20 03:22:35 +00:00
testdata upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
upgrade update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
util add test util 2020-08-28 18:11:58 +00:00
LICENSE update LICENSE file 2020-07-23 03:50:16 +00:00
MAINTENANCE update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
Makefile disable go vet in tests 2020-08-20 03:22:58 +00:00
README.md update badge 2020-08-20 03:03:20 +00:00
aes.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
aes_tab.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
backup.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
backup_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
burn_stack.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
callback.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
callback_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
cbc_decrypt.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
cbc_done.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
cbc_encrypt.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
cbc_start.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
compare_testvector.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
convert.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
crypt_argchk.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_cipher_descriptor.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_cipher_is_valid.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_find_cipher.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_find_hash.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_hash_descriptor.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_hash_is_valid.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_prng_descriptor.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_register_cipher.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_register_hash.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
crypt_register_prng.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
doc.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
error.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
error_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
flags.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
fortuna.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
go.mod update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
go.sum update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
hash_memory.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
hmac_done.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
hmac_init.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
hmac_memory.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
hmac_process.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
pkcs_5_2.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
sha1.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
sha256.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
sha512.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
sqlcipher.go document sqlite3.IsEncrypted() 2017-05-08 21:04:03 +00:00
sqlcipher_test.go use new import path for v4 series 2020-07-23 02:33:59 +00:00
sqlite3.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
sqlite3.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
sqlite3_context.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_func_crypt.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_func_crypt_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_go18.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_go18_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_libsqlite3.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_load_extension.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_load_extension_omit.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_load_extension_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_allow_uri_authority.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_app_armor.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_foreign_keys.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_fts3_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_fts5.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_icu.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_introspect.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_json1.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_preupdate.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_preupdate_hook.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_preupdate_hook_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_preupdate_omit.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_secure_delete.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_secure_delete_fast.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_stat4.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_unlock_notify.c update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_unlock_notify.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_unlock_notify_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_userauth.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_userauth_omit.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_userauth_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_vacuum_full.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_vacuum_incr.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_vtable.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_opt_vtable_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_other.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_solaris.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_test.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_trace.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_type.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_usleep_windows.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
sqlite3_windows.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
static_mock.go update github.com/mattn/go-sqlite3 to latest 2020-07-23 04:09:25 +00:00
tomcrypt.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_argchk.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_cfg.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_cipher.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_custom.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_hash.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_mac.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_macros.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_math.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_misc.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_pk.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_pkcs.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_private.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
tomcrypt_prng.h upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
track_go-sqlite3.sh fix typo 2020-08-20 03:05:33 +00:00
track_libtomcrypt.sh upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00
zeromem.c upgrade SQLCipher to 4.4.0 2020-07-23 02:04:21 +00:00

README.md

go-sqlcipher

GoDoc CI

Description

Self-contained Go sqlite3 driver with an AES-256 encrypted sqlite3 database conforming to the built-in database/sql interface. It is based on:

SQLite itself is part of SQLCipher.

Incompatibilities of SQLCipher

The version tags of go-sqlcipher are the same as for SQLCipher.

SQLCipher 4.x is incompatible with SQLCipher 3.x!

go-sqlcipher does not implement any migration strategies at the moment. So if you upgrade a major version of go-sqlcipher, you yourself are responsible to upgrade existing database files.

See migrating databases for details.

To upgrade your Go code to the 4.x series, change the import path to

"github.com/mutecomm/go-sqlcipher/v4"

Installation

This package can be installed with the go get command:

go get github.com/mutecomm/go-sqlcipher

Documentation

To create and open encrypted database files use the following DSN parameters:

key := "2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99"
dbname := fmt.Sprintf("db?_pragma_key=x'%s'&_pragma_cipher_page_size=4096", key)
db, _ := sql.Open("sqlite3", dbname)

_pragma_key is the hex encoded 32 byte key (must be 64 characters long). _pragma_cipher_page_size is the page size of the encrypted database (set if you want a different value than the default size).

API documentation can be found here: http://godoc.org/github.com/mutecomm/go-sqlcipher

Use the function sqlite3.IsEncrypted() to check whether a database file is encrypted or not.

Examples can be found under the ./_example directory

License

The code of the originating packages is covered by their respective licenses. See LICENSE file for details.