pub struct LocalKmsClient { /* private fields */ }Expand description
本地 KMS 客户端(测试/开发用)
在内存中存储 DEK,按 (column, version) 索引。
DEK 以 Zeroizing<Vec<u8>> 存储,Drop 时自动清零(2026-09-14 安全审计修复:
此前为裸 Vec<u8>,进程退出时密钥材料残留在已释放内存中)。
Implementations§
Source§impl LocalKmsClient
impl LocalKmsClient
Sourcepub fn new() -> LocalKmsClient
pub fn new() -> LocalKmsClient
创建空本地 KMS
Sourcepub fn generate_dek(&self, column: &str, version: u32) -> DekBuffer
pub fn generate_dek(&self, column: &str, version: u32) -> DekBuffer
生成随机 32 字节 DEK 并存储
Trait Implementations§
Source§impl Default for LocalKmsClient
impl Default for LocalKmsClient
Source§fn default() -> LocalKmsClient
fn default() -> LocalKmsClient
Returns the “default value” for a type. Read more
Source§impl KmsClient for LocalKmsClient
impl KmsClient for LocalKmsClient
Source§fn get_dek<'life0, 'life1, 'async_trait>(
&'life0 self,
column: &'life1 str,
version: u32,
) -> Pin<Box<dyn Future<Output = Result<DekBuffer, KmsError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalKmsClient: 'async_trait,
fn get_dek<'life0, 'life1, 'async_trait>(
&'life0 self,
column: &'life1 str,
version: u32,
) -> Pin<Box<dyn Future<Output = Result<DekBuffer, KmsError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalKmsClient: 'async_trait,
获取 DEK(数据加密密钥)
Source§fn unwrap_dek<'life0, 'life1, 'async_trait>(
&'life0 self,
wrapped_dek: &'life1 [u8],
_version: u32,
) -> Pin<Box<dyn Future<Output = Result<DekBuffer, KmsError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalKmsClient: 'async_trait,
fn unwrap_dek<'life0, 'life1, 'async_trait>(
&'life0 self,
wrapped_dek: &'life1 [u8],
_version: u32,
) -> Pin<Box<dyn Future<Output = Result<DekBuffer, KmsError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalKmsClient: 'async_trait,
解包 DEK(从 wrapped DEK 还原明文 DEK)
Auto Trait Implementations§
impl !Freeze for LocalKmsClient
impl !RefUnwindSafe for LocalKmsClient
impl Send for LocalKmsClient
impl Sync for LocalKmsClient
impl Unpin for LocalKmsClient
impl UnsafeUnpin for LocalKmsClient
impl UnwindSafe for LocalKmsClient
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