have cipher specify header size

Really it is more about mimimum cipher block size.

 Please enter the commit message for your changes. Lines starting
This commit is contained in:
Jake Probst 2019-07-14 00:43:05 -07:00
parent de87b2f89e
commit 222f3c38da
2 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ pub enum CipherError {
pub trait PSOCipher {
fn encrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError>;
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError>;
fn header_size(&self) -> usize;
}
@ -26,4 +27,8 @@ impl PSOCipher for NullCipher {
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError> {
Ok(data.clone())
}
fn header_size(&self) -> usize {
4
}
}

View File

@ -111,6 +111,10 @@ impl PSOCipher for PSOPCCipher {
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError> {
self.encrypt(data)
}
fn header_size(&self) -> usize {
4
}
}