sqlcipher compatibilty

This commit is contained in:
Yuxin Wu
2020-06-26 19:01:18 -07:00
parent 6bea581fa0
commit ce84066d85
13 changed files with 11 additions and 181 deletions
+4 -14
View File
@@ -1,7 +1,6 @@
#!/bin/bash -e
# File: decrypt-db.sh
# Date: Tue Jun 16 22:23:13 2015 +0800
# Author: Yuxin Wu
source compatibility.sh
@@ -21,24 +20,15 @@ if [[ -f $output ]]; then
[[ $r == "y" ]] && rm -v $output || exit 1
fi
KEY=$(echo -n "$imei$uin" | $MD5SUM | cut -b 1-7)
echo "KEY: $KEY"
uname | grep Darwin > /dev/null && os=darwin || os=linux
uname -m | grep x86_64 > /dev/null && version=64bit || version=32bit
echo "Use $version sqlcipher of $os."
echo "Dump decrypted database... "
echo "Dump decrypted database... (Don't worry about libcrypt.so version warning.)"
SQLCIPHER=./sqlcipher/$os/$version
export LD_LIBRARY_PATH=$SQLCIPHER
"$SQLCIPHER"/sqlcipher "$MSGDB" << EOF
# https://github.com/sqlcipher/sqlcipher/commit/e4b66d6cc8a2b7547a32ff2c3ac52f148eba3516
sqlcipher "$MSGDB" << EOF
PRAGMA key='$KEY';
PRAGMA cipher_use_hmac = off;
PRAGMA cipher_page_size = 1024;
PRAGMA kdf_iter = 4000;
PRAGMA cipher_compatibility = 1;
ATTACH DATABASE "$output" AS db KEY "";
SELECT sqlcipher_export("db");
DETACH DATABASE db;