use thiserror::Error;
#[derive(Debug, Error)]
pub enum CryptoError {
#[error("XML security error: {0}")]
BergshamraError(#[from] bergshamra_core::Error),
#[error("Key not found: {0}")]
KeyNotFound(String),
#[error("Signature contains ds:Object element (rejected per SAML errata E91)")]
SignatureContainsDsObject,
#[error("Unsupported algorithm: {0}")]
UnsupportedAlgorithm(String),
#[error("Signature algorithm is not allowed by SAML algorithm policy: {0}")]
DisallowedSignatureAlgorithm(String),
#[error("Digest algorithm is not allowed by SAML algorithm policy: {0}")]
DisallowedDigestAlgorithm(String),
#[error("Signature verification failed: {0}")]
VerificationFailed(String),
#[error("Certificate validation error: {0}")]
CertificateError(String),
#[error("Encryption error: {0}")]
EncryptionError(String),
#[error("Decryption error: {0}")]
DecryptionError(String),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("HSM signing error: {0}")]
HsmError(String),
}