Skip to main content

CryptoEngine

Trait CryptoEngine 

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

Trait for encrypting and decrypting logical object payloads.

Required Methods§

Source

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

Encrypt plaintext into ciphertext with a nonce. Returns (nonce, ciphertext).

Source

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

Decrypt ciphertext with the given nonce. Returns plaintext.

Implementors§