跳到主要内容

KeyProvider

特性 KeyProvider 

Source
pub trait KeyProvider:
    Send
    + Sync
    + Debug {
    // Required method
    fn load_private_key(
        &self,
        key_der: PrivateKeyDer<'static>,
    ) -> Result<Arc<dyn SigningKey>, Error>;

    // Provided method
    fn fips(&self) -> bool { ... }
}
展开描述

A mechanism 用于 loading private SigningKeys 从 PrivateKeyDer

此 trait is intended 到 be 用 with private 密钥材料 , sourced 从 DER, such as 一个 private-key that may be present on-disk. It is not intended 到 be 用 with keys held in hardware security modules (HSMs) 或 physical tokens. For these use-cases see the Rustls manual section on customizing 私钥 usage

必需方法§

Source

fn load_private_key( &self, key_der: PrivateKeyDer<'static>, ) -> Result<Arc<dyn SigningKey>, Error>

Decode 并 validate 一个 private signing key 从 key_der

This is 用于 ConfigBuilder::with_client_auth_cert(), ConfigBuilder::with_single_cert(), 并 ConfigBuilder::with_single_cert_with_ocsp()。 此 key types 并 formats supported by this function directly defines the key types 并 formats supported in those APIs.

Return an error if the key type encoding is not supported, 或 if the key fails validation.

提供方法§

Source

fn fips(&self) -> bool

Return true if this is 由 FIPS 批准的实现支持。

If this returns true, that must be the case 用于 all possible key types supported by KeyProvider::load_private_key()

实现者§