Class UnsupportedRoleException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
zeroecho.core.err.UnsupportedRoleException
- All Implemented Interfaces:
Serializable
Exception indicating that an algorithm does not support the requested role.
This is thrown when a CryptoAlgorithm (or helpers such
as CryptoAlgorithms) is asked to create a context for a
KeyUsage that the algorithm never advertises. In other
words, the operation is unavailable regardless of the provided key or spec.
When it is thrown
- During
ZeroEchoSession.createContext(String, zeroecho.core.KeyUsage, java.security.Key, zeroecho.core.spec.ContextSpec)after policy validation, if the resolved algorithm exposes no bindings for the given role. - Directly from
CryptoAlgorithm.createContext(zeroecho.core.KeyUsage, java.security.Key, zeroecho.core.spec.ContextSpec)when no binding exists for the role.
Contrast with UnsupportedSpecException, which means the role exists
but no binding accepts the supplied key/spec types.
Example
// Suppose "SHA-256" supports DIGEST only.
zeroecho.sdk.ZeroEchoSession session = new zeroecho.sdk.ZeroEchoSession();
try {
// Asking for ENCRYPT on a digest algorithm will fail with UnsupportedRoleException.
session.createContext("SHA-256", zeroecho.core.KeyUsage.ENCRYPT,
zeroecho.core.NullKey.INSTANCE, null);
} catch (UnsupportedRoleException e) {
// Handle: algorithm does not implement the ENCRYPT role.
}
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new exception with a detail message. -
Method Summary
Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
UnsupportedRoleException
Creates a new exception with a detail message.- Parameters:
m- detail message describing the missing role for the algorithm
-