#[non_exhaustive]pub enum Error {
WrongPassword,
NoEntropy,
UnsupportedHandler(Box<[u8]>),
MismatchedCryptFilters,
MissingCryptFilter(Box<[u8]>),
MalformedEncryptDict(&'static str),
CipherKeyLength {
cipher: &'static str,
len: usize,
},
}Expand description
What went wrong building a security handler.
The C++ collapses every one of these into a single “password error” at the parser boundary; splitting them changes no document’s fate but lets a caller tell “this needs a password” from “we cannot do this document’s cryptography”.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WrongPassword
The password is neither the user nor the owner password.
NoEntropy
The operating system’s cryptographic generator is unavailable, so no file key can be minted. Raised only when creating an encrypted file; opening one needs no randomness.
UnsupportedHandler(Box<[u8]>)
/Filter names a handler other than /Standard. Public-key handlers
(/Adobe.PubSec) land here.
MismatchedCryptFilters
[oracle-bug] Never constructed. §7.6.5 table 20 makes /StmF
and /StrF independent, so a pair naming different crypt filters is
conformant and this crate resolves each class separately. The variant
is kept because it is a public enum member and removing it is a
breaking change no caller gains from; nothing produces it.
MissingCryptFilter(Box<[u8]>)
The named crypt filter is not a key in /CF. An empty name is
§7.6.5’s /Identity default rather than an error.
MalformedEncryptDict(&'static str)
The dictionary is structurally unusable.
CipherKeyLength
The resolved key length is one this cipher does not accept.
Trait Implementations§
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()