Skip to main content

DataEncryptor

Trait DataEncryptor 

Source
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§

Source

fn encrypt_data<T: Serialize>(&self, data: &T) -> CryptoResult<Vec<u8>>

Encrypt a serializable value.

Source

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§

Source§

impl DataEncryptor for EnvelopeEncryptor

Available on crate feature aes only.