1 #ifndef CryptokiEXCEPTION_H
2 #define CryptokiEXCEPTION_H
41 virtual const char*
what()
const throw()
45 case 666:
return "Precondition failed";
46 case 777:
return "Object is not initialized";
47 case CKR_OK:
return "CKR_OK";
48 case CKR_CANCEL:
return "CKR_CANCEL";
49 case CKR_HOST_MEMORY:
return "CKR_HOST_MEMORY";
50 case CKR_SLOT_ID_INVALID:
return "CKR_SLOT_ID_INVALID";
51 case CKR_GENERAL_ERROR:
return "CKR_GENERAL_ERROR";
52 case CKR_FUNCTION_FAILED:
return "CKR_FUNCTION_FAILED";
53 case CKR_ARGUMENTS_BAD:
return "CKR_ARGUMENTS_BAD";
54 case CKR_NO_EVENT:
return "CKR_NO_EVENT";
55 case CKR_NEED_TO_CREATE_THREADS:
return "CKR_NEED_TO_CREATE_THREADS";
56 case CKR_CANT_LOCK:
return "CKR_CANT_LOCK";
57 case CKR_ATTRIBUTE_READ_ONLY:
return "CKR_ATTRIBUTE_READ_ONLY";
58 case CKR_ATTRIBUTE_SENSITIVE:
return "CKR_ATTRIBUTE_SENSITIVE";
59 case CKR_ATTRIBUTE_TYPE_INVALID:
return "CKR_ATTRIBUTE_TYPE_INVALID";
60 case CKR_ATTRIBUTE_VALUE_INVALID:
return "CKR_ATTRIBUTE_VALUE_INVALID";
61 case CKR_DATA_INVALID:
return "CKR_DATA_INVALID";
62 case CKR_DATA_LEN_RANGE:
return "CKR_DATA_LEN_RANGE";
63 case CKR_DEVICE_ERROR:
return "CKR_DEVICE_ERROR";
64 case CKR_DEVICE_MEMORY:
return "CKR_DEVICE_MEMORY";
65 case CKR_DEVICE_REMOVED:
return "CKR_DEVICE_REMOVED";
66 case CKR_ENCRYPTED_DATA_INVALID:
return "CKR_ENCRYPTED_DATA_INVALID";
67 case CKR_ENCRYPTED_DATA_LEN_RANGE:
return "CKR_ENCRYPTED_DATA_LEN_RANGE";
68 case CKR_FUNCTION_CANCELED:
return "CKR_FUNCTION_CANCELED";
69 case CKR_FUNCTION_NOT_PARALLEL:
return "CKR_FUNCTION_NOT_PARALLEL";
70 case CKR_FUNCTION_NOT_SUPPORTED:
return "CKR_FUNCTION_NOT_SUPPORTED";
71 case CKR_KEY_HANDLE_INVALID:
return "CKR_KEY_HANDLE_INVALID";
72 case CKR_KEY_SIZE_RANGE:
return "CKR_KEY_SIZE_RANGE";
73 case CKR_KEY_TYPE_INCONSISTENT:
return "CKR_KEY_TYPE_INCONSISTENT";
74 case CKR_KEY_NOT_NEEDED:
return "CKR_KEY_NOT_NEEDED";
75 case CKR_KEY_CHANGED:
return "CKR_KEY_CHANGED";
76 case CKR_KEY_NEEDED:
return "CKR_KEY_NEEDED";
77 case CKR_KEY_INDIGESTIBLE:
return "CKR_KEY_INDIGESTIBLE";
78 case CKR_KEY_FUNCTION_NOT_PERMITTED:
return "CKR_KEY_FUNCTION_NOT_PERMITTED";
79 case CKR_KEY_NOT_WRAPPABLE:
return "CKR_KEY_NOT_WRAPPABLE";
80 case CKR_KEY_UNEXTRACTABLE:
return "CKR_KEY_UNEXTRACTABLE";
81 case CKR_MECHANISM_INVALID:
return "CKR_MECHANISM_INVALID";
82 case CKR_MECHANISM_PARAM_INVALID:
return "CKR_MECHANISM_PARAM_INVALID";
83 case CKR_OBJECT_HANDLE_INVALID:
return "CKR_OBJECT_HANDLE_INVALID";
84 case CKR_OPERATION_ACTIVE:
return "CKR_OPERATION_ACTIVE";
85 case CKR_OPERATION_NOT_INITIALIZED:
return "CKR_OPERATION_NOT_INITIALIZED";
86 case CKR_PIN_INCORRECT:
return "CKR_PIN_INCORRECT";
87 case CKR_PIN_INVALID:
return "CKR_PIN_INVALID";
88 case CKR_PIN_LEN_RANGE:
return "CKR_PIN_LEN_RANGE";
89 case CKR_PIN_EXPIRED:
return "CKR_PIN_EXPIRED";
90 case CKR_PIN_LOCKED:
return "CKR_PIN_LOCKED";
91 case CKR_SESSION_CLOSED:
return "CKR_SESSION_CLOSED";
92 case CKR_SESSION_COUNT:
return "CKR_SESSION_COUNT";
93 case CKR_SESSION_HANDLE_INVALID:
return "CKR_SESSION_HANDLE_INVALID";
94 case CKR_SESSION_PARALLEL_NOT_SUPPORTED:
return "CKR_SESSION_PARALLEL_NOT_SUPPORTED";
95 case CKR_SESSION_READ_ONLY:
return "CKR_SESSION_READ_ONLY";
96 case CKR_SESSION_EXISTS:
return "CKR_SESSION_EXISTS";
97 case CKR_SESSION_READ_ONLY_EXISTS:
return "CKR_SESSION_READ_ONLY_EXISTS";
98 case CKR_SESSION_READ_WRITE_SO_EXISTS:
return "CKR_SESSION_READ_WRITE_SO_EXISTS";
99 case CKR_SIGNATURE_INVALID:
return "CKR_SIGNATURE_INVALID";
100 case CKR_SIGNATURE_LEN_RANGE:
return "CKR_SIGNATURE_LEN_RANGE";
101 case CKR_TEMPLATE_INCOMPLETE:
return "CKR_TEMPLATE_INCOMPLETE";
102 case CKR_TEMPLATE_INCONSISTENT:
return "CKR_TEMPLATE_INCONSISTENT";
103 case CKR_TOKEN_NOT_PRESENT:
return "CKR_TOKEN_NOT_PRESENT";
104 case CKR_TOKEN_NOT_RECOGNIZED:
return "CKR_TOKEN_NOT_RECOGNIZED";
105 case CKR_TOKEN_WRITE_PROTECTED:
return "CKR_TOKEN_WRITE_PROTECTED";
106 case CKR_UNWRAPPING_KEY_HANDLE_INVALID:
return "CKR_UNWRAPPING_KEY_HANDLE_INVALID";
107 case CKR_UNWRAPPING_KEY_SIZE_RANGE:
return "CKR_UNWRAPPING_KEY_SIZE_RANGE";
108 case CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT:
return "CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT";
109 case CKR_USER_ALREADY_LOGGED_IN:
return "CKR_USER_ALREADY_LOGGED_IN";
110 case CKR_USER_NOT_LOGGED_IN:
return "CKR_USER_NOT_LOGGED_IN";
111 case CKR_USER_PIN_NOT_INITIALIZED:
return "CKR_USER_PIN_NOT_INITIALIZED";
112 case CKR_USER_TYPE_INVALID:
return "CKR_USER_TYPE_INVALID";
113 case CKR_USER_ANOTHER_ALREADY_LOGGED_IN:
return "CKR_USER_ANOTHER_ALREADY_LOGGED_IN";
114 case CKR_USER_TOO_MANY_TYPES:
return "CKR_USER_TOO_MANY_TYPES";
115 case CKR_WRAPPED_KEY_INVALID:
return "CKR_WRAPPED_KEY_INVALID";
116 case CKR_WRAPPED_KEY_LEN_RANGE:
return "CKR_WRAPPED_KEY_LEN_RANGE";
117 case CKR_WRAPPING_KEY_HANDLE_INVALID:
return "CKR_WRAPPING_KEY_HANDLE_INVALID";
118 case CKR_WRAPPING_KEY_SIZE_RANGE:
return "CKR_WRAPPING_KEY_SIZE_RANGE";
119 case CKR_WRAPPING_KEY_TYPE_INCONSISTENT:
return "CKR_WRAPPING_KEY_TYPE_INCONSISTENT";
120 case CKR_RANDOM_SEED_NOT_SUPPORTED:
return "CKR_RANDOM_SEED_NOT_SUPPORTED";
121 case CKR_RANDOM_NO_RNG:
return "CKR_RANDOM_NO_RNG";
122 case CKR_DOMAIN_PARAMS_INVALID:
return "CKR_DOMAIN_PARAMS_INVALID";
123 case CKR_BUFFER_TOO_SMALL:
return "CKR_BUFFER_TOO_SMALL";
124 case CKR_SAVED_STATE_INVALID:
return "CKR_SAVED_STATE_INVALID";
125 case CKR_INFORMATION_SENSITIVE:
return "CKR_INFORMATION_SENSITIVE";
126 case CKR_STATE_UNSAVEABLE:
return "CKR_STATE_UNSAVEABLE";
127 case CKR_CRYPTOKI_NOT_INITIALIZED:
return "CKR_CRYPTOKI_NOT_INITIALIZED";
128 case CKR_CRYPTOKI_ALREADY_INITIALIZED:
return "CKR_CRYPTOKI_ALREADY_INITIALIZED";
129 case CKR_MUTEX_BAD:
return "CKR_MUTEX_BAD";
130 case CKR_MUTEX_NOT_LOCKED:
return "CKR_MUTEX_NOT_LOCKED";
131 case CKR_FUNCTION_REJECTED:
return "CKR_FUNCTION_REJECTED";
132 case CKR_VENDOR_DEFINED:
return "CKR_VENDOR_DEFINED";
133 default:
return "Unknown error";
CryptokiException(CK_RV erc=CKR_GENERAL_ERROR)
Definition: CryptokiException.h:24
virtual ~CryptokiException()
Definition: CryptokiException.h:36
virtual const char * where() const
Definition: CryptokiException.h:140
CryptokiException(const char *where, CK_RV erc=CKR_GENERAL_ERROR)
Definition: CryptokiException.h:31
virtual const char * what() const
Definition: CryptokiException.h:41
const char * _where
Definition: CryptokiException.h:149
virtual CK_RV getErrorCode()
Definition: CryptokiException.h:146
CK_RV _erc
Definition: CryptokiException.h:146
General Cryptoki API Exception
Definition: CryptokiException.h:17