diff --git a/src/crypto/mod.rs b/src/crypto/mod.rs index 82e0ea1..e3f1390 100644 --- a/src/crypto/mod.rs +++ b/src/crypto/mod.rs @@ -11,6 +11,7 @@ pub enum CipherError { pub trait PSOCipher { fn encrypt(&mut self, data: &Vec) -> Result, CipherError>; fn decrypt(&mut self, data: &Vec) -> Result, CipherError>; + fn header_size(&self) -> usize; } @@ -26,4 +27,8 @@ impl PSOCipher for NullCipher { fn decrypt(&mut self, data: &Vec) -> Result, CipherError> { Ok(data.clone()) } + + fn header_size(&self) -> usize { + 4 + } } diff --git a/src/crypto/pc.rs b/src/crypto/pc.rs index 19701ab..6df6b09 100644 --- a/src/crypto/pc.rs +++ b/src/crypto/pc.rs @@ -111,6 +111,10 @@ impl PSOCipher for PSOPCCipher { fn decrypt(&mut self, data: &Vec) -> Result, CipherError> { self.encrypt(data) } + + fn header_size(&self) -> usize { + 4 + } }