rc_crypto/
error.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#[derive(Debug, thiserror::Error)]
6pub enum ErrorKind {
7    #[error("NSS error: {0}")]
8    NSSError(#[from] nss::Error),
9    #[error("Internal crypto error")]
10    InternalError,
11    #[error("Conversion error: {0}")]
12    ConversionError(#[from] std::num::TryFromIntError),
13    #[error("Root hash format error: {0}")]
14    RootHashFormatError(String),
15    #[error("PEM content format error: {0}")]
16    PEMFormatError(String),
17    #[error("Certificate content error: {0}")]
18    CertificateContentError(String),
19    #[error("Certificate not yet valid or expired")]
20    CertificateValidityError,
21    #[error("Certificate subject mismatch")]
22    CertificateSubjectError,
23    #[error("Certificate issuer mismatch")]
24    CertificateIssuerError,
25    #[error("Certificate chain of trust error: {0}")]
26    CertificateChainError(String),
27    #[error("Signature content error: {0}")]
28    SignatureContentError(String),
29    #[error("Content signature mismatch error: {0}")]
30    SignatureMismatchError(String),
31}
32
33error_support::define_error! {
34    ErrorKind {
35        (ConversionError, std::num::TryFromIntError),
36        (NSSError, nss::Error),
37    }
38}