[kgm] feat #2: basic kgm support

This commit is contained in:
鲁树人
2024-09-15 22:15:02 +01:00
parent 2222e7bc50
commit 7b4464bacd
16 changed files with 273 additions and 3 deletions

21
um_crypto/kgm/src/lib.rs Normal file
View File

@@ -0,0 +1,21 @@
pub mod header;
pub mod v2;
mod v3;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum KugouError {
#[error("Header too small, need at least {0} bytes.")]
HeaderTooSmall(usize),
#[error("Unsupported key slot: {0}")]
UnsupportedKeySlot(u32),
#[error("Unsupported cipher version: {0}")]
UnsupportedCipherVersion(u32),
}
pub trait Decipher {
fn decrypt(&self, buffer: &mut [u8], offset: usize);
}