wire_e2e_identity/acquisition/
error.rs1use openmls_traits::types::Ciphersuite;
2use rusty_jwt_tools::prelude::RustyJwtError;
3
4use crate::pki_env::hooks::PkiEnvironmentHooksError;
5
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("certificate acquisition is not supported for {0:?}")]
9 UnsupportedCipherSuite(Ciphersuite),
10 #[error("a PKI environment hook failed")]
11 HookFailed(#[from] PkiEnvironmentHooksError),
12 #[error("JSON parsing failed")]
13 Json(#[from] serde_json::Error),
14 #[error("HTTP response is missing header '{0}'")]
15 MissingHeader(&'static str),
16 #[error(transparent)]
17 Acme(#[from] crate::acme::Error),
18 #[error(transparent)]
19 RustyJwtError(#[from] RustyJwtError),
20 #[error(transparent)]
21 JsonWebToken(#[from] rusty_jwt_tools::jsonwebtoken::errors::Error),
22 #[error(transparent)]
24 InvalidCertificate(#[from] CertificateError),
25}
26
27#[derive(Debug, thiserror::Error)]
29pub enum CertificateError {
30 #[error("Client ID is not in a valid format")]
32 InvalidClientId,
33 #[error("ClientId does not match expected one")]
35 ClientIdMismatch,
36 #[error("Display name does not match expected one")]
38 DisplayNameMismatch,
39 #[error("Handle does not match expected one")]
41 HandleMismatch,
42 #[error("Domain does not match expected one")]
44 DomainMismatch,
45 #[error("DisplayName is missing from the certificate")]
47 MissingDisplayName,
48 #[error("Handle is missing from the certificate")]
50 MissingHandle,
51 #[error("Domain is missing from the certificate")]
53 MissingDomain,
54 #[error("ClientId is missing from the certificate")]
56 MissingClientId,
57 #[error("X509 lacks required standard fields")]
59 InvalidFormat,
60 #[error("Certificate algorithm does not match the one of the signing keypair")]
62 AlgorithmMismatch,
63 #[error("Certificate public key does not match the one in the signing keypair")]
65 KeyMismatch,
66 #[error("The signing keypair could not be parsed for the expected signature algorithm")]
68 InvalidSigningKeypair,
69 #[error("Advertised public key is not supported")]
71 UnsupportedPublicKey,
72 #[error(transparent)]
74 Validation(#[from] crate::validation::Error),
75 #[error(transparent)]
77 Der(#[from] spki::der::Error),
78 #[error(transparent)]
80 Utf8(#[from] std::str::Utf8Error),
81 #[error(transparent)]
83 Acme(#[from] crate::acme::Error),
84 #[error(transparent)]
86 RustyJwtError(#[from] RustyJwtError),
87 #[error(transparent)]
89 JsonWebToken(#[from] rusty_jwt_tools::jsonwebtoken::errors::Error),
90}