kerberos_crypto/
error.rs

1use thiserror;
2use std::result;
3
4/// Result that encapsulates the Error type of this library
5pub type Result<T> = result::Result<T, Error>;
6
7/// Error raised by the routines of this library
8#[derive(thiserror::Error, Clone, Debug, PartialEq)]
9pub enum Error {
10    /// Error while decrypting the data
11    #[error("DecryptionError: {0}")]
12    DecryptionError(String),
13
14    /// Data is encrypted with an unsupported crypto algorithm
15    #[error("UnsupportedAlgorithm: {0}")]
16    UnsupportedAlgorithm(i32),
17
18    /// Invalid key
19    #[error(
20        "Invalid key: Only hexadecimal characters are allowed [1234567890abcdefABCDEF]"
21    )]
22    InvalidKeyCharset,
23
24    /// Invalid key
25    #[error("Invalid key: Length should be {0}")]
26    InvalidKeyLength(usize),
27}