1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum Error {
8 #[error("HTTP error: {0}")]
10 Http(String),
11
12 #[error("ASN.1 error: {0}")]
14 Asn1(String),
15
16 #[error("Timestamp verification error: {0}")]
18 Verification(String),
19
20 #[error("Invalid timestamp response: {0}")]
22 InvalidResponse(String),
23
24 #[error("Failed to parse timestamp response: {0}")]
26 ParseError(String),
27
28 #[error("Failed to verify timestamp signature: {0}")]
30 SignatureVerificationError(String),
31
32 #[error("Timestamp message hash mismatch: expected {expected}, got {actual}")]
34 HashMismatch { expected: String, actual: String },
35
36 #[error("Timestamp response indicates failure status")]
38 ResponseFailure,
39
40 #[error("No timestamp token in response")]
42 NoToken,
43
44 #[error("No TSTInfo in timestamp token")]
46 NoTstInfo,
47
48 #[error("Leaf certificate does not have TimeStamping Extended Key Usage")]
50 InvalidEKU,
51
52 #[error("TSA certificate validation failed: {0}")]
54 CertificateValidationError(String),
55
56 #[error("Timestamp parsing error: {0}")]
58 Parse(String),
59}
60
61pub type Result<T> = std::result::Result<T, Error>;