logins::encryption

Trait EncryptorDecryptor

Source
pub trait EncryptorDecryptor: Send + Sync {
    // Required methods
    fn encrypt(&self, cleartext: Vec<u8>) -> ApiResult<Vec<u8>>;
    fn decrypt(&self, ciphertext: Vec<u8>) -> ApiResult<Vec<u8>>;
}
Expand description

This is the generic EncryptorDecryptor trait, as handed over to the Store during initialization. Consumers can implement either this generic trait and bring in their own crypto, or leverage the ManagedEncryptorDecryptor below, which provides encryption algorithms out of the box.

Note that EncryptorDecryptor must not call any LoginStore methods. The login store can call out to the EncryptorDecryptor when it’s internal mutex is held so calling back in to the LoginStore may deadlock.

Required Methods§

Source

fn encrypt(&self, cleartext: Vec<u8>) -> ApiResult<Vec<u8>>

Source

fn decrypt(&self, ciphertext: Vec<u8>) -> ApiResult<Vec<u8>>

Trait Implementations§

Source§

impl<T> FfiConverterArc<T> for dyn EncryptorDecryptor

Source§

const TYPE_ID_META: MetadataBuffer = _

Source§

type FfiType = *const c_void

Source§

fn lower(obj: Arc<Self>) -> Self::FfiType

Source§

fn try_lift(v: Self::FfiType) -> Result<Arc<Self>>

Source§

fn write(obj: Arc<Self>, buf: &mut Vec<u8>)

Source§

fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>>

Source§

impl<T> LiftRef<T> for dyn EncryptorDecryptor

Implementations on Foreign Types§

Source§

impl<T: EncryptorDecryptor> EncryptorDecryptor for Arc<T>

Source§

fn encrypt(&self, clearbytes: Vec<u8>) -> ApiResult<Vec<u8>>

Source§

fn decrypt(&self, cipherbytes: Vec<u8>) -> ApiResult<Vec<u8>>

Implementors§