bouncycastle_core_interface/
errors.rs1#[derive(Debug)]
2pub enum HashError {
3 GenericError(&'static str),
4 InvalidLength(&'static str),
5 InvalidState(&'static str),
6 InvalidInput(&'static str),
7 KeyMaterialError(KeyMaterialError),
8}
9
10#[derive(Debug)]
11pub enum KeyMaterialError {
12 ActingOnZeroizedKey,
13 GenericError(&'static str),
14 HazardousOperationNotPermitted,
15 InputDataLongerThanKeyCapacity,
16 InvalidKeyType(&'static str),
17 InvalidLength,
18 SecurityStrength(&'static str),
19}
20
21#[derive(Debug)]
22pub enum KDFError {
23 GenericError(&'static str),
24 HashError(HashError),
25 InvalidLength(&'static str),
26 KeyMaterialError(KeyMaterialError),
27 MACError(MACError),
28}
29
30#[derive(Debug)]
31pub enum MACError {
32 GenericError(&'static str),
33 HashError(HashError),
34 InvalidLength(&'static str),
35 InvalidState(&'static str),
36 KeyMaterialError(KeyMaterialError),
37}
38
39#[derive(Debug)]
40pub enum RNGError {
41 GenericError(&'static str),
42
43 Uninitialized,
45
46 InsufficientSeedEntropy,
50
51 ReseedRequired,
53
54 KeyMaterialError(KeyMaterialError),
55}
56
57#[derive(Debug)]
58pub enum SignatureError {
59 GenericError(&'static str),
60 ConsistencyCheckFailed(),
61 EncodingError(&'static str),
62 DecodingError(&'static str),
63 KeyGenError(&'static str),
64 LengthError(&'static str),
65 RNGError(RNGError),
66 KeyMaterialError(KeyMaterialError),
67 SignatureVerificationFailed,
68}
69
70
71
72
73impl From<KeyMaterialError> for HashError {
75 fn from(e: KeyMaterialError) -> HashError {
76 Self::KeyMaterialError(e)
77 }
78}
79
80impl From<HashError> for KDFError {
81 fn from(e: HashError) -> KDFError {
82 Self::HashError(e)
83 }
84}
85
86impl From<MACError> for KDFError {
87 fn from(e: MACError) -> KDFError {
88 Self::MACError(e)
89 }
90}
91
92impl From<KeyMaterialError> for KDFError {
93 fn from(e: KeyMaterialError) -> KDFError {
94 Self::KeyMaterialError(e)
95 }
96}
97
98impl From<KeyMaterialError> for MACError {
99 fn from(e: KeyMaterialError) -> MACError {
100 Self::KeyMaterialError(e)
101 }
102}
103
104impl From<HashError> for MACError {
105 fn from(e: HashError) -> MACError {
106 Self::HashError(e)
107 }
108}
109
110impl From<KeyMaterialError> for RNGError {
111 fn from(e: KeyMaterialError) -> RNGError {
112 Self::KeyMaterialError(e)
113 }
114}
115
116impl From<KeyMaterialError> for SignatureError {
117 fn from(e: KeyMaterialError) -> SignatureError {
118 Self::KeyMaterialError(e)
119 }
120}
121
122impl From<RNGError> for SignatureError {
123 fn from(e: RNGError) -> SignatureError { Self::RNGError(e) }
124}
125