Skip to main content

Encryptor

Trait Encryptor 

Source
pub trait Encryptor: Send + Sync {
    // Required methods
    fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, CryptoError>;
    fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, CryptoError>;
}
Expand description

Symmetric encrypt/decrypt over raw bytes.

Required Methods§

Source

fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, CryptoError>

§Errors

Returns CryptoError::Encrypt on failure.

Source

fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, CryptoError>

§Errors

Returns CryptoError::Decrypt or CryptoError::InvalidFormat on failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§