pub struct WebPkiClientVerifier { /* private fields */ }展开描述
A client certificate verifier that uses the webpki crate1 到 perform client certificate
validation.
It must be created via the WebPkiClientVerifier::builder() 或
WebPkiClientVerifier::builder_with_provider() functions.
Once built, the provided Arc<dyn ClientCertVerifier> can be 用 with 一个 Rustls ServerConfig
到 configure client certificate validation using with_client_cert_verifier。
示例:
To require all clients present 一个 client certificate issued by 一个 trusted CA:
let client_verifier = WebPkiClientVerifier::builder(roots.into())
.build()
.unwrap();Or, to allow clients presenting a client certificate authenticated by a trusted CA, or anonymous clients that present no client certificate:
let client_verifier = WebPkiClientVerifier::builder(roots.into())
.allow_unauthenticated()
.build()
.unwrap();If you wish to disable advertising client authentication:
let client_verifier = WebPkiClientVerifier::no_client_auth();You can also configure the client verifier to check for certificate revocation with client certificate revocation lists (CRLs):
let client_verifier = WebPkiClientVerifier::builder(roots.into())
.with_crls(crls)
.build()
.unwrap();实现§
Source§impl WebPkiClientVerifier
impl WebPkiClientVerifier
Sourcepub fn builder(roots: Arc<RootCertStore>) -> ClientCertVerifierBuilder
pub fn builder(roots: Arc<RootCertStore>) -> ClientCertVerifierBuilder
创建一个 builder 用于 the webpki client certificate verifier configuration using
the process-default CryptoProvider。
Client certificate authentication , offered by the server, 并 客户端证书
, verified using the trust anchors found in the provided roots。 If you
wish 到 disable client authentication use WebPkiClientVerifier::no_client_auth() instead.
Use Self::builder_with_provider if you wish 到 specify an explicit provider.
For more information, see the ClientCertVerifierBuilder documentation.
Sourcepub fn builder_with_provider(
roots: Arc<RootCertStore>,
provider: Arc<CryptoProvider>,
) -> ClientCertVerifierBuilder
pub fn builder_with_provider( roots: Arc<RootCertStore>, provider: Arc<CryptoProvider>, ) -> ClientCertVerifierBuilder
创建一个 builder 用于 the webpki client certificate verifier configuration using
一个 specified CryptoProvider。
Client certificate authentication , offered by the server, 并 客户端证书
, verified using the trust anchors found in the provided roots。 If you
wish 到 disable client authentication use WebPkiClientVerifier::no_client_auth() instead.
此 cryptography 用 comes 从 the specified CryptoProvider。
For more information, see the ClientCertVerifierBuilder documentation.
Sourcepub fn no_client_auth() -> Arc<dyn ClientCertVerifier>
pub fn no_client_auth() -> Arc<dyn ClientCertVerifier>
创建一个 new WebPkiClientVerifier that disables client authentication. 此 server will
not offer client authentication 并 anonymous clients , 已接受.
This is in contrast 到 using WebPkiClientVerifier::builder().allow_unauthenticated().build(),
which will produce 一个 verifier that will offer client authentication, but not require it.
Trait 实现§
Source§impl ClientCertVerifier for WebPkiClientVerifier
impl ClientCertVerifier for WebPkiClientVerifier
Source§fn offer_client_auth(&self) -> bool
fn offer_client_auth(&self) -> bool
true 到 enable the server 到 request 一个 client certificate 并
false 到 skip requesting 一个 client certificate. Defaults 到 true.Source§fn client_auth_mandatory(&self) -> bool
fn client_auth_mandatory(&self) -> bool
true 到 require 一个 client certificate 并 false 到 make
client authentication optional.
Defaults 到 self.offer_client_auth().Source§fn root_hint_subjects(&self) -> &[DistinguishedName]
fn root_hint_subjects(&self) -> &[DistinguishedName]
DistinguishedName subjects that the server will hint 到 clients 到
identify acceptable authentication trust anchors. 更多信息Source§fn verify_client_cert(
&self,
end_entity: &CertificateDer<'_>,
intermediates: &[CertificateDer<'_>],
now: UnixTime,
) -> Result<ClientCertVerified, Error>
fn verify_client_cert( &self, end_entity: &CertificateDer<'_>, intermediates: &[CertificateDer<'_>], now: UnixTime, ) -> Result<ClientCertVerified, Error>
end_entity is valid, acceptable,
并 chains 到 at least one of the trust anchors trusted by
this verifier. 更多信息