pub struct PluginTrustPolicy {
pub official_key_fingerprints: &'static [&'static str],
pub revoked: &'static [PluginRevocation],
pub require_digest: bool,
}Expand description
A small, dependency-free trust policy for plugin bytes. 一个零依赖的插件字节信任策略。
This is intentionally a checksum and key-fingerprint policy, not a home-grown signature scheme. Signature verification belongs in the adapter that loads a plugin; NichLink only decides whether the verified identity is allowed to enter this registry. 这里刻意只做摘要和公钥指纹策略,不伪造签名算法。真正的签名校验由加载插件的 adapter 完成,NichLink 只判断已校验身份是否可以进入注册树。
Fields§
§official_key_fingerprints: &'static [&'static str]SHA-256 fingerprints of keys trusted to sign official plugins. 被信任可为官方插件签名的密钥 SHA-256 指纹。
revoked: &'static [PluginRevocation]Revocations that refuse a package/version pair outright. 直接拒绝某个包/版本组合的撤销条目。
require_digest: boolWhether the manifest checksum must be a SHA-256 digest. manifest 摘要是否必须是 SHA-256 值。
Implementations§
Source§impl PluginTrustPolicy
impl PluginTrustPolicy
Sourcepub const fn open() -> PluginTrustPolicy
pub const fn open() -> PluginTrustPolicy
Development policy: no trusted keys and no digest requirement. 开发态策略:没有信任密钥,也不强制摘要。
Sourcepub const fn official(
keys: &'static [&'static str],
revoked: &'static [PluginRevocation],
) -> PluginTrustPolicy
pub const fn official( keys: &'static [&'static str], revoked: &'static [PluginRevocation], ) -> PluginTrustPolicy
Policy that requires a digest and trusts only the listed official keys. 强制摘要、且只信任所列官方密钥的策略。
Sourcepub fn verify(
self,
manifest: PluginManifest,
bytes: &[u8],
key_fingerprint: Option<&str>,
) -> Result<(), PluginTrustError>
pub fn verify( self, manifest: PluginManifest, bytes: &[u8], key_fingerprint: Option<&str>, ) -> Result<(), PluginTrustError>
Run the checksum, revocation, and official-key checks; does no signature work. 执行摘要、撤销与官方密钥检查;本身不做签名运算。
Sourcepub fn verify_with<V>(
self,
manifest: PluginManifest,
bytes: &[u8],
key_fingerprint: Option<&str>,
verifier: &V,
) -> Result<(), PluginTrustError>where
V: PluginSignatureVerifier,
pub fn verify_with<V>(
self,
manifest: PluginManifest,
bytes: &[u8],
key_fingerprint: Option<&str>,
verifier: &V,
) -> Result<(), PluginTrustError>where
V: PluginSignatureVerifier,
Verify metadata and delegate the actual signature operation to the host. 校验元数据,并把真正的签名操作委托给宿主。
Trait Implementations§
Source§impl Clone for PluginTrustPolicy
impl Clone for PluginTrustPolicy
Source§fn clone(&self) -> PluginTrustPolicy
fn clone(&self) -> PluginTrustPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more