PKCS#11 ERROR CATALOGUE

Return codes and remediation

Stable error categories help applications distinguish a retryable session event from a policy denial or protected-device failure.

01

Return-code catalogue

Return codeTypical causeRemediationRetry
CKR_CRYPTOKI_NOT_INITIALIZEDC_Initialize missing/failedInitialize once under documented threading modelNo
CKR_SLOT_ID_INVALIDUnknown or stale slotRefresh slot list; check failover/token removalConditional
CKR_SESSION_HANDLE_INVALIDSession invalidatedOpen a new session and re-authenticateYes
CKR_USER_NOT_LOGGED_INOperation requires roleLogin under approved roleYes
CKR_PIN_LOCKEDRetry threshold exceededFollow controlled unlock/recoveryNo immediate retry
CKR_MECHANISM_INVALIDMechanism not in release listUse approved mechanism/profileNo
CKR_TEMPLATE_INCONSISTENTObject/key template violates policyCorrect attributes and policyNo automatic retry
CKR_KEY_HANDLE_INVALIDKey missing or handle staleRediscover object by CKA_IDConditional
CKR_DEVICE_ERRORBackend/provider failureCollect correlation; apply approved failoverConditional
CKR_BUFFER_TOO_SMALLCaller buffer insufficientResize using returned lengthYes

02

Audit correlation

Application logs should record the Cryptoki return code, operation, slot/token identifier, correlation ID and redacted backend reference. They must never log PINs, private-key material or unredacted SAD/credential data.