#[non_exhaustive]pub struct TenantKeyedCrypter { /* private fields */ }Expand description
Tenant-keyed AES-256-GCM Crypter. Looks up the current tenant’s
key via KeyProvider and encrypts / decrypts under it.
§Wire format (v0.6)
nonce[12] || aad_len_u16_le || aad[aad_len] || ct_and_tagAAD = tenant_bytes || version_byte. The AEAD tag covers the AAD so
cross-tenant and wrong-key-version decryptions fail at tag verification.
The version byte lives solely inside the AAD trailing byte; there is no
redundant leading prefix byte (removed in v0.6).
Implementations§
Source§impl TenantKeyedCrypter
impl TenantKeyedCrypter
Sourcepub fn new(keys: Arc<dyn KeyProvider>) -> Self
pub fn new(keys: Arc<dyn KeyProvider>) -> Self
Build with the provided KeyProvider.
Trait Implementations§
Source§impl Crypter for TenantKeyedCrypter
impl Crypter for TenantKeyedCrypter
Source§fn encrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
plaintext: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CrypterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn encrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
plaintext: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CrypterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Encrypt
plaintext. The returned bytes carry whatever framing
the impl needs for later decryption (e.g. nonce prefix).Source§fn decrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
ciphertext: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CrypterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn decrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
ciphertext: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CrypterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Decrypt
ciphertext previously produced by Crypter::encrypt.Auto Trait Implementations§
impl !RefUnwindSafe for TenantKeyedCrypter
impl !UnwindSafe for TenantKeyedCrypter
impl Freeze for TenantKeyedCrypter
impl Send for TenantKeyedCrypter
impl Sync for TenantKeyedCrypter
impl Unpin for TenantKeyedCrypter
impl UnsafeUnpin for TenantKeyedCrypter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more