<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PKCS#11 return values and libraries · 808bits</title><link>https://808bits.com/pkcs11/</link><description>New and updated pages in the PKCS#11 reference: what a return value means, what causes it, and how each library differs.</description><language>en</language><atom:link href="https://808bits.com/pkcs11/index.xml" rel="self" type="application/rss+xml"/><item><title>CKR_USER_ALREADY_LOGGED_IN: login state is per token, not per session</title><link>https://808bits.com/pkcs11/errors/ckr-user-already-logged-in/</link><guid>https://808bits.com/pkcs11/errors/ckr-user-already-logged-in/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>A login on a token that already has that user logged in through another session. Two components sharing a token, or a retry after a login that succeeded.</description></item><item><title>CKR_TOKEN_NOT_RECOGNIZED: something is in the slot and it is not a token</title><link>https://808bits.com/pkcs11/errors/ckr-token-not-recognized/</link><guid>https://808bits.com/pkcs11/errors/ckr-token-not-recognized/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The library saw a device in the slot and has no driver for it, or the card answered in a way it could not parse. A smart card code far more than an HSM one.</description></item><item><title>CKR_TEMPLATE_INCOMPLETE: an attribute the class requires is missing</title><link>https://808bits.com/pkcs11/errors/ckr-template-incomplete/</link><guid>https://808bits.com/pkcs11/errors/ckr-template-incomplete/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The template does not fully specify the object. A missing CKA_CLASS or CKA_KEY_TYPE on create, a missing CKA_VALUE_LEN on generate, or a vendor rule.</description></item><item><title>CKR_PIN_LEN_RANGE: the length was checked before the PIN was</title><link>https://808bits.com/pkcs11/errors/ckr-pin-len-range/</link><guid>https://808bits.com/pkcs11/errors/ckr-pin-len-range/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The PIN is too short or too long for this token. The limits are in the token info and are applied before the PIN is looked at, so the PIN may also be wrong.</description></item><item><title>CKR_OPERATION_NOT_INITIALIZED: no Init call, or one that was cancelled</title><link>https://808bits.com/pkcs11/errors/ckr-operation-not-initialized/</link><guid>https://808bits.com/pkcs11/errors/ckr-operation-not-initialized/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>Sign, Update or Final with no matching Init on this session. An Init whose failure was ignored, an operation the library reset, or a session shared by threads.</description></item><item><title>CKR_OPERATION_ACTIVE: the session is still busy with the last one</title><link>https://808bits.com/pkcs11/errors/ckr-operation-active/</link><guid>https://808bits.com/pkcs11/errors/ckr-operation-active/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>An Init was called while the session already holds an operation of that kind. A multi-part operation that was never finished, or two threads on one session.</description></item><item><title>CKR_MECHANISM_PARAM_INVALID: the parameter struct, not the mechanism</title><link>https://808bits.com/pkcs11/errors/ckr-mechanism-param-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-mechanism-param-invalid/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The mechanism is known and its parameter is wrong. A missing IV, an OAEP hash pairing the token refuses, or a GCM tag length out of range.</description></item><item><title>CKR_KEY_TYPE_INCONSISTENT: right handle, wrong kind of key</title><link>https://808bits.com/pkcs11/errors/ckr-key-type-inconsistent/</link><guid>https://808bits.com/pkcs11/errors/ckr-key-type-inconsistent/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The key's type does not fit the mechanism. An EC key on an RSA mechanism, an Edwards key on ECDSA, or a find that returned the certificate instead.</description></item><item><title>CKR_HOST_MEMORY: an allocation failed, or the library said so</title><link>https://808bits.com/pkcs11/errors/ckr-host-memory/</link><guid>https://808bits.com/pkcs11/errors/ckr-host-memory/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The library could not allocate host memory. Rare as a real out-of-memory. More often a size computed from bad input, a leak, or a vendor error filed here.</description></item><item><title>CKR_FUNCTION_NOT_SUPPORTED: the entry point exists and refuses</title><link>https://808bits.com/pkcs11/errors/ckr-function-not-supported/</link><guid>https://808bits.com/pkcs11/errors/ckr-function-not-supported/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The library exports the function and will not perform it. Usually a v3.0 message call, a dual-function update, or a wrap on a token that never wraps.</description></item><item><title>CKR_ENCRYPTED_DATA_INVALID: the decrypt ran and the result failed a check</title><link>https://808bits.com/pkcs11/errors/ckr-encrypted-data-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-encrypted-data-invalid/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>Ciphertext the token could not decrypt: bad padding, the wrong key, a failed tag. Some libraries use it for every decrypt failure, against padding oracles.</description></item><item><title>CKR_DOMAIN_PARAMS_INVALID: the curve or the group, not the key</title><link>https://808bits.com/pkcs11/errors/ckr-domain-params-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-domain-params-invalid/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The domain parameters are not ones this token accepts. An EC curve the token lacks or in the wrong encoding, or DH parameters given where the token makes them.</description></item><item><title>CKR_DATA_LEN_RANGE: the length was wrong before the bytes were read</title><link>https://808bits.com/pkcs11/errors/ckr-data-len-range/</link><guid>https://808bits.com/pkcs11/errors/ckr-data-len-range/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>Input length the mechanism does not accept. A block cipher without padding, RSA input longer than the modulus, or a raw signing mechanism given a message.</description></item><item><title>CKR_DATA_INVALID: the input was read and rejected</title><link>https://808bits.com/pkcs11/errors/ckr-data-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-data-invalid/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>Right length, wrong content. A DigestInfo the token cannot parse, an EC point in the wrong encoding, or on a card, a status word with nowhere else to go.</description></item><item><title>CKR_CRYPTOKI_ALREADY_INITIALIZED: two callers, one library, one process</title><link>https://808bits.com/pkcs11/errors/ckr-cryptoki-already-initialized/</link><guid>https://808bits.com/pkcs11/errors/ckr-cryptoki-already-initialized/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>C_Initialize on a library that is already initialized in this process. Usually two components sharing one module, or a fork the library did not notice.</description></item><item><title>CKR_ATTRIBUTE_TYPE_INVALID: the attribute is not on this object</title><link>https://808bits.com/pkcs11/errors/ckr-attribute-type-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-attribute-type-invalid/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The object has no such attribute, or this library never stored it. Common when reading fields that only exist for another key type, and in object dumps.</description></item><item><title>CKR_ATTRIBUTE_SENSITIVE: the key is doing its job</title><link>https://808bits.com/pkcs11/errors/ckr-attribute-sensitive/</link><guid>https://808bits.com/pkcs11/errors/ckr-attribute-sensitive/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The attribute exists and the token will not disclose it. Private key material behind CKA_SENSITIVE or a false CKA_EXTRACTABLE. Not a fault.</description></item><item><title>CKR_ATTRIBUTE_READ_ONLY: set once, or set by the token</title><link>https://808bits.com/pkcs11/errors/ckr-attribute-read-only/</link><guid>https://808bits.com/pkcs11/errors/ckr-attribute-read-only/</guid><pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate><description>The attribute cannot be changed on this object, or cannot be supplied at creation because the token sets it. Computed flags, identity, or a locked object.</description></item><item><title>ProtectServer PKCS#11 error codes and mechanisms</title><link>https://808bits.com/pkcs11/libraries/thales-protectserver/</link><guid>https://808bits.com/pkcs11/libraries/thales-protectserver/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>The vendor-defined CKR constants Thales documents for ProtectToolkit-C, the mechanism list read off the 7.3 software token, and what changed since 5.9.</description></item><item><title>Luna PKCS#11 return codes: the vendor list, the native codes and what they map to</title><link>https://808bits.com/pkcs11/libraries/thales-luna/</link><guid>https://808bits.com/pkcs11/libraries/thales-luna/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>Luna's 127 vendor-defined return values, the 352 LUNA_RET codes its logs print with the CKR each becomes, and where its numbering meets ProtectServer's.</description></item><item><title>YubiHSM 2 PKCS#11 return values, read from yubihsm-shell</title><link>https://808bits.com/pkcs11/libraries/yubihsm2/</link><guid>https://808bits.com/pkcs11/libraries/yubihsm2/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>How Yubico's open source PKCS#11 module turns 32 device codes into CKR values, why the PIN starts with four hex digits, and what its vendor constants spell.</description></item><item><title>SoftHSMv2 return values, read from the code</title><link>https://808bits.com/pkcs11/libraries/softhsmv2/</link><guid>https://808bits.com/pkcs11/libraries/softhsmv2/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>Where SoftHSMv2 sends CKR_GENERAL_ERROR, why slot 0 disappears after the first token, and the 103 mechanisms a fresh build exposes.</description></item><item><title>OpenSC return values: how a card error becomes a CKR code</title><link>https://808bits.com/pkcs11/libraries/opensc/</link><guid>https://808bits.com/pkcs11/libraries/opensc/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>The one switch that turns 84 smart card errors into PKCS#11 return values, what falls through it, and what pkcs11-tool prints.</description></item><item><title>opencryptoki return values and the soft token's mechanism table</title><link>https://808bits.com/pkcs11/libraries/opencryptoki/</link><guid>https://808bits.com/pkcs11/libraries/opencryptoki/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>IBM's open source PKCS#11 stack: 473 sites that return CKR_FUNCTION_FAILED, a daemon the library cannot start without, and a 182-row software token table.</description></item><item><title>nShield PKCS#11: what the reference guide documents and what it leaves out</title><link>https://808bits.com/pkcs11/libraries/entrust-nshield/</link><guid>https://808bits.com/pkcs11/libraries/entrust-nshield/</guid><pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate><description>Entrust's nShield PKCS#11 library documented by name: 159 mechanisms, 20 of them vendor-defined, a slot model set by environment variables, and no published numbers.</description></item><item><title>CKR_USER_NOT_LOGGED_IN: the object is there and you cannot see it</title><link>https://808bits.com/pkcs11/errors/ckr-user-not-logged-in/</link><guid>https://808bits.com/pkcs11/errors/ckr-user-not-logged-in/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>A private object needs an authenticated session. Often a login that happened on a different session, or one that a token event quietly ended.</description></item><item><title>CKR_TOKEN_NOT_PRESENT: the slot is real and empty</title><link>https://808bits.com/pkcs11/errors/ckr-token-not-present/</link><guid>https://808bits.com/pkcs11/errors/ckr-token-not-present/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>Better news than it looks: the slot identifier was right. On a network HSM this usually means the client cannot reach the partition rather than a missing card.</description></item><item><title>CKR_TEMPLATE_INCONSISTENT: the attributes contradict each other</title><link>https://808bits.com/pkcs11/errors/ckr-template-inconsistent/</link><guid>https://808bits.com/pkcs11/errors/ckr-template-inconsistent/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>Each attribute is valid and together they cannot be satisfied. Usually a key asked to be both extractable and sensitive in a way the token refuses.</description></item><item><title>CKR_SLOT_ID_INVALID: slot numbers are not stable identifiers</title><link>https://808bits.com/pkcs11/errors/ckr-slot-id-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-slot-id-invalid/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The library does not have that slot. Usually a number hard-coded from a machine where the enumeration came out differently.</description></item><item><title>CKR_SESSION_READ_ONLY: writing through a read-only session</title><link>https://808bits.com/pkcs11/errors/ckr-session-read-only/</link><guid>https://808bits.com/pkcs11/errors/ckr-session-read-only/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The session cannot modify the token. Usually a missing read-write flag at open time, or a token object that did not need to be one.</description></item><item><title>CKR_SESSION_HANDLE_INVALID: where stale handles come from</title><link>https://808bits.com/pkcs11/errors/ckr-session-handle-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-session-handle-invalid/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The handle is not one this library recognises. Usually it outlived a fork, a call to C_Finalize, or the token it belonged to.</description></item><item><title>CKR_PIN_LOCKED: the counter reached zero and stayed there</title><link>https://808bits.com/pkcs11/errors/ckr-pin-locked/</link><guid>https://808bits.com/pkcs11/errors/ckr-pin-locked/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The token has locked the PIN after too many failed attempts. On most HSMs this is not something you can wait out, and on some it destroys the partition.</description></item><item><title>CKR_PIN_INCORRECT: the last warning before a lockout</title><link>https://808bits.com/pkcs11/errors/ckr-pin-incorrect/</link><guid>https://808bits.com/pkcs11/errors/ckr-pin-incorrect/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The credential was wrong. The important part is what your code does next, because automatic retries are how tokens get locked.</description></item><item><title>CKR_OBJECT_HANDLE_INVALID: a handle for an object you never got</title><link>https://808bits.com/pkcs11/errors/ckr-object-handle-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-object-handle-invalid/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>Often a search that returned nothing, whose empty result was used as if it were a key. Object handles are also scoped to the session that found them.</description></item><item><title>CKR_MECHANISM_INVALID: the library does not know that mechanism</title><link>https://808bits.com/pkcs11/errors/ckr-mechanism-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-mechanism-invalid/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The mechanism is unknown here, or not valid for the operation you used it in. Check the slot's own list rather than the header you compiled against.</description></item><item><title>CKR_KEY_FUNCTION_NOT_PERMITTED: the key was not made for this</title><link>https://808bits.com/pkcs11/errors/ckr-key-function-not-permitted/</link><guid>https://808bits.com/pkcs11/errors/ckr-key-function-not-permitted/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The key exists and works, and its attributes do not allow this operation. Decided when the key was created, and on most tokens not changeable afterwards.</description></item><item><title>CKR_GENERAL_ERROR: the one you cannot retry</title><link>https://808bits.com/pkcs11/errors/ckr-general-error/</link><guid>https://808bits.com/pkcs11/errors/ckr-general-error/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>Not a failed call but a broken library. The specification says nothing further will work, so retrying it is wasted effort.</description></item><item><title>CKR_FUNCTION_FAILED: the call failed, the library did not</title><link>https://808bits.com/pkcs11/errors/ckr-function-failed/</link><guid>https://808bits.com/pkcs11/errors/ckr-function-failed/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>A recoverable failure. The library is still usable and the token unchanged, so this one is worth investigating rather than restarting.</description></item><item><title>CKR_DEVICE_REMOVED: the token left in the middle of the call</title><link>https://808bits.com/pkcs11/errors/ckr-device-removed/</link><guid>https://808bits.com/pkcs11/errors/ckr-device-removed/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The library noticed the token disappear between one call and the next. Usually a pulled card, a USB power event, or a network HSM whose link reset under you.</description></item><item><title>CKR_DEVICE_MEMORY: the token has run out of room</title><link>https://808bits.com/pkcs11/errors/ckr-device-memory/</link><guid>https://808bits.com/pkcs11/errors/ckr-device-memory/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>Not a fault in your call. The token has no space left for what you asked it to store, and on most HSMs that means accumulated objects rather than a big key.</description></item><item><title>CKR_DEVICE_ERROR: what causes it and how to narrow it down</title><link>https://808bits.com/pkcs11/errors/ckr-device-error/</link><guid>https://808bits.com/pkcs11/errors/ckr-device-error/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The PKCS#11 catch-all for a token that has gone wrong. Usually a stale handle after a reset, a dead client link, or a mechanism the firmware refuses.</description></item><item><title>CKR_CRYPTOKI_NOT_INITIALIZED: nobody called C_Initialize, or somebody undid it</title><link>https://808bits.com/pkcs11/errors/ckr-cryptoki-not-initialized/</link><guid>https://808bits.com/pkcs11/errors/ckr-cryptoki-not-initialized/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The library has no state in this process. In a process where two components share one module, the interesting case is the one that undid it.</description></item><item><title>CKR_BUFFER_TOO_SMALL: the two-call idiom, and what breaks it</title><link>https://808bits.com/pkcs11/errors/ckr-buffer-too-small/</link><guid>https://808bits.com/pkcs11/errors/ckr-buffer-too-small/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>Almost always a length that was measured once and reused. The output size can change between the sizing call and the real one.</description></item><item><title>CKR_ATTRIBUTE_VALUE_INVALID: one attribute, wrong value</title><link>https://808bits.com/pkcs11/errors/ckr-attribute-value-invalid/</link><guid>https://808bits.com/pkcs11/errors/ckr-attribute-value-invalid/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>The token knows the attribute and rejects what you set it to. Usually a length, an encoding, or a boolean that arrived as the wrong width.</description></item><item><title>CKR_ARGUMENTS_BAD: the call is malformed before it reaches the token</title><link>https://808bits.com/pkcs11/errors/ckr-arguments-bad/</link><guid>https://808bits.com/pkcs11/errors/ckr-arguments-bad/</guid><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><description>A pointer or a count the library will not accept. Sometimes a genuine bug, and sometimes a mechanism that requires an argument to be null.</description></item></channel></rss>