[kwm] fix: init QMCv2 with ekey
This commit is contained in:
parent
dad2d9c841
commit
785b2f6f0d
@ -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<Self> {
|
||||
pub fn new<T: AsRef<[u8]>>(ekey: T) -> Result<Self> {
|
||||
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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user