[][src]Trait tari_utilities::ciphers::cipher::Cipher

pub trait Cipher<D> where
    D: ByteArray
{ fn seal(
        plain_text: &D,
        key: &[u8],
        nonce: &[u8]
    ) -> Result<Vec<u8>, CipherError>;
fn open(
        cipher_text: &[u8],
        key: &[u8],
        nonce: &[u8]
    ) -> Result<D, CipherError>;
fn seal_with_integral_nonce(
        plain_text: &D,
        key: &[u8]
    ) -> Result<Vec<u8>, CipherError>;
fn open_with_integral_nonce(
        cipher_text: &[u8],
        key: &[u8]
    ) -> Result<D, CipherError>; }

A trait describing an interface to a symmetrical encryption scheme

Required methods

fn seal(
    plain_text: &D,
    key: &[u8],
    nonce: &[u8]
) -> Result<Vec<u8>, CipherError>

Encrypt using a cipher and provided key and nonce

fn open(cipher_text: &[u8], key: &[u8], nonce: &[u8]) -> Result<D, CipherError>

Decrypt using a cipher and provided key and nonce

fn seal_with_integral_nonce(
    plain_text: &D,
    key: &[u8]
) -> Result<Vec<u8>, CipherError>

Encrypt using a cipher and provided key, the nonce will be generate internally and appended to the cipher text

fn open_with_integral_nonce(
    cipher_text: &[u8],
    key: &[u8]
) -> Result<D, CipherError>

Decrypt using a cipher and provided key. The integral nonce will be read from the cipher text

Loading content...

Implementors

impl<D> Cipher<D> for ChaCha20 where
    D: ByteArray
[src]

Loading content...