Class UnsupportedSpecException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
zeroecho.core.err.UnsupportedSpecException
- All Implemented Interfaces:
Serializable
Exception indicating that a provided key/spec combination is not supported by
the algorithm for the requested role.
This is thrown by
CryptoAlgorithm.createContext(zeroecho.core.KeyUsage, java.security.Key, zeroecho.core.spec.ContextSpec)
when:
- The algorithm supports the requested
KeyUsagerole, but none of its bindings accept the givenKeyandContextSpectype. - The provided
specis incompatible with the key type or context expected by the binding.
Unlike UnsupportedRoleException, which signals that a role is
completely unavailable for an algorithm, this exception means that the role
exists but cannot be realized with the supplied parameters.
Example
CryptoAlgorithm aes = CryptoAlgorithms.require("AES/GCM");
SecretKey wrongKey = ... // an RSA key by mistake
try {
aes.createContext(KeyUsage.ENCRYPT, wrongKey, null);
} catch (UnsupportedSpecException e) {
// no binding accepted the RSA key for ENCRYPT role
}
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new exception with the given message. -
Method Summary
Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
UnsupportedSpecException
Creates a new exception with the given message.- Parameters:
m- detail message describing the rejected key/spec combination
-