pub struct VerifyPeerIdentity<Side: SideData, T: Transport> { /* private fields */ }Expand description
The peer’s presented identity must be verified.
The caller has three choices:
-
Call
Self::with_config(). This calls the configured verifier trait (ClientVerifier::verify_identity()orServerVerifier::verify_identity()) synchronously. -
Call
Self::presented_identity()to obtain the peer’s presented identity, verify that outside the library (perhaps asynchronously), and then continue the handshake withSelf::continue_with().Sessions established this way are stored for resumption exactly as if the configured verifier had been used. The external verification must therefore be equivalent to the configured verifier. If it applies a different policy, use a separate config with separate resumption storage.
If the verification fails, the error can be passed into
Self::continue_with()to follow a uniform error handling path. -
Abandon the handshake by discarding this object.
The returned object is a further handshake state for this side. Commonly this will
contain a ServerHandshake::NeedsInput, ClientHandshake::NeedsInput,
quic::ServerHandshake::NeedsInput or quic::ClientHandshake::NeedsInput
which will accept and process further data.
Implementations§
Source§impl<Side: SideData, T: Transport> VerifyPeerIdentity<Side, T>
impl<Side: SideData, T: Transport> VerifyPeerIdentity<Side, T>
Sourcepub fn presented_identity(&self) -> Result<Side::PeerIdentity<'_>, Error>
pub fn presented_identity(&self) -> Result<Side::PeerIdentity<'_>, Error>
Inspect the identity that the peer has provided.
Source§impl<Side: SideData> VerifyPeerIdentity<Side, Tcp>
impl<Side: SideData> VerifyPeerIdentity<Side, Tcp>
Sourcepub fn with_config(self, tls: &mut Vec<u8>) -> Result<Side::Handshake, Error>
pub fn with_config(self, tls: &mut Vec<u8>) -> Result<Side::Handshake, Error>
Progress the handshake by calling the pre-configured certificate verification trait.
Sourcepub fn continue_with(
self,
verification_result: Result<VerifiedIdentity<'static>, Error>,
tls: &mut Vec<u8>,
) -> Result<Side::Handshake, Error>
pub fn continue_with( self, verification_result: Result<VerifiedIdentity<'static>, Error>, tls: &mut Vec<u8>, ) -> Result<Side::Handshake, Error>
Progress the handshake by incorporating the result of an external verification.
Further data to send to the peer may be appended to tls.
See VerifyPeerIdentity for important requirements related to resumption safety.
If verification_result is an error, this error is returned and the handshake terminates.
An alert may be appended to tls for sending to the peer.
Source§impl<Side: SideData> VerifyPeerIdentity<Side, Quic>
impl<Side: SideData> VerifyPeerIdentity<Side, Quic>
Sourcepub fn with_config(
self,
output: &mut Vec<QuicEvent>,
) -> Result<Side::QuicHandshake, Error>
pub fn with_config( self, output: &mut Vec<QuicEvent>, ) -> Result<Side::QuicHandshake, Error>
Progress the handshake by calling the pre-configured certificate verification trait.
Sourcepub fn continue_with(
self,
verification_result: Result<VerifiedIdentity<'static>, Error>,
output: &mut Vec<QuicEvent>,
) -> Result<Side::QuicHandshake, Error>
pub fn continue_with( self, verification_result: Result<VerifiedIdentity<'static>, Error>, output: &mut Vec<QuicEvent>, ) -> Result<Side::QuicHandshake, Error>
Progress the handshake by incorporating the result of an external verification.
See VerifyPeerIdentity for important requirements related to resumption safety.
If verification_result is an error, this error is returned and the handshake terminates.
Events are appended to output.