Skip to main content

EncryptableValue

Trait EncryptableValue 

Source
pub trait EncryptableValue {
    // Required methods
    fn as_bytes(&self) -> &[u8] ;
    fn zeroiize(&mut self);
}
Expand description

A trait to get a slice of bytes and to zeroize a data, which are the required operations for StoreCipher::encrypt_value_data.

The goal of this trait was to call Zeroize efficiently on Vec<u8> and &[u8]. We could call vec.iter_mut().zeroize() but the implementation of Zeroize on Vec<u8> does a bit more than that as it clears the vector and zeroizes the spare capacity as a best effort.

Required Methods§

Source

fn as_bytes(&self) -> &[u8]

Get the encodable value as bytes.

Source

fn zeroiize(&mut self)

Zeroize the encodable value.

Called zeroiize to avoid clashes with Zeroize::zeroize.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl EncryptableValue for &mut [u8]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn zeroiize(&mut self)

Source§

impl EncryptableValue for String

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn zeroiize(&mut self)

Source§

impl EncryptableValue for Vec<u8>

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn zeroiize(&mut self)

Implementors§