From 785b2f6f0db428f3dd1223d69b05545e7cf970bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sun, 15 Sep 2024 16:20:39 +0100 Subject: [PATCH] [kwm] fix: init QMCv2 with ekey --- um_crypto/kuwo/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/um_crypto/kuwo/src/lib.rs b/um_crypto/kuwo/src/lib.rs index 1136243..1df2933 100644 --- a/um_crypto/kuwo/src/lib.rs +++ b/um_crypto/kuwo/src/lib.rs @@ -112,7 +112,7 @@ impl Header { let cipher = match self.version { 1 => Cipher::V1(CipherV1::new(self.resource_id)), 2 => match ekey { - Some(ekey) => Cipher::V2(CipherV2::new(ekey)?), + Some(ekey) => Cipher::V2(CipherV2::new_from_ekey(ekey)?), None => Err(KuwoCryptoError::V2EKeyRequired)?, }, version => Err(KuwoCryptoError::UnsupportedVersion(version as usize))?, @@ -134,9 +134,9 @@ impl Header { pub struct CipherBoDian(QMCv2Cipher); impl CipherBoDian { - pub fn new(ekey: &str) -> Result { + pub fn new>(ekey: T) -> Result { let ekey = des::decode_ekey(&ekey, &SECRET_KEY)?; - let cipher = CipherV2::new(ekey)?; + let cipher = CipherV2::new_from_ekey(ekey.as_str())?; Ok(Self(cipher)) }