From 07fe0263d2b1e9149f53c8765cc1a21c727fb90b 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:18:48 +0100 Subject: [PATCH] [qmc] feat: add helper method to create QMCv2 Decipher from EKey --- um_crypto/qmc/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/um_crypto/qmc/src/lib.rs b/um_crypto/qmc/src/lib.rs index 98f1b42..3a70048 100644 --- a/um_crypto/qmc/src/lib.rs +++ b/um_crypto/qmc/src/lib.rs @@ -35,6 +35,11 @@ impl QMCv2Cipher { Ok(cipher) } + pub fn new_from_ekey>(ekey_str: T) -> Result { + let key = ekey::decrypt(ekey_str)?; + Self::new(key) + } + pub fn decrypt(&self, data: &mut T, offset: usize) where T: AsMut<[u8]> + ?Sized,