[−][src]Trait tari_utilities::ciphers::cipher::Cipher
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>
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>
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>
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
Implementors
impl<D> Cipher<D> for ChaCha20 where
D: ByteArray,
[src]
D: ByteArray,
fn seal(
plain_text: &D,
key: &[u8],
nonce: &[u8]
) -> Result<Vec<u8>, CipherError>
[src]
plain_text: &D,
key: &[u8],
nonce: &[u8]
) -> Result<Vec<u8>, CipherError>
fn open(cipher_text: &[u8], key: &[u8], nonce: &[u8]) -> Result<D, CipherError>
[src]
fn seal_with_integral_nonce(
plain_text: &D,
key: &[u8]
) -> Result<Vec<u8>, CipherError>
[src]
plain_text: &D,
key: &[u8]
) -> Result<Vec<u8>, CipherError>
fn open_with_integral_nonce(
cipher_text: &[u8],
key: &[u8]
) -> Result<D, CipherError>
[src]
cipher_text: &[u8],
key: &[u8]
) -> Result<D, CipherError>