pub struct VerifyPeerIdentity<Side: SideData> { /* 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().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 NeedsInput which will accept and process further data.
Implementations§
Source§impl<Side: SideData> VerifyPeerIdentity<Side>
impl<Side: SideData> VerifyPeerIdentity<Side>
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.
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.
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.