Skip to main content

Encryptor

Trait Encryptor 

Source
pub trait Encryptor: Send + Sync {
    // Required methods
    fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, Error>;
    fn describe(&self) -> String;
}
Available on crate feature decrypt only.
Expand description

Turns configuration text into the bytes of an encrypted file.

The other direction from Decryptor, and deliberately not installed process-wide: who may read a file this program writes is a decision about that write, not a property of the process. It is passed to save_encrypted at the call site, where somebody can see which recipients they chose.

Required Methods§

Source

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

Encrypts plaintext into the bytes to write.

§Errors

Whatever going wrong looks like for this scheme. Use Error::decrypt, which covers both directions.

Source

fn describe(&self) -> String

How to name this encryptor in an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Encryptor for Recipients

Available on crate feature age only.