pub struct EncryptionService { /* private fields */ }
Expand description
Main encryption service for student data
Implementations§
Source§impl EncryptionService
impl EncryptionService
Sourcepub fn generate_salt(&self) -> SaltString
pub fn generate_salt(&self) -> SaltString
Generate a cryptographically secure salt
Sourcepub fn generate_download_token(&self) -> String
pub fn generate_download_token(&self) -> String
Generate a secure download token
Sourcepub fn derive_key_from_password(
&self,
password: &str,
salt: &SaltString,
) -> Result<[u8; 32], EncryptionError>
pub fn derive_key_from_password( &self, password: &str, salt: &SaltString, ) -> Result<[u8; 32], EncryptionError>
Derive 256-bit encryption key from password using Argon2
Sourcepub fn create_data_hash(
&self,
mapping_data: &MappingData,
) -> Result<String, EncryptionError>
pub fn create_data_hash( &self, mapping_data: &MappingData, ) -> Result<String, EncryptionError>
Create SHA-256 hash of mapping data for integrity verification
Sourcepub fn encrypt_mapping_data(
&self,
mapping_data: &MappingData,
user_password: &str,
) -> Result<EncryptionResult, EncryptionError>
pub fn encrypt_mapping_data( &self, mapping_data: &MappingData, user_password: &str, ) -> Result<EncryptionResult, EncryptionError>
Encrypt student mapping data with password-based encryption
Sourcepub fn decrypt_mapping_data(
&self,
encrypted_data: &str,
user_password: &str,
) -> Result<MappingData, EncryptionError>
pub fn decrypt_mapping_data( &self, encrypted_data: &str, user_password: &str, ) -> Result<MappingData, EncryptionError>
Decrypt student mapping data
Sourcepub fn verify_data_integrity(
&self,
mapping_data: &MappingData,
expected_hash: &str,
) -> Result<bool, EncryptionError>
pub fn verify_data_integrity( &self, mapping_data: &MappingData, expected_hash: &str, ) -> Result<bool, EncryptionError>
Verify data integrity
Sourcepub fn validate_password_strength(
&self,
password: &str,
) -> Result<(), EncryptionError>
pub fn validate_password_strength( &self, password: &str, ) -> Result<(), EncryptionError>
Validate password strength (basic implementation)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EncryptionService
impl RefUnwindSafe for EncryptionService
impl Send for EncryptionService
impl Sync for EncryptionService
impl Unpin for EncryptionService
impl UnwindSafe for EncryptionService
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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