pub struct CryptoEngine { /* private fields */ }
Expand description
Crypto engine for encryption/decryption operations
Implementations§
Source§impl CryptoEngine
impl CryptoEngine
Sourcepub fn derive_key(
&self,
password: &str,
salt: &[u8; 32],
) -> Result<SecureKey, CryptoError>
pub fn derive_key( &self, password: &str, salt: &[u8; 32], ) -> Result<SecureKey, CryptoError>
Derive a secure key from password and salt using Argon2
Sourcepub fn encrypt(
&self,
data: &[u8],
password: &str,
metadata: FileMetadata,
) -> Result<Vec<u8>, CryptoError>
pub fn encrypt( &self, data: &[u8], password: &str, metadata: FileMetadata, ) -> Result<Vec<u8>, CryptoError>
Encrypt data with password and metadata
Sourcepub fn decrypt(
&self,
encrypted_data: &[u8],
password: &str,
) -> Result<(Vec<u8>, FileMetadata), CryptoError>
pub fn decrypt( &self, encrypted_data: &[u8], password: &str, ) -> Result<(Vec<u8>, FileMetadata), CryptoError>
Decrypt data with password, returning both data and metadata
Sourcepub fn decrypt_legacy(
&self,
encrypted_data: &[u8],
password: &str,
) -> Result<Vec<u8>, CryptoError>
pub fn decrypt_legacy( &self, encrypted_data: &[u8], password: &str, ) -> Result<Vec<u8>, CryptoError>
Legacy decrypt method for backward compatibility
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CryptoEngine
impl RefUnwindSafe for CryptoEngine
impl Send for CryptoEngine
impl Sync for CryptoEngine
impl Unpin for CryptoEngine
impl UnwindSafe for CryptoEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more