Skip to main content

PeerError

Enum PeerError 

Source
#[non_exhaustive]
pub enum PeerError {
Show 13 variants InvalidId, Certificate, Tls, WeakDigest, Policy(String), TrustPattern, NotWaiting, AlreadyAccepted, Path, Unsupported, Pairing(PairingError), Io(Error), CaFile { path: Option<PathBuf>, certificate: Option<usize>, read: Option<Error>, },
}
Expand description

Sanitized failures while loading, storing or using a peer identity. No message holds key material; only CaFile names a path, the file it could not use.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidId

A peer id is malformed.

§

Certificate

A certificate or its private key is missing or invalid.

§

Tls

A TLS configuration or handshake was refused.

§

WeakDigest

A fingerprint is an MD5 digest, which no policy allows.

§

Policy(String)

A policy setting is invalid or unsupported; the message names it and lists what is supported. It never holds key material.

§

TrustPattern

A trust glob is malformed.

§

NotWaiting

The peer is not waiting for acceptance.

§

AlreadyAccepted

The peer was already accepted.

§

Path

The path does not name a file inside a directory.

§

Unsupported

The trust policy cannot be used in this role.

§

Pairing(PairingError)

A pairing exchange, or a key rotation, failed: refused by either side, a malformed message, an unverified responder, or the store (a rotation announced by a peer that is not accepted is PairingError::Local with coqui_peer::Error::NotAccepted).

§

Io(Error)

A filesystem or stream operation failed.

§

CaFile

A file of certificate authorities (CaPolicy::ca_file, Roots::bundle_file) or a bundle given as text cannot be used: unreadable, holding no certificate, or holding one that is malformed or cannot be a trust anchor.

Fields

§path: Option<PathBuf>

The file; None for a bundle given as text.

§certificate: Option<usize>

The certificate that failed, by its position in the file from 0; None when the file cannot be read or holds no certificate.

§read: Option<Error>

Why the file could not be read, when that is the failure.

Implementations§

Source§

impl PeerError

Source

pub fn pair_refusal(&self) -> Option<PairRefusal>

Why a pairing was refused, by this side or the other, when that is the failure.

Source

pub fn refusal(&self) -> Option<Refusal>

The trust refusal behind this error, when a handshake failed because this side’s verifier refused the peer’s certificate. The refused side sees only the TLS alert, so its own error carries none.

Trait Implementations§

Source§

impl Debug for PeerError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PeerError

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for PeerError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for PeerError

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<PairingError> for PeerError

Source§

fn from(error: PairingError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.