#[non_exhaustive]pub enum KeyStoreError {
NotFound(KeyId),
AlreadyExists(KeyId),
AlgorithmMismatch {
key: KeyId,
key_alg: JwsAlgorithm,
requested: JwsAlgorithm,
},
Unsupported(&'static str),
UnsupportedAlgorithm(JwsAlgorithm),
UnsupportedKeyType(KeyType),
InvalidSpec {
key_type: KeyType,
alg: JwsAlgorithm,
},
InvalidKey {
key: KeyId,
reason: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Io {
path: PathBuf,
source: Error,
},
InsecurePermissions {
path: PathBuf,
mode: u32,
},
InvalidKeySet {
path: PathBuf,
reason: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Backend(Box<dyn Error + Send + Sync + 'static>),
}Expand description
Why a KeyStore operation failed.
The first variants are the contract every backend follows (the test suite checks them); the
file variants are reported by SoftwareKeyStore, and
Backend carries whatever a remote backend reports.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotFound(KeyId)
No key has this id.
AlreadyExists(KeyId)
A key with this id exists already, so it cannot be generated or imported.
AlgorithmMismatch
The key signs with another algorithm than the one requested.
Fields
key_alg: JwsAlgorithmThe algorithm the key was created for.
requested: JwsAlgorithmThe algorithm that was requested.
Unsupported(&'static str)
The backend does not implement this operation (generate or delete).
UnsupportedAlgorithm(JwsAlgorithm)
The backend does not sign with this algorithm; see
KeyStoreCapabilities::algorithms.
UnsupportedKeyType(KeyType)
The backend cannot generate keys of this type.
InvalidSpec
The algorithm of a KeySpec does not fit its key type, for example
ES256 with an Ed25519 key.
InvalidKey
The key exists but its material cannot be used: it does not decode, the public part does
not match the private part, the type is unknown, and so on. The source is the error that
says why, when there is one: the JwkError of a public key that
does not convert to a JWK, the error of a private scalar out of range.
Fields
Io
Reading or writing the key store file failed.
InsecurePermissions
The key store file is readable or writable by other users.
InvalidKeySet
The key store file is not a usable JWK set. The source is the JSON error, or the error that makes one of its keys unusable, when there is one.
Fields
Backend(Box<dyn Error + Send + Sync + 'static>)
An error of a remote backend (an HSM, a cloud service).
Implementations§
Source§impl KeyStoreError
impl KeyStoreError
Sourcepub fn invalid_key(key: KeyId, reason: impl Into<String>) -> Self
pub fn invalid_key(key: KeyId, reason: impl Into<String>) -> Self
KeyStoreError::InvalidKey for key, without an underlying error.
Trait Implementations§
Source§impl Debug for KeyStoreError
impl Debug for KeyStoreError
Source§impl Display for KeyStoreError
impl Display for KeyStoreError
Source§impl Error for KeyStoreError
impl Error for KeyStoreError
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()