bouncycastle_core/
errors.rs1#[derive(Debug)]
8pub enum HashError {
9 GenericError(&'static str),
11 InvalidLength(&'static str),
13 InvalidState(&'static str),
15 InvalidInput(&'static str),
17 KeyMaterialError(KeyMaterialError),
19}
20
21#[derive(Debug)]
23pub enum KeyMaterialError {
24 ActingOnZeroizedKey,
26 GenericError(&'static str),
28 HazardousOperationNotPermitted,
30 InputDataLongerThanKeyCapacity,
32 InvalidKeyType(&'static str),
34 InvalidLength,
36 SecurityStrength(&'static str),
38}
39
40#[derive(Debug)]
42pub enum KDFError {
43 GenericError(&'static str),
45 HashError(HashError),
47 InvalidLength(&'static str),
49 KeyMaterialError(KeyMaterialError),
51 MACError(MACError),
53}
54
55#[derive(Debug)]
57pub enum KEMError {
58 GenericError(&'static str),
60 ConsistencyCheckFailed(&'static str),
62 EncodingError(&'static str),
64 DecapsulationFailed,
66 DecodingError(&'static str),
68 KeyGenError(&'static str),
70 KeyMaterialError(KeyMaterialError),
72 LengthError(&'static str),
74 RNGError(RNGError),
76}
77
78#[derive(Debug)]
80pub enum MACError {
81 GenericError(&'static str),
83 HashError(HashError),
85 InvalidLength(&'static str),
87 InvalidState(&'static str),
89 KeyMaterialError(KeyMaterialError),
91}
92
93#[derive(Debug)]
95pub enum RNGError {
96 GenericError(&'static str),
98
99 Uninitialized,
101
102 InsufficientSeedEntropy,
106
107 ReseedRequired,
109
110 SecurityStrengthInsufficientForAlgorithm,
114
115 KeyMaterialError(KeyMaterialError),
117}
118
119#[derive(Debug)]
121pub enum SuspendableError {
122 IncompatibleVersion,
124 InvalidData,
126}
127
128#[derive(Debug)]
130pub enum SignatureError {
131 GenericError(&'static str),
133 ConsistencyCheckFailed(),
135 EncodingError(&'static str),
137 DecodingError(&'static str),
139 KeyGenError(&'static str),
141 KeyMaterialError(KeyMaterialError),
143 LengthError(&'static str),
145 SignatureVerificationFailed,
147 RNGError(RNGError),
149}
150
151#[derive(Debug)]
153pub enum SymmetricCipherError {
154 GenericError(&'static str),
156 AEADTagCheckFailed,
158 DecryptionFailed,
160 IncorrectOutputBufferLength(&'static str, usize),
163 KeyMaterialError(KeyMaterialError),
165 RNGError(RNGError),
167 StateError(&'static str),
169}
170
171impl From<KeyMaterialError> for SymmetricCipherError {
173 fn from(e: KeyMaterialError) -> SymmetricCipherError {
174 Self::KeyMaterialError(e)
175 }
176}
177
178impl From<RNGError> for SymmetricCipherError {
179 fn from(e: RNGError) -> SymmetricCipherError {
180 Self::RNGError(e)
181 }
182}
183
184impl From<KeyMaterialError> for HashError {
185 fn from(e: KeyMaterialError) -> HashError {
186 Self::KeyMaterialError(e)
187 }
188}
189
190impl From<HashError> for KDFError {
191 fn from(e: HashError) -> KDFError {
192 Self::HashError(e)
193 }
194}
195
196impl From<MACError> for KDFError {
197 fn from(e: MACError) -> KDFError {
198 Self::MACError(e)
199 }
200}
201
202impl From<KeyMaterialError> for KDFError {
203 fn from(e: KeyMaterialError) -> KDFError {
204 Self::KeyMaterialError(e)
205 }
206}
207
208impl From<KeyMaterialError> for KEMError {
209 fn from(e: KeyMaterialError) -> KEMError {
210 Self::KeyMaterialError(e)
211 }
212}
213
214impl From<RNGError> for KEMError {
215 fn from(e: RNGError) -> KEMError {
216 Self::RNGError(e)
217 }
218}
219
220impl From<KeyMaterialError> for MACError {
221 fn from(e: KeyMaterialError) -> MACError {
222 Self::KeyMaterialError(e)
223 }
224}
225
226impl From<HashError> for MACError {
227 fn from(e: HashError) -> MACError {
228 Self::HashError(e)
229 }
230}
231
232impl From<KeyMaterialError> for RNGError {
233 fn from(e: KeyMaterialError) -> RNGError {
234 Self::KeyMaterialError(e)
235 }
236}
237
238impl From<KeyMaterialError> for SignatureError {
239 fn from(e: KeyMaterialError) -> SignatureError {
240 Self::KeyMaterialError(e)
241 }
242}
243
244impl From<RNGError> for SignatureError {
245 fn from(e: RNGError) -> SignatureError {
246 Self::RNGError(e)
247 }
248}