chore(deps): 升级核心依赖至最新版本

- rusqlite 0.32 → 0.40,涵盖全部 5 个 crate
- aes 0.8 → 0.9、cbc 0.1 → 0.2,涵盖加解密相关 4 个 crate
- toml 0.8 → 1.1 配置解析库升级
- 迁移 cipher 0.5 新接口,替换已废弃的加解密方法
- 修复 aes::cipher::Array 弃用警告,改用 TryFrom 转换
This commit is contained in:
pandorafuture
2026-06-05 00:14:25 +08:00
parent 0f22f335e5
commit 125c762727
20 changed files with 373 additions and 326 deletions
Generated
+329 -282
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -205,7 +205,7 @@ wx-cli/
- 确认 WeChat 已弹出登录界面并完成登录
- 增加超时:`--timeout 300`
- 检查日志:`$TMPDIR/wx-cli/lldb/wechat_lldb_output.txt`
- 检查日志:`$TMPDIR/wx-cli/lldb/wx_cli_lldb_output.txt`
### SIP / DevToolsSecurity 报错
+2 -2
View File
@@ -19,13 +19,13 @@ wx-media = { path = "../wx-media" }
wx-monitor = { path = "../wx-monitor" }
wx-context = { path = "../wx-context" }
wx-paths = { path = "../wx-paths" }
rusqlite = { version = "0.32", features = ["bundled"] }
rusqlite = { version = "0.40", features = ["bundled"] }
clap = { version = "4", features = ["derive"] }
futures-util = "0.3"
hex = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
toml = "1.1"
ureq = { version = "2", features = ["json"] }
url = "2"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal"] }
+3 -3
View File
@@ -11,7 +11,7 @@ wx-paths = { path = "../wx-paths" }
serde = { version = "1", features = ["derive"] }
thiserror = "2"
hex = "0.4"
rusqlite = { version = "0.32", features = ["bundled-sqlcipher"] }
rusqlite = { version = "0.40", features = ["bundled-sqlcipher"] }
dashmap = "6"
rayon = "1"
rust-stemmers = "1"
@@ -19,8 +19,8 @@ rust-stemmers = "1"
[dev-dependencies]
tempfile = "3"
filetime = "0.2"
aes = "0.8"
cbc = "0.1"
aes = "0.9"
cbc = "0.2"
hmac = "0.12"
sha2 = "0.10"
pbkdf2 = { version = "0.12", features = ["hmac"] }
+2 -2
View File
@@ -944,7 +944,7 @@ mod tests {
salt: &[u8; 16],
params: &wx_decrypt::CryptoParams,
) {
use aes::cipher::{BlockEncryptMut, KeyIvInit};
use aes::cipher::{BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -963,7 +963,7 @@ mod tests {
let mut ciphertext = plaintext;
type Aes256CbcEnc = cbc::Encryptor<aes::Aes256>;
Aes256CbcEnc::new((&enc_key).into(), (&iv).into())
.encrypt_padded_mut::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.encrypt_padded::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.unwrap();
let mut page = Vec::with_capacity(params.page_size);
+2 -2
View File
@@ -8,7 +8,7 @@ fn build_encrypted_db(
salt: &[u8; 16],
params: &wx_decrypt::CryptoParams,
) {
use aes::cipher::{BlockEncryptMut, KeyIvInit};
use aes::cipher::{BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -22,7 +22,7 @@ fn build_encrypted_db(
let mut ciphertext = plaintext;
type Aes256CbcEnc = cbc::Encryptor<aes::Aes256>;
Aes256CbcEnc::new((&enc_key).into(), (&iv).into())
.encrypt_padded_mut::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.encrypt_padded::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.unwrap();
let mut page = Vec::with_capacity(params.page_size);
+1 -1
View File
@@ -4,7 +4,7 @@ version.workspace = true
edition.workspace = true
[dependencies]
rusqlite = { version = "0.32", features = ["bundled-sqlcipher"] }
rusqlite = { version = "0.40", features = ["bundled-sqlcipher"] }
prost = "0.13"
zstd = "0.13"
md5 = "0.7"
+2 -2
View File
@@ -4,8 +4,8 @@ version.workspace = true
edition.workspace = true
[dependencies]
aes = "0.8"
cbc = "0.1"
aes = "0.9"
cbc = "0.2"
pbkdf2 = { version = "0.12", features = ["sha2"] }
sha2 = "0.10"
hmac = "0.12"
+2 -2
View File
@@ -289,7 +289,7 @@ mod tests {
params: &CryptoParams,
salt: Option<&[u8; 16]>,
) -> Vec<u8> {
use aes::cipher::{block_padding::NoPadding, BlockEncryptMut, KeyIvInit};
use aes::cipher::{block_padding::NoPadding, BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -306,7 +306,7 @@ mod tests {
let mut ciphertext = plaintext.clone();
Aes256CbcEnc::new(enc_key.into(), (&iv).into())
.encrypt_padded_mut::<NoPadding>(&mut ciphertext, data_len)
.encrypt_padded::<NoPadding>(&mut ciphertext, data_len)
.expect("encryption should not fail");
let mut page = vec![0u8; params.page_size];
+2 -2
View File
@@ -74,7 +74,7 @@ mod tests {
/// Build a single-page encrypted DB file that `decrypt_db` can process.
fn build_encrypted_db(path: &Path, raw_key: &[u8; 32], salt: &[u8; 16], params: &CryptoParams) {
use aes::cipher::{BlockEncryptMut, KeyIvInit};
use aes::cipher::{BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -93,7 +93,7 @@ mod tests {
let mut ciphertext = plaintext;
type Aes256CbcEnc = cbc::Encryptor<aes::Aes256>;
Aes256CbcEnc::new((&enc_key).into(), (&iv).into())
.encrypt_padded_mut::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.encrypt_padded::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.unwrap();
let mut page = Vec::with_capacity(params.page_size);
+3 -3
View File
@@ -1,4 +1,4 @@
use aes::cipher::{block_padding::NoPadding, BlockDecryptMut, KeyIvInit};
use aes::cipher::{block_padding::NoPadding, BlockModeDecrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -45,8 +45,8 @@ pub fn decrypt_page(
let encrypted = &page_buf[offset..params.page_size - params.reserve];
let mut buf = encrypted.to_vec();
Aes256CbcDec::new(enc_key.into(), iv.into())
.decrypt_padded_mut::<NoPadding>(&mut buf)
Aes256CbcDec::new(enc_key.into(), iv.try_into().expect("IV length mismatch"))
.decrypt_padded::<NoPadding>(&mut buf)
.map_err(|e| DecryptError::AesDecryptFailed {
page_num,
reason: e.to_string(),
+2 -2
View File
@@ -380,7 +380,7 @@ mod tests {
params: &CryptoParams,
salt: Option<&[u8; 16]>,
) -> Vec<u8> {
use aes::cipher::{block_padding::NoPadding, BlockEncryptMut, KeyIvInit};
use aes::cipher::{block_padding::NoPadding, BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -397,7 +397,7 @@ mod tests {
let mut ciphertext = plaintext.clone();
Aes256CbcEnc::new(enc_key.into(), (&iv).into())
.encrypt_padded_mut::<NoPadding>(&mut ciphertext, data_len)
.encrypt_padded::<NoPadding>(&mut ciphertext, data_len)
.expect("encryption should not fail");
let mut page = vec![0u8; params.page_size];
+3 -3
View File
@@ -9,7 +9,7 @@ wx-paths = { path = "../wx-paths" }
tokio = { version = "1", features = ["process", "time", "io-util", "rt-multi-thread", "macros"] }
regex = "1"
serde = { version = "1", features = ["derive"] }
toml = "0.8"
toml = "1.1"
chrono = { version = "0.4", features = ["serde"] }
thiserror = "2"
hex = "0.4"
@@ -21,8 +21,8 @@ mach2 = "0.6"
libc = "0.2"
[dev-dependencies]
aes = "0.8"
cbc = "0.1"
aes = "0.9"
cbc = "0.2"
hmac = "0.12"
sha2 = "0.10"
tempfile = "3"
+2 -2
View File
@@ -247,7 +247,7 @@ mod tests {
}
fn build_first_page(enc_key: &[u8; 32], salt: &[u8; 16]) -> Vec<u8> {
use aes::cipher::{block_padding::NoPadding, BlockEncryptMut, KeyIvInit};
use aes::cipher::{block_padding::NoPadding, BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -259,7 +259,7 @@ mod tests {
let mut ciphertext = plaintext;
type Aes256CbcEnc = cbc::Encryptor<aes::Aes256>;
Aes256CbcEnc::new(enc_key.into(), (&iv).into())
.encrypt_padded_mut::<NoPadding>(&mut ciphertext, data_len)
.encrypt_padded::<NoPadding>(&mut ciphertext, data_len)
.unwrap();
let mut page = vec![0u8; params.page_size];
+2 -2
View File
@@ -8,10 +8,10 @@ default = []
audio = ["dep:silk-rs"]
[dependencies]
aes = "0.8"
aes = "0.9"
ecb = "0.1"
cipher = { version = "0.4", features = ["block-padding"] }
rusqlite = { version = "0.32", features = ["bundled"] }
rusqlite = { version = "0.40", features = ["bundled"] }
md5 = "0.7"
base64 = "0.22"
thiserror = "2"
+2 -2
View File
@@ -181,7 +181,7 @@ fn decrypt_v1_v2(
/// AES-128-ECB decrypt with PKCS7 unpadding.
fn aes_ecb_decrypt(ciphertext: &[u8], key: &[u8; 16]) -> Result<Vec<u8>, MediaError> {
use aes::cipher::{BlockDecrypt, KeyInit};
use aes::cipher::{BlockCipherDecrypt, KeyInit};
use aes::Aes128;
if ciphertext.is_empty() {
@@ -200,7 +200,7 @@ fn aes_ecb_decrypt(ciphertext: &[u8], key: &[u8; 16]) -> Result<Vec<u8>, MediaEr
let mut decrypted = ciphertext.to_vec();
for chunk in decrypted.chunks_exact_mut(16) {
cipher.decrypt_block(chunk.into());
cipher.decrypt_block(chunk.try_into().expect("chunk length mismatch"));
}
// PKCS7 unpadding
+6 -6
View File
@@ -15,7 +15,7 @@ fn make_xor_dat(key: u8) -> Vec<u8> {
/// Header: 07 08 V1 08 07 (6B) + aes_size LE (4B) + xor_size LE (4B) + 0x01 (1B) = 15B
/// Then AES-ECB encrypted payload with fixed key, then raw, then XOR tail.
fn make_v1_dat() -> Vec<u8> {
use aes::cipher::{BlockEncrypt, KeyInit};
use aes::cipher::{BlockCipherEncrypt, KeyInit};
use aes::Aes128;
let key = b"cfcd208495d565ef"; // md5("0")[:16]
@@ -28,8 +28,8 @@ fn make_v1_dat() -> Vec<u8> {
];
let mut block2 = [16u8; 16]; // full PKCS7 padding block
cipher.encrypt_block((&mut block1).into());
cipher.encrypt_block((&mut block2).into());
cipher.encrypt_block(aes::cipher::Array::from_mut_slice(&mut block1));
cipher.encrypt_block(aes::cipher::Array::from_mut_slice(&mut block2));
let aes_size: u32 = 16; // original plaintext size
let xor_size: u32 = 0;
@@ -46,7 +46,7 @@ fn make_v1_dat() -> Vec<u8> {
/// Build a V2-encrypted `.dat` file with known AES key and XOR tail.
fn make_v2_dat(aes_key: &[u8; 16], xor_key: u8) -> Vec<u8> {
use aes::cipher::{BlockEncrypt, KeyInit};
use aes::cipher::{BlockCipherEncrypt, KeyInit};
use aes::Aes128;
let cipher = Aes128::new(aes_key.into());
@@ -58,8 +58,8 @@ fn make_v2_dat(aes_key: &[u8; 16], xor_key: u8) -> Vec<u8> {
];
let mut block2 = [16u8; 16]; // PKCS7 padding block
cipher.encrypt_block((&mut block1).into());
cipher.encrypt_block((&mut block2).into());
cipher.encrypt_block(aes::cipher::Array::from_mut_slice(&mut block1));
cipher.encrypt_block(aes::cipher::Array::from_mut_slice(&mut block2));
let aes_size: u32 = 16;
// Tail: 4 bytes XOR-encrypted
+3 -3
View File
@@ -15,10 +15,10 @@ thiserror = "2"
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
aes = "0.8"
cbc = "0.1"
aes = "0.9"
cbc = "0.2"
hmac = "0.12"
sha2 = "0.10"
pbkdf2 = { version = "0.12", features = ["sha2"] }
rusqlite = { version = "0.32", features = ["bundled"] }
rusqlite = { version = "0.40", features = ["bundled"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
+2 -2
View File
@@ -275,7 +275,7 @@ mod tests {
/// Build a minimal encrypted session.db that `decrypt_db` can process.
fn build_encrypted_session_db(path: &Path, raw_key: &[u8; 32]) -> PathBuf {
use aes::cipher::{BlockEncryptMut, KeyIvInit};
use aes::cipher::{BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -317,7 +317,7 @@ mod tests {
let mut ciphertext = plaintext.clone();
let encryptor = Aes256CbcEnc::new((&enc_key).into(), (&iv).into());
encryptor
.encrypt_padded_mut::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.encrypt_padded::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.unwrap();
// Assemble page: salt + ciphertext + IV + HMAC
+2 -2
View File
@@ -35,7 +35,7 @@ fn encrypt_page(
page_num: u32,
salt: &[u8; 16],
) -> Vec<u8> {
use aes::cipher::{BlockEncryptMut, KeyIvInit};
use aes::cipher::{BlockModeEncrypt, KeyIvInit};
use hmac::{Hmac, Mac};
use sha2::Sha512;
@@ -52,7 +52,7 @@ fn encrypt_page(
let mut ciphertext = plaintext.to_vec();
let encryptor = Aes256CbcEnc::new(enc_key.into(), (&iv).into());
encryptor
.encrypt_padded_mut::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.encrypt_padded::<aes::cipher::block_padding::NoPadding>(&mut ciphertext, data_size)
.unwrap();
// Assemble encrypted page