playready/
error.rs

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