pub struct PluginSigner { /* private fields */ }Expand description
插件签名验证器(HMAC-SHA256)
使用 sz-orm-crypto 的 HMAC-SHA256 原语验证插件完整性。
生产环境仅允许 SignatureStatus::Signed,Unsigned 在
allow_unsigned = true 时放行(仅限开发环境)。
Implementations§
Source§impl PluginSigner
impl PluginSigner
Sourcepub fn verify(
&self,
plugin: &[u8],
signature: &[u8],
public_key: &[u8],
) -> SignatureStatus
pub fn verify( &self, plugin: &[u8], signature: &[u8], public_key: &[u8], ) -> SignatureStatus
验证插件签名
plugin:插件字节内容signature:HMAC-SHA256 签名(32 字节)public_key:HMAC 密钥
返回 SignatureStatus::Signed 表示签名有效,
SignatureStatus::Invalid 表示签名不匹配,
SignatureStatus::Unsigned 表示无签名数据。
Sourcepub fn is_allowed(&self, status: SignatureStatus) -> bool
pub fn is_allowed(&self, status: SignatureStatus) -> bool
检查签名状态是否允许加载
Auto Trait Implementations§
impl Freeze for PluginSigner
impl RefUnwindSafe for PluginSigner
impl Send for PluginSigner
impl Sync for PluginSigner
impl Unpin for PluginSigner
impl UnsafeUnpin for PluginSigner
impl UnwindSafe for PluginSigner
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