#[derive(Debug)]
#[non_exhaustive]
pub enum CertError {
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)
}
}
#[derive(Debug, PartialEq)]
pub enum RevocationError {
NoSignature,
ParsingError(String),
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"
),
}
}
}