flamberge-crypto 0.1.1

Shared cryptographic primitives for Flamberge (PC1, Topaz, AES, DES, RC4, CRC-32, digests, PBKDF2)
Documentation
use thiserror::Error;

/// Errors from the crypto primitives.
#[derive(Debug, Error)]
pub enum CryptoError {
    #[error("invalid key length: expected {expected} bytes, got {got}")]
    KeyLength { expected: usize, got: usize },

    #[error("invalid IV length: expected {expected} bytes, got {got}")]
    IvLength { expected: usize, got: usize },

    #[error("input length {0} is not a multiple of the {1}-byte block size")]
    NotBlockAligned(usize, usize),

    #[error("invalid PKCS#7 padding (wrong key?)")]
    BadPadding,

    #[error("RSA operation failed: {0}")]
    Rsa(String),
}