1#![allow(missing_docs)]
4
5use std::borrow::Cow;
6use thiserror::Error;
7
8#[derive(Error, Debug)]
9pub enum Error {
10    #[error("Binary object not found {0}")]
11    BinaryObjectNotFoundError(&'static str),
12    #[error("Certificate verification error in certificate with index {0}")]
13    CertificateVerificationError(usize),
14    #[error("Public key and signature mismatch of {0}")]
15    PublicKeyMismatchError(&'static str),
16    #[error("Unsupported cipher type {0:?}")]
17    UnsupportedCipherTypeError(crate::binary_format::xmr_license::CipherType),
18    #[error("P256 decode error")]
19    P256DecodeError,
20    #[error("Missing license in challenge response")]
21    LicenseMissingError,
22    #[error("Missing certificate in BCertChain")]
23    CertificateMissingError,
24    #[error("Missing group key in device")]
25    GroupKeyMissingError,
26    #[error("Invalid Wrm header. Reason: {0}, value: {1}")]
27    InvalidWrmHeader(&'static str, Cow<'static, str>),
28    #[error("Slice out of bounds in {0} at length {1}")]
29    SliceOutOfBoundsError(&'static str, usize),
30    #[error("Parse error")]
31    ParseError(#[from] binrw::Error),
32    #[error("IO error")]
33    IOError(#[from] std::io::Error),
34    #[error("Base64 decode error")]
35    Base64DecodeError(#[from] base64::DecodeError),
36    #[error("Integer conversion error")]
37    TryFromIntError(#[from] std::num::TryFromIntError),
38    #[error("P256 signature verification error")]
39    P256EcdsaError(#[from] p256::ecdsa::Error),
40    #[error("XML builder error")]
41    XmlBuilderError(#[from] xml_builder::XMLError),
42    #[error("XML parser error")]
43    XmlParserError(#[from] roxmltree::Error),
44    #[error("Utf8 conversion error")]
45    Utf8Error(#[from] std::string::FromUtf8Error),
46    #[error("Aes invalid length")]
47    AesInvalidLengthError(#[from] aes::cipher::InvalidLength),
48}