sett 0.4.0

Rust port of sett (data compression, encryption and transfer tool).
Documentation
//! Errors associated with the `cert` module.

/// Errors occurring during the handling of OpenPGP certificates.
#[derive(Debug)]
#[non_exhaustive]
pub enum CertError {
    /// Error during certificate revocation.
    RevocationError(RevocationError),
}

impl std::fmt::Display for CertError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::RevocationError(e) => write!(f, "key revocation error: {e}"),
        }
    }
}

impl From<RevocationError> for CertError {
    fn from(error: RevocationError) -> Self {
        Self::RevocationError(error)
    }
}

/// Error during certificate revocation.
#[derive(Debug, PartialEq)]
pub enum RevocationError {
    /// No revocation signature was provided (no OpenPGP signature block was
    /// found in the input).
    NoSignature,
    /// The provided revocation signature could not be parsed, e.g. because
    /// the OpenPGP signature block content is invalid.
    ParsingError(String),
    /// The revocation signature does not match the certificate to revoke.
    WrongSignature,
}

impl std::error::Error for RevocationError {}

impl std::fmt::Display for RevocationError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::NoSignature => {
                write!(f, "input contains no valid revocation signature")
            }
            Self::ParsingError(e) => {
                write!(f, "error parsing revocation signature: {e}")
            }
            Self::WrongSignature => write!(
                f,
                "revocation signature does not match the certificate to revoke"
            ),
        }
    }
}