Skip to content

Commit

Permalink
libsql-ffi: Switch to SQLCipher as the default cipher
Browse files Browse the repository at this point in the history
Fixes #893
  • Loading branch information
penberg committed Feb 16, 2024
1 parent eb189b0 commit 60189ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libsql-ffi/bundled/SQLite3MultipleCiphers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ set(SQLITE3MC_BASE_DEFINITIONS
HAVE_CIPHER_AES_128_CBC=0
HAVE_CIPHER_AES_256_CBC=1
HAVE_CIPHER_CHACHA20=0
HAVE_CIPHER_SQLCIPHER=0
HAVE_CIPHER_SQLCIPHER=1
HAVE_CIPHER_RC4=0
HAVE_CIPHER_ASCON128=0
# $<$<BOOL:${SQLITE_USE_TCL}>:SQLITE_USE_TCL=1>
Expand Down
5 changes: 4 additions & 1 deletion libsql-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ include!(concat!(env!("OUT_DIR"), "/bindgen.rs"));

#[derive(Clone, Debug)]
pub enum Cipher {
// SQLCipher: AES 256 Bit (recommended)
SQLCIPHER,
// AES 256 Bit CBC - No HMAC (wxSQLite3)
AES_256_CBC,
}

impl Default for Cipher {
fn default() -> Self {
Cipher::AES_256_CBC
Cipher::SQLCIPHER
}
}

Expand All @@ -33,6 +35,7 @@ impl FromStr for Cipher {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"sqlcipher" => Ok(Cipher::SQLCIPHER),
"aes256cbc" => Ok(Cipher::AES_256_CBC),
_ => Err(Error::new(SQLITE_MISUSE)),
}
Expand Down

0 comments on commit 60189ef

Please sign in to comment.