Skip to main content

Decryptor

Trait Decryptor 

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

Turns the bytes of an encrypted config file into configuration text.

One implementation ships — age::Age — and this trait is why there could be others. A program using SOPS, a KMS, or an internal scheme implements this and installs it; nothing else in the crate changes.

Required Methods§

Source

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

Decrypts ciphertext into configuration text.

The returned bytes are parsed as UTF-8 and zeroized afterwards.

§Errors

Whatever going wrong looks like for this scheme. Use Error::decrypt so the failure is categorised consistently.

Source

fn describe(&self) -> String

How to name this decryptor in an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Decryptor for Age

Available on crate feature age only.