#[non_exhaustive]pub enum Error {
Show 20 variants
NotAvailable,
KeyNotFound {
label: String,
},
DuplicateLabel {
label: String,
},
InvalidLabel {
reason: String,
},
SignFailed {
detail: String,
},
EncryptFailed {
detail: String,
},
DecryptFailed {
detail: String,
},
AuthDenied {
label: String,
},
AuthRequired {
label: String,
detail: String,
},
UserCancelled {
label: String,
},
KeyOperation {
operation: String,
detail: String,
},
TamperDetected {
path: String,
},
RequiresSigning {
feature: String,
},
PolicyNotSupported {
policy: String,
},
PresenceNotAvailable,
NotImplemented {
feature: String,
},
PolicyMismatch {
detail: String,
},
Config(String),
Io(Error),
Memory(String),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotAvailable
The hardware security module is absent, not enrolled, or unreachable.
KeyNotFound
No key with the given label exists in this app’s key store.
DuplicateLabel
A key with this label already exists.
InvalidLabel
The label is syntactically invalid (empty, too long, or contains illegal characters).
SignFailed
The signing operation failed.
EncryptFailed
The encryption operation failed.
DecryptFailed
The decryption operation failed; the ciphertext may be corrupt or have been tampered with.
AuthDenied
The OS keychain / TPM ACL has a Deny entry for this binary.
AuthRequired
User authentication is required but the device is locked or no GUI session is available.
UserCancelled
The user dismissed the biometric or PIN prompt.
KeyOperation
A lower-level key operation failed.
TamperDetected
File HMAC mismatch — the file has been modified outside the API.
RequiresSigning
Returned from factory construction (not first use) when a config option requires a code-signed binary with the named entitlement/feature.
The requested configuration requires a code-signed binary with a specific entitlement.
PolicyNotSupported
The backend cannot enforce the requested AccessPolicy (e.g. BiometricOnly on Linux).
Returned from generate_key() when the backend cannot enforce the
requested AccessPolicy (e.g. BiometricOnly on Linux keyring/TPM).
PresenceNotAvailable
sign_with_presence(Strict, ...) was called on a platform without biometric support.
Returned from sign_with_presence() when PresenceMode::Strict is
requested but the platform has no user-presence support.
NotImplemented
This API is not yet fully implemented on this platform. Check the feature string.
PolicyMismatch
The key’s stored access policy does not match. Regenerate the key.
This typically indicates the key was generated with a different policy and should be regenerated.
Config(String)
A configuration value is invalid.
Io(Error)
An I/O error occurred.
Memory(String)
An in-process memory protection operation failed (guard-page allocation, mlock, etc.).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()