Debian Codegraph @

third_party/rust/mls-rs-identity-x509/src/error.rs

raw
1 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 // Copyright by contributors to this project.
3 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
4
5 use mls_rs_core::{error::AnyError, identity::CredentialType};
6
7 #[derive(Debug)]
8 #[cfg_attr(feature = "std", derive(thiserror::Error))]
9 pub enum X509IdentityError {
10 #[cfg_attr(feature = "std", error("unsupported credential type {0:?}"))]
11 UnsupportedCredentialType(CredentialType),
12 #[cfg_attr(
13 feature = "std",
14 error("signing identity public key does not match the leaf certificate")
15 )]
16 SignatureKeyMismatch,
17 #[cfg_attr(feature = "std", error("unable to parse certificate chain data"))]
18 InvalidCertificateChain,
19 #[cfg_attr(feature = "std", error("invalid offset within certificate chain"))]
20 InvalidOffset,
21 #[cfg_attr(feature = "std", error("empty certificate chain"))]
22 EmptyCertificateChain,
23 #[cfg_attr(feature = "std", error(transparent))]
24 CredentialEncodingError(AnyError),
25 #[cfg_attr(feature = "std", error(transparent))]
26 X509ReaderError(AnyError),
27 #[cfg_attr(feature = "std", error(transparent))]
28 IdentityExtractorError(AnyError),
29 #[cfg_attr(feature = "std", error(transparent))]
30 X509ValidationError(AnyError),
31 #[cfg_attr(feature = "std", error(transparent))]
32 IdentityWarningProviderError(AnyError),
33 }
34
35 impl mls_rs_core::error::IntoAnyError for X509IdentityError {
36 #[cfg(feature = "std")]
37 fn into_dyn_error(self) -> Result<Box<dyn std::error::Error + Send + Sync>, Self> {
38 Ok(self.into())
39 }
40 }