MacBook 怎么打開微信的加密數(shù)據(jù)庫

微信Android 數(shù)據(jù)庫使用SqlCipher加密, 從代碼來看, 是使用sqlcipher 1 版本,

private static final SQLiteCipherSpec qDP = 
new SQLiteCipherSpec().setPageSize(1024).setSQLCipherVersion(1);

使用諸如 DB Browser for SQLite , SQLiteStudio 等數(shù)據(jù)庫管理軟件都無法直接打開, 主要原因是連接參數(shù)不正確.

查看 SQLCipher 的源碼發(fā)現(xiàn)設(shè)置 CipherVersion 為 1 時(shí) , 會(huì)關(guān)閉 hmac, kdf_iter 為 4000.

public SQLiteCipherSpec setSQLCipherVersion(int version) {
    switch (version) {
        case 1: hmacEnabled = false; kdfIteration = 4000;  break;
        case 2: hmacEnabled = true;  kdfIteration = 4000;  break;
        case 3: hmacEnabled = true;  kdfIteration = 64000; break;
        default: throw new IllegalArgumentException("Unsupported SQLCipher version: " + version);
    }
    return this;
}

在嘗試 SQLiteStudio 配合 Cipher configuration 來建立鏈接, 還是失敗 配置如下.

PRAGMA kdf_iter = '4000';
PRAGMA cipher_use_hmac = OFF;
PRAGMA cipher = 'AES-256-CBC';
PRAGMA cipher_page_size = 1024;

查閱官方文檔后發(fā)現(xiàn)有如下介紹:

PRAGMA cipher_compatibility: Force SQLCipher to operate with default settings consistent with that major version number for the current connection.

大概是說通過PRAGMA cipher_compatibility配置 , 設(shè)置這個(gè)版本號(hào)后, 會(huì)自動(dòng)使用該版本默認(rèn)的配置鏈接, 這樣避免我們?cè)O(shè)置那些亂七八糟的配置,將下列配置粘貼到工具中的加密算法配置選項(xiàng)中

PRAGMA cipher_page_size = 1024;
PRAGMA cipher_compatibility = 1;

測(cè)試發(fā)現(xiàn), OK~ 如下圖.

MacBook使用SQLiteStudio鏈接微信加密數(shù)據(jù)庫.jpg

附件:SQLiteStudio.dmg

轉(zhuǎn)自:打開微信加密數(shù)據(jù)庫

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容