pub trait DataEncryptor: Send + Sync {
// Required methods
fn encrypt_data<T: Serialize>(&self, data: &T) -> CryptoResult<Vec<u8>>;
fn decrypt_data<T: DeserializeOwned>(
&self,
ciphertext: &[u8],
) -> CryptoResult<T>;
}Expand description
Trait for encrypting typed data with serialization.
Required Methods§
Sourcefn encrypt_data<T: Serialize>(&self, data: &T) -> CryptoResult<Vec<u8>>
fn encrypt_data<T: Serialize>(&self, data: &T) -> CryptoResult<Vec<u8>>
Encrypt a serializable value.
Sourcefn decrypt_data<T: DeserializeOwned>(
&self,
ciphertext: &[u8],
) -> CryptoResult<T>
fn decrypt_data<T: DeserializeOwned>( &self, ciphertext: &[u8], ) -> CryptoResult<T>
Decrypt to a deserializable value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl DataEncryptor for EnvelopeEncryptor
Available on crate feature
aes only.