pub trait Cipher:
Debug
+ Send
+ Sync {
// Required methods
fn encrypt(
&self,
ino: u64,
attribute_id: u64,
device_offset: u64,
file_offset: u64,
buffer: MutPtrByteSlice<'_>,
) -> Result<(), Error>;
fn decrypt(
&self,
ino: u64,
attribute_id: u64,
device_offset: u64,
file_offset: u64,
buffer: MutPtrByteSlice<'_>,
) -> Result<(), Error>;
fn encrypt_filename(
&self,
object_id: u64,
buffer: &mut Vec<u8>,
) -> Result<(), Error>;
fn decrypt_filename(
&self,
object_id: u64,
buffer: &mut Vec<u8>,
) -> Result<(), Error>;
fn hash_code(&self, _raw_filename: &[u8], filename: &str) -> Option<u32>;
fn hash_code_casefold(&self, _filename: &str) -> u32;
fn supports_inline_encryption(&self) -> bool;
fn crypt_ctx(
&self,
ino: u64,
attribute_id: u64,
file_offset: u64,
) -> Option<(u64, u8)>;
// Provided methods
fn decrypt_to(
&self,
ino: u64,
attribute_id: u64,
device_offset: u64,
file_offset: u64,
src: PtrByteSlice<'_>,
dst: MutPtrByteSlice<'_>,
) -> Result<(), Error> { ... }
fn encrypt_symlink(
&self,
object_id: u64,
buffer: &mut Vec<u8>,
) -> Result<(), Error> { ... }
fn decrypt_symlink(
&self,
object_id: u64,
buffer: &mut Vec<u8>,
) -> Result<(), Error> { ... }
}Expand description
Trait defining common methods shared across all ciphers.
Required Methods§
Sourcefn encrypt(
&self,
ino: u64,
attribute_id: u64,
device_offset: u64,
file_offset: u64,
buffer: MutPtrByteSlice<'_>,
) -> Result<(), Error>
fn encrypt( &self, ino: u64, attribute_id: u64, device_offset: u64, file_offset: u64, buffer: MutPtrByteSlice<'_>, ) -> Result<(), Error>
Encrypts data in the buffer.
offsetis the byte offset within the file.bufferis mutated in place.
buffer must be 16 byte aligned.
Sourcefn decrypt(
&self,
ino: u64,
attribute_id: u64,
device_offset: u64,
file_offset: u64,
buffer: MutPtrByteSlice<'_>,
) -> Result<(), Error>
fn decrypt( &self, ino: u64, attribute_id: u64, device_offset: u64, file_offset: u64, buffer: MutPtrByteSlice<'_>, ) -> Result<(), Error>
Decrypt the data in buffer.
offsetis the byte offset within the file.bufferis mutated in place.
buffer must be 16 byte aligned.
Sourcefn encrypt_filename(
&self,
object_id: u64,
buffer: &mut Vec<u8>,
) -> Result<(), Error>
fn encrypt_filename( &self, object_id: u64, buffer: &mut Vec<u8>, ) -> Result<(), Error>
Encrypts the filename contained in buffer.
Sourcefn decrypt_filename(
&self,
object_id: u64,
buffer: &mut Vec<u8>,
) -> Result<(), Error>
fn decrypt_filename( &self, object_id: u64, buffer: &mut Vec<u8>, ) -> Result<(), Error>
Decrypts the filename contained in buffer.
Sourcefn hash_code(&self, _raw_filename: &[u8], filename: &str) -> Option<u32>
fn hash_code(&self, _raw_filename: &[u8], filename: &str) -> Option<u32>
Returns a hash_code to use. Note in the case of encrypted filenames, takes the raw encrypted bytes.
Sourcefn hash_code_casefold(&self, _filename: &str) -> u32
fn hash_code_casefold(&self, _filename: &str) -> u32
Returns a case-folded hash_code to use for ‘filename’.
Sourcefn supports_inline_encryption(&self) -> bool
fn supports_inline_encryption(&self) -> bool
True if supports inline encryption
Provided Methods§
Sourcefn decrypt_to(
&self,
ino: u64,
attribute_id: u64,
device_offset: u64,
file_offset: u64,
src: PtrByteSlice<'_>,
dst: MutPtrByteSlice<'_>,
) -> Result<(), Error>
fn decrypt_to( &self, ino: u64, attribute_id: u64, device_offset: u64, file_offset: u64, src: PtrByteSlice<'_>, dst: MutPtrByteSlice<'_>, ) -> Result<(), Error>
Decrypts data from src into dst.
file_offsetis the byte offset within the file.srcanddstmust have the same length.srcanddstmust both be aligned to 64 bytes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".