pub struct EncryptionEngine { /* private fields */ }Expand description
Encryption engine for data encryption
Implementations§
Source§impl EncryptionEngine
impl EncryptionEngine
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an encryption engine with default derivation/optimizer components.
Sourcepub fn initialize(&mut self) -> Result<(), CryptographicError>
pub fn initialize(&mut self) -> Result<(), CryptographicError>
Initializes key derivation and optimizer; CryptographicError propagates.
Sourcepub fn add_encryption_algorithm(
&mut self,
algorithm: EncryptionAlgorithm,
implementation: EncryptionAlgorithmImpl,
)
pub fn add_encryption_algorithm( &mut self, algorithm: EncryptionAlgorithm, implementation: EncryptionAlgorithmImpl, )
Register an encryption algorithm implementation.
Sourcepub fn get_encryption_algorithm(
&self,
algorithm: &EncryptionAlgorithm,
) -> Option<&EncryptionAlgorithmImpl>
pub fn get_encryption_algorithm( &self, algorithm: &EncryptionAlgorithm, ) -> Option<&EncryptionAlgorithmImpl>
Look up an encryption algorithm implementation.
Sourcepub fn list_encryption_algorithms(
&self,
) -> impl Iterator<Item = &EncryptionAlgorithmImpl>
pub fn list_encryption_algorithms( &self, ) -> impl Iterator<Item = &EncryptionAlgorithmImpl>
Iterate over all registered encryption algorithm implementations.
Sourcepub fn add_decryption_algorithm(
&mut self,
algorithm: EncryptionAlgorithm,
implementation: DecryptionAlgorithmImpl,
)
pub fn add_decryption_algorithm( &mut self, algorithm: EncryptionAlgorithm, implementation: DecryptionAlgorithmImpl, )
Register a decryption algorithm implementation.
Sourcepub fn get_decryption_algorithm(
&self,
algorithm: &EncryptionAlgorithm,
) -> Option<&DecryptionAlgorithmImpl>
pub fn get_decryption_algorithm( &self, algorithm: &EncryptionAlgorithm, ) -> Option<&DecryptionAlgorithmImpl>
Look up a decryption algorithm implementation.
Sourcepub fn list_decryption_algorithms(
&self,
) -> impl Iterator<Item = &DecryptionAlgorithmImpl>
pub fn list_decryption_algorithms( &self, ) -> impl Iterator<Item = &DecryptionAlgorithmImpl>
Iterate over all registered decryption algorithm implementations.
Sourcepub fn derive_hkdf(
&self,
ikm: &[u8],
info: &[u8],
) -> Result<Vec<u8>, CryptographicError>
pub fn derive_hkdf( &self, ikm: &[u8], info: &[u8], ) -> Result<Vec<u8>, CryptographicError>
Derive key material using HKDF-SHA256 via the embedded KeyDerivation engine.
Sourcepub fn encrypt_data(
&mut self,
key: &Key,
data: &[u8],
additional_data: Option<&[u8]>,
) -> Result<EncryptedData, CryptographicError>
pub fn encrypt_data( &mut self, key: &Key, data: &[u8], additional_data: Option<&[u8]>, ) -> Result<EncryptedData, CryptographicError>
EncryptionEngine::encrypt_data.
Sourcepub fn encrypt_data_with(
&mut self,
key: &Key,
data: &[u8],
additional_data: Option<&[u8]>,
algorithm: EncryptionAlgorithm,
) -> Result<EncryptedData, CryptographicError>
pub fn encrypt_data_with( &mut self, key: &Key, data: &[u8], additional_data: Option<&[u8]>, algorithm: EncryptionAlgorithm, ) -> Result<EncryptedData, CryptographicError>
Encrypt with an explicitly chosen AEAD algorithm (AES-256-GCM, ChaCha20-Poly1305, or XChaCha20-Poly1305).
Sourcepub fn decrypt_data(
&mut self,
key: &Key,
encrypted_data: &EncryptedData,
) -> Result<Vec<u8>, CryptographicError>
pub fn decrypt_data( &mut self, key: &Key, encrypted_data: &EncryptedData, ) -> Result<Vec<u8>, CryptographicError>
Dispatches AEAD decryption by the ciphertext’s recorded algorithm, verifies the tag, and records latency metrics.
Auto Trait Implementations§
impl Freeze for EncryptionEngine
impl RefUnwindSafe for EncryptionEngine
impl Send for EncryptionEngine
impl Sync for EncryptionEngine
impl Unpin for EncryptionEngine
impl UnsafeUnpin for EncryptionEngine
impl UnwindSafe for EncryptionEngine
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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