#[non_exhaustive]pub enum Error {
Show 17 variants
InvalidLength {
expected: usize,
actual: usize,
},
InvalidEncapsulationKey,
InvalidDecapsulationKey,
InvalidCiphertext,
InvalidVerifyingKey,
InvalidSigningKey,
InvalidSignature,
RngFailure,
PolicyViolation,
ContextTooLong {
max: usize,
actual: usize,
},
SelfTestFailed,
PairwiseConsistencyFailed,
EntropyHealthCheckFailed,
ModuleInErrorState,
DrbgReseedRequired,
DrbgInvalidRequest,
NonApprovedService,
}Expand description
Cryptographic and validation error conditions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidLength
Input byte slice had an unexpected length for the target key, ciphertext, or signature.
InvalidEncapsulationKey
Encapsulation (public) key failed specification validation (e.g., modulus check in FIPS 203).
InvalidDecapsulationKey
Decapsulation (private) key failed integrity checks (e.g., hash check in FIPS 203).
InvalidCiphertext
Ciphertext was malformed or failed structural checks.
InvalidVerifyingKey
Verification (public) key failed specification validation.
InvalidSigningKey
Signing (private) key failed specification validation or integrity checks.
InvalidSignature
Digital signature was malformed or failed verification.
RngFailure
Cryptographic random number generator failed.
PolicyViolation
Requested algorithm or parameter set violates the active security policy.
ContextTooLong
Domain-separation context string exceeded the maximum permitted length (255 bytes for ML-DSA, SLH-DSA and the composite signature schemes).
Fields
SelfTestFailed
A FIPS 140-3 pre-operational, conditional (CAST), or software integrity self-test failed.
PairwiseConsistencyFailed
A FIPS 140-3 pairwise consistency test (PCT) failed during key generation.
EntropyHealthCheckFailed
An entropy source health check (e.g., SP 800-90B RCT/APT) failed.
ModuleInErrorState
The cryptographic module is locked in its error state and refuses all cryptographic services.
DrbgReseedRequired
A DRBG instance reached its reseed interval or SP 800-90C output budget and must be reseeded.
DrbgInvalidRequest
A DRBG request violated SP 800-90A/90C bounds (e.g., insufficient entropy/nonce or excessive length).
NonApprovedService
The requested operation is not an approved service in the active FIPS 140-3 mode.
Trait Implementations§
impl Copy for Error
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()