Skip to main content

ctaes_rs/
error.rs

1// Copyright (c) 2023 Blockstream
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or https://opensource.org/licenses/mit-license.php.
4
5use thiserror::Error;
6
7/// The errors that can be encountered using this crate
8#[derive(Debug, Clone, Error)]
9pub enum Error {
10    #[error("Key must be '{0}' bytes long")]
11    KeyIncorrectLength(usize),
12    #[error("IV must be 16 bytes long")]
13    IvIncorrectLength,
14    #[error("Buffer not multiple of block size")]
15    NonBlockSizeAlignedBuffer,
16    #[error("Output buffer is not big enough to hold the result of processing input")]
17    InsufficientBufferSize,
18    #[error("Buffer not large enough to accomodate padded buffer")]
19    PaddedBufferTooSmall,
20    #[error("Unable to unpad buffer: {0}")]
21    UnpadError(String),
22}