mithril_common/crypto_helper/cardano/kes/
error.rs

1use thiserror::Error;
2
3use crate::crypto_helper::{KesEvolutions, KesPeriod};
4
5/// KES verification error
6#[derive(Error, Debug)]
7pub enum KesVerifyError {
8    /// Error raised when an operational certificate is invalid
9    #[error("invalid operational certificate")]
10    OpCertInvalid,
11
12    /// Error raised when a KES Signature verification fails
13    #[error("KES signature verification error: KesEvolutions={0}, StartKesPeriod={1}")]
14    SignatureInvalid(KesEvolutions, KesPeriod),
15
16    /// Error raised when a KES evolutions is invalid
17    #[error("invalid KES evolutions")]
18    InvalidKesEvolutions(KesEvolutions),
19}
20
21/// KES signature error
22#[derive(Error, Debug, PartialEq, Eq)]
23pub enum KesSignError {
24    /// Error raised when a KES update error occurs
25    #[error("KES key cannot be updated for evolution {0}")]
26    UpdateKey(KesEvolutions),
27
28    /// Period of key file does not match with period provided by user
29    #[error("Period of key file {0} does not match with period provided by user {1}")]
30    PeriodMismatch(KesPeriod, KesPeriod),
31}