use thiserror::Error;
#[derive(Clone, Debug, Error, Eq, PartialEq)]
#[non_exhaustive]
pub enum CertError {
#[error("Key on certificate was not as expected")]
KeyMismatch,
#[error("Missing signing key on certificate")]
MissingPubKey,
#[error("Signature on certificate was invalid")]
BadSignature,
}
#[cfg(feature = "encode")]
#[cfg_attr(docsrs, doc(cfg(feature = "encode")))]
#[derive(Clone, Debug, Error)]
#[non_exhaustive]
pub enum CertEncodeError {
#[error("Tried to sign with wrong key")]
KeyMismatch,
#[error("Too many extensions")]
TooManyExtensions,
#[error("Extension too long")]
ExtensionTooLong,
#[error("Missing field {0:?}")]
MissingField(&'static str),
#[error("Tried to generate a cert we couldn't encode.")]
Bytes(#[from] tor_bytes::EncodeError),
}