wolfSSL PKCS#11
Repo wolfSSL/wolfPKCS11, read from GitHub 1 min ago. wolfSSL has not joined Take My Repo.
wolfSSL/wolfPKCS11 is a public repo on GitHub by wolfSSL. wolfSSL PKCS#11. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It is written mainly in C, has 25 stars and last changed on 2026-11-23. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-23.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
PKCS#11 library that implements cryptographic algorithms using wolfSSL.
Build wolfSSL:
git clone https://github.com/wolfSSL/wolfssl.git cd wolfssl ./autogen.sh ./configure --enable-aescfb --enable-rsapss --enable-keygen --enable-pwdbased --enable-scrypt C_EXTRA_FLAGS="-DWOLFSSL_PUBLIC_MP -DWC_RSA_DIRECT -DHAVE_AES_ECB -DHAVE_AES_KEYWRAP" make make check sudo make install sudo ldconfig
autogen.sh requires: automake and libtool: sudo apt-get install automake libtool
Build wolfPKCS11:
git clone https://github.com/wolfSSL/wolfPKCS11.git
cd wolfPKCS11
./autogen.sh
./configure
make
make checkEnables using a TPM for cryptography and keystore.
Tested using ./configure --enable-singlethreaded --enable-wolftpm --disable-dh CFLAGS="-DWOLFPKCS11_TPM_STORE" && make.
Note: The TPM does not support DH, so only RSA and ECC are supported.
To have AES-CCM support in wolfPKCS11, configure both wolfSSL and wolfPKCS11
with the addition of --enable-aesccm.
To have AES-ECB support in wolfPKCS11, configure wolfSSL with the C macro
HAVE_AES_ECB defined. For example, CFLAGS="-DHAVE_AES_ECB". Then
enable it in wolfPKCS11 with the addition of --enable-aesecb during the
configure step.
WARNING: ECB (Electronic Code Book) mode AES is generally considered to be insecure. Please consider using a different mode of AES.
To have ML-DSA support in wolfPKCS11, configure wolfSSL with ML-DSA support
enabled, either by adding --enable-mldsa to ./configure or by setting
WOLFSSL_MLDSA to yes in CMake. wolfPKCS11 uses the canonical
wc_MlDsaKey API and WC_MLDSA_* sizing macros (FIPS 204 spelling) and
therefore requires a wolfSSL build that incorporate these.
As ML-DSA is a feature of PKCS#11 version 3.2, support for that is required,
too. Hence, to enable all in wolfPKCS11, add --enable-pkcs11v32 --enable-mldsa
during the configure step.
To have ML-KEM support in wolfPKCS11, configure wolfSSL with ML-KEM (FIPS 203)
support enabled, either by adding --enable-mlkem to ./configure or by
setting WOLFPKCS11_MLKEM to yes in CMake.
As ML-KEM is a feature of PKCS#11 version 3.2, support for that is required,
too. Hence, to enable all in wolfPKCS11, add --enable-pkcs11v32 --enable-mlkem
during the configure step.
By default libwolfpkcs11 loads libwolfssl at run time. To ship a single library instead, build wolfSSL as a static library with position independent code and link it into libwolfpkcs11:
cd wolfssl ./configure --enable-static --disable-shared --with-pic --enable-cryptonly \ --enable-aescfb --enable-rsapss --enable-keygen --enable-pwdbased \ --enable-scrypt \ C_EXTRA_FLAGS="-DWOLFSSL_PUBLIC_MP -DWC_RSA_DIRECT -DHAVE_AES_ECB -DHAVE_AES_KEYWRAP" make sudo make install cd ../wolfPKCS11 ./configure --with-static-wolfssl=/usr/local/lib/libwolfssl.a make
The wolfSSL symbols stay hidden inside libwolfpkcs11, so an application using
its own wolfSSL, even with a different configuration, can load the module with
dlopen() or wc_Pkcs11_Initialize(). Settings the application makes on its
own wolfSSL, such as wolfSSL_SetAllocators(), do not reach the module. A
wolfSSL update requires rebuilding libwolfpkcs11. This option needs an ELF
linker (GNU ld, gold or lld) and cannot be combined with wolfTPM support. If
the static wolfSSL needs other libraries, such as zlib, pass them in LIBS:
the ones pkg-config --static --libs wolfssl lists after -lwolfssl.
With CMake, build wolfSSL with -DBUILD_SHARED_LIBS=OFF and
-DCMAKE_POSITION_INDEPENDENT_CODE=ON, then configure wolfPKCS11 with
-DWOLFPKCS11_STATIC_WOLFSSL=yes.
Use WOLFPKCS11_TPM_STORE storing objects in TPM NV.
Disables storage of tokens.
Enables debugging printf's for store.
Removes default implementation of storage functions. See wolfpkcs11/store.h for prototypes of functions to implement.
With WOLFPKCS11_CUSTOM_STORE, records that were written are closed with
wolfPKCS11_Store_CloseCommit() instead of wolfPKCS11_Store_Close(), so the
custom store must implement it too (wolfPKCS11_Store_Close() still closes
records that were read). It returns non-zero when the record did not commit,
for example when a flash write failed. wolfPKCS11 then fails the operation and
writes all records of the token on its next store. Without this define, the
custom store cannot report a failed commit.
Sets the private key's label against the public key when generating key pairs.
Restores the pre-fix behavior where C_GetAttributeValue(CKA_COPYABLE) always
reports CK_FALSE, regardless of whether the attribute was explicitly set.
The default (without this flag) reports CK_TRUE for new objects and reflects
the stored value for objects whose CKA_COPYABLE was explicitly set, matching
the PKCS#11 specification. Define this only if your application or stored
tokens depend on the old read-back behavior. The C_CopyObject enforcement
consults the stored copyable flag directly via WP11_Object_IsCopyable, so
this macro does not change which objects can be copied; objects created with
CKA_COPYABLE=CK_TRUE (the default) remain copyable, and objects created
with CKA_COPYABLE=CK_FALSE are still rejected by C_CopyObject with
CKR_ACTION_PROHIBITED.
Allows C_DeriveKey to create sensitive or non-extractable keys shorter than
16 bytes from protected keys, and CKM_CONCATENATE_* results that end inside
a protected key, as PKCS#11 permits. Such keys let a caller recover a secret
one byte at a time, so define this only where strict specification
compliance is required. --disable-derive-length-guard and the CMake option
WOLFPKCS11_DERIVE_LENGTH_GUARD=no define it.
Makes C_GetOperationState return CKR_STATE_UNSAVEABLE for every active
operation and C_SetOperationState return CKR_SAVED_STATE_INVALID for
every saved state. It is defined automatically when wolfSSL does not keep the
whole hash state in the software digest, buffer and length fields: hash
hardware ports, builds with WOLFSSL_NO_HASH_RAW and builds with
WOLFSSL_HASH_KEEP. Define it for a port that is not detected and either
fails to build the digest state code or keeps the hash state somewhere else,
such as in a hardware engine.
Several pre-existing gaps were closed; applications upgrading from earlier versions may need to update templates or error-handling:
C_DeriveKey now enforces CKA_DERIVE on the base key. Keys that do not
set CKA_DERIVE=CK_TRUE at creation are rejected with
CKR_KEY_FUNCTION_NOT_PERMITTED. RSA, EC, and ML-DSA private keys default
CKA_DERIVE to CK_FALSE, so applications doing ECDH or other key
derivation must now set CKA_DERIVE=CK_TRUE explicitly in the key
template. The second key of CKM_CONCATENATE_BASE_AND_KEY and the
CKF_HKDF_SALT_KEY salt key of CKM_HKDF_DERIVE and CKM_HKDF_DATA need
CKA_DERIVE=CK_TRUE too. The check is skipped on --enable-nss builds
because NSS generates ephemeral ECDHE keys without setting CKA_DERIVE
and relies on the historic permissive behavior; non-NSS builds get the
spec-compliant enforcement.C_DeriveKey returns CKR_TEMPLATE_INCONSISTENT and creates no key when
the template sets CKA_SENSITIVE=CK_FALSE under a sensitive base key, or
CKA_EXTRACTABLE=CK_TRUE under a non-extractable one. The second key of
CKM_CONCATENATE_BASE_AND_KEY counts as a base key too. Previously the key
was created with the base key's values in place of the template's, and
CKM_TLS12_KEY_AND_MAC_DERIVE used the template's values. A template that
leaves these attributes out gets a sensitive key from a sensitive base key
and a non-extractable key from a non-extractable one; for
CKM_TLS12_KEY_AND_MAC_DERIVE this is new, as its keys used the defaults
before. An HKDF salt key counts as a base key too, as the derived value
depends on it: its CKA_SENSITIVE, CKA_EXTRACTABLE,
CKA_ALWAYS_SENSITIVE, CKA_NEVER_EXTRACTABLE and
CKA_WRAP_WITH_TRUSTED now carry over to the derived key as those of the
second concatenation key do. A CKO_DATA base object is readable, so a
key derived from one takes only the salt key's protection. NSS builds and
builds with WOLFPKCS11_LEGACY_DERIVE_NO_INHERIT are unchanged.C_DeriveKey returns CKR_ATTRIBUTE_VALUE_INVALID and creates no key when
a key derived from a sensitive or non-extractable key would be shorter than
16 bytes. A CKM_TLS12_KEY_AND_MAC_DERIVE MAC or key size that short
returns CKR_MECHANISM_PARAM_INVALID. The CKM_CONCATENATE_* mechanisms
refuse a CKA_VALUE_LEN that ends inside a sensitive or non-extractable
input key. PKCS#11 allows both, but a caller could then recover the secret
a byte at a time, for example from CKA_CHECK_VALUE. Only the
concatenation check applies to NSS builds and builds with
WOLFPKCS11_LEGACY_DERIVE_NO_INHERIT, where other derived keys can be made
readable anyway. 16 bytes of a protected derived secret stay unknown, but
with CKM_CONCATENATE_* enabled a caller can still find its other bytes
by comparing a longer derived key with a shorter one plus a guessed byte.
Build with --disable-concatenate where that matters. See
WOLFPKCS11_NO_DERIVE_LENGTH_GUARD to restore the specification behavior.C_DeriveKey returns CKR_TEMPLATE_INCONSISTENT for a template with
CKA_VALUE, which PKCS#11 does not allow for a derived key. Its length was
used to truncate the derived value.C_CopyObject enforces CKA_COPYABLE (returns CKR_ACTION_PROHIBITED
on CK_FALSE).C_DestroyObject enforces CKA_DESTROYABLE (returns
CKR_ACTION_PROHIBITED on CK_FALSE).C_EncapsulateKey/C_DecapsulateKey enforce CKA_ENCAPSULATE /
CKA_DECAPSULATE and return CKR_KEY_FUNCTION_NOT_PERMITTED when the
flag is CK_FALSE.C_SetAttributeValue rejects flipping CKA_COPYABLE or
CKA_DESTROYABLE from CK_FALSE back to CK_TRUE, returning
CKR_ATTRIBUTE_READ_ONLY per spec section 4.4.1.C_Login(CKU_SO, ...) against a token whose SO PIN has not been set
now returns CKR_USER_PIN_NOT_INITIALIZED regardless of the PIN
length, closing an empty-PIN bypass where the zero-length constant
compare against the unset stored PIN returned equal. NSS builds
(--enable-nss) keep the empty-PIN probe accepted on uninitialized
tokens because PK11_InitPin bootstraps an empty-password NSS
database that way; non-empty PINs are still rejected.--enable-nss builds WP11_MIN_PIN_LEN defaults to 0, permitting a
zero-length user PIN. An empty user PIN intentionally disables PIN-based
authentication: C_GetTokenInfo clears CKF_LOGIN_REQUIRED and all
private/token objects are decoded and accessible at token load without
C_Login. This is required for NSS tools (certutil, PK11_InitPin) that
bootstrap empty-password databases. Integrators who require an enforced
minimum can opt in at build time with C_EXTRA_FLAGS="-DWP11_MIN_PIN_LEN=N"
(N>0); non-NSS builds already default to 4.C_GetAttributeValue returns CKR_ATTRIBUTE_TYPE_INVALID when a template
names an attribute the object does not have or that is not supported, and
keeps processing the rest of the template. Previously such attributes
returned CK_UNAVAILABLE_INFORMATION as the function's return value, and
CKA_CERTIFICATE_TYPE on a non-certificate object failed the whole call
with CKR_FUNCTION_FAILED. In both cases the attribute's ulValueLen is
set to CK_UNAVAILABLE_INFORMATION.CKA_KEY_TYPE is only an attribute of key objects. Reading it from a
certificate or data object now returns CKR_ATTRIBUTE_TYPE_INVALID (an
X.509 certificate previously read back as CKK_RSA), C_FindObjects with
CKA_KEY_TYPE in the template no longer matches non-key objects, and
C_SetAttributeValue of CKA_KEY_TYPE on them returns
CKR_ATTRIBUTE_TYPE_INVALID.CKR_KEY_HANDLE_INVALID
instead of CKR_OBJECT_HANDLE_INVALID from the operation init functions,
C_DigestKey, C_DeriveKey, C_EncapsulateKey, C_DecapsulateKey and
for the key to wrap in C_WrapKey.CK_ULONG, CK_BBOOL or CK_DATE attribute of the wrong length in a
template returns CKR_ATTRIBUTE_VALUE_INVALID instead of
CKR_BUFFER_TOO_SMALL. When C_GetAttributeValue returns
CKR_BUFFER_TOO_SMALL, the short attribute's ulValueLen is
CK_UNAVAILABLE_INFORMATION. Private components of RSA and EC public keys
return CKR_ATTRIBUTE_TYPE_INVALID instead of CKR_ATTRIBUTE_SENSITIVE.CKM_RSA_PKCS_KEY_PAIR_GEN reports wolfSSL's RSA_MIN_SIZE and
RSA_MAX_SIZE as its key sizes (2048 to 4096 bits by default) and refuses
other sizes with CKR_ATTRIBUTE_VALUE_INVALID. Outside the NSS build, an
AES CKA_VALUE that is not 16, 24 or 32 bytes is refused with
CKR_ATTRIBUTE_VALUE_INVALID. An RSA public exponent that cannot be used
returns CKR_TEMPLATE_INCONSISTENT.CKA_EC_PARAMS, CKA_EC_POINT or EC CKA_VALUE returns
CKR_ATTRIBUTE_VALUE_INVALID instead of CKR_FUNCTION_FAILED, and an
unsupported curve returns CKR_CURVE_NOT_SUPPORTED. An ECDH peer value
that is not a point on the curve returns CKR_MECHANISM_PARAM_INVALID.C_UnwrapKey returns CKR_TEMPLATE_INCONSISTENT instead of
CKR_KEY_NOT_WRAPPABLE for a key type it cannot unwrap, and
CKR_WRAPPED_KEY_INVALID or CKR_WRAPPED_KEY_LEN_RANGE for an unwrapped
value the key cannot take.CKM_HKDF_DERIVE and CKM_HKDF_DATA report the largest secret key the
token can store (512 bytes by default) as their maximum, instead of 16320.CKA_WRAP_TEMPLATE, CKA_UNWRAP_TEMPLATE and CKA_DERIVE_TEMPLATE are
supported. They are set when a key is created and are read-only after that.
They cannot hold key material such as CKA_VALUE, and a key without a
template reads back an empty array.C_WrapKey refuses a key that does not match the wrapping key's
CKA_WRAP_TEMPLATE with CKR_KEY_HANDLE_INVALID. C_UnwrapKey and
C_DeriveKey add the unwrapping or base key's template to the new key's
template and return CKR_TEMPLATE_INCONSISTENT when the two conflict. A
derive also adds the template of the other key of
CKM_CONCATENATE_BASE_AND_KEY and of an HKDF salt key. C_UnwrapKey also
returns CKR_TEMPLATE_INCONSISTENT when the unwrapping key's template sets a
CKA_VALUE_LEN other than the unwrapped key's length, and a TLS 1.2 key and
MAC derive when the base key's template sets one longer than the keys.CKA_WRAP_TEMPLATE of a public key when
it rewrites the object.CKR_TOKEN_WRITE_PROTECTED, C_GetTokenInfo reports CKF_WRITE_PROTECTED
and C_Finalize fails. Calls that only read the token use it as loaded.
Older wolfPKCS11 versions do not take part in this, so processes sharing a
token directory should use the same version, and the wp11_txn_* files in
that directory must not be removed while they run.--with-pbkdf2-iterations or PBKDF2_ITERATIONS. Before, they ignored it
and used 600000. A FIPS build that sets another count cannot log in to a
token an older build stored, so keep 600000 until the token is initialized
again.One known gap remains: CKM_RSA_PKCS_OAEP does not support an empty message,
although PKCS#11 and RFC 8017 allow one. wolfCrypt rejects it on both sides, so
C_Encrypt of 0 bytes returns CKR_FUNCTION_FAILED and C_Decrypt of a valid
OAEP ciphertext of an empty message returns CKR_ENCRYPTED_DATA_INVALID.
Support has been added to use the MAXQ10xx hardware for cryptographic operations and storage of certificate.
Before usage:
examples/maxq10xx_init.sh to ensure it is pointing to the correct
location.examples/maxq10xx_init.sh to ensure it is properly initialized.NOTE: In the code, we have embedded a test key. This must be changed for production environments!! Please contact Analog Devices to learn how to obtain and use a production key.
wolfPKCS11 uses out-of-source builds. It also requires CMake 3.16 or later (3.22+ recommended).
wolfPKCS11 depends on wolfSSL. Build and install wolfSSL with CMake first:
git clone https://github.com/wolfSSL/wolfssl.git cd wolfssl mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=/usr/local \ -DWOLFSSL_AES=yes -DWOLFSSL_AESCBC=yes -DWOLFSSL_AESCCM=yes \ -DWOLFSSL_AESCFB=yes -DWOLFSSL_AESECB=yes -DWOLFSSL_AESCTR=yes \ -DWOLFSSL_AESGCM=yes -DWOLFSSL_AESKEYWRAP=yes -DWOLFSSL_AESOFB=yes \ -DWOLFSSL_AESCTS=yes -DWOLFSSL_DH=yes -DWOLFSSL_DH_DEFAULT_PARAMS=yes \ -DWOLFSSL_ECC=yes -DWOLFSSL_HKDF=yes -DWOLFSSL_KEYGEN=yes \ -DWOLFSSL_MD5=yes -DWOLFSSL_RSA=yes -DWOLFSSL_RSA_PSS=yes \ -DWOLFSSL_SHA=yes -DWOLFSSL_SHA224=yes -DWOLFSSL_SHA3=yes \ -DWOLFSSL_SHA384=yes -DWOLFSSL_SHA512=yes \ -DWOLFSSL_SP_MATH_ALL=yes -DWOLFSSL_PUBLIC_MP=yes \ -DWOLFSSL_WC_RSA_DIRECT=yes -DWOLFSSL_DILITHIUM=yes \ -DCMAKE_BUILD_TYPE=Release \ .. cmake --build . sudo cmake --install .
To install to a non-system directory instead, set
-DCMAKE_INSTALL_PREFIX=<path> and pass the same path as
-DCMAKE_PREFIX_PATH=<path> when building wolfPKCS11 below.
cd wolfPKCS11 mkdir build && cd build cmake .. cmake --build . ctest
To enable additional features, pass options during the configure step:
cmake -DWOLFPKCS11_DEBUG=yes \
-DWOLFPKCS11_AESKEYWRAP=yes \
-DWOLFPKCS11_AESCTR=yes \
-DWOLFPKCS11_AESCCM=yes \
-DWOLFPKCS11_AESECB=yes \
-DWOLFPKCS11_AESCTS=yes \
-DWOLFPKCS11_AESCMAC=yes \
-DWOLFPKCS11_PBKDF2=yes \
-DWOLFPKCS11_PKCS11_V3_2=yes \
-DWOLFPKCS11_MLDSA=yes \
..
cmake --build .
ctestIf wolfSSL was installed to a non-system prefix, point CMake to it:
cmake -DCMAKE_PREFIX_PATH=/path/to/wolfssl/install ..
| Option | Default | Description |
|---|---|---|
WOLFPKCS11_DEBUG |
no |
Enable debug logging |
WOLFPKCS11_SINGLE_THREADED |
no |
Single-threaded mode |
WOLFPKCS11_RSA |
yes |
RSA support |
WOLFPKCS11_OAEP |
yes |
RSA OAEP support |
WOLFPKCS11_RSA_PSS |
yes |
RSA-PSS support |
WOLFPKCS11_KEYGEN |
yes |
Key generation support |
WOLFPKCS11_ECC |
yes |
ECC support |
WOLFPKCS11_DH |
yes |
DH support |
WOLFPKCS11_AES |
yes |
AES support |
WOLFPKCS11_AESCBC |
yes |
AES-CBC support |
WOLFPKCS11_AESGCM |
yes |
AES-GCM support |
WOLFPKCS11_AESKEYWRAP |
no |
AES Key Wrap support |
WOLFPKCS11_AESCTR |
no |
AES-CTR support |
WOLFPKCS11_AESCCM |
no |
AES-CCM support |
WOLFPKCS11_AESECB |
no |
AES-ECB support |
WOLFPKCS11_AESCTS |
no |
AES-CTS support |
WOLFPKCS11_AESCMAC |
no |
AES-CMAC support |
WOLFPKCS11_HMAC |
yes |
HMAC support |
WOLFPKCS11_HKDF |
yes |
HKDF support |
WOLFPKCS11_CONCATENATE |
yes |
CKM_CONCATENATE_* key derivation |
WOLFPKCS11_DERIVE_LENGTH_GUARD |
yes |
Refuse protected derived keys shorter than 16 bytes |
WOLFPKCS11_PBKDF2 |
no |
PBKDF2 for PIN hashing |
PBKDF2_ITERATIONS |
600000 |
PBKDF2 iteration count (used when WOLFPKCS11_PBKDF2=yes and in FIPS builds) |
WOLFPKCS11_MD5 |
yes |
MD5 support |
WOLFPKCS11_SHA1 |
yes |
SHA-1 support |
WOLFPKCS11_SHA224 |
yes |
SHA-224 support |
WOLFPKCS11_SHA256 |
yes |
SHA-256 support |
WOLFPKCS11_SHA384 |
yes |
SHA-384 support |
WOLFPKCS11_SHA512 |
yes |
SHA-512 support |
WOLFPKCS11_SHA3 |
yes |
SHA-3 support |
WOLFPKCS11_TPM |
no |
wolfTPM keystore support |
WOLFPKCS11_NSS |
no |
NSS-specific modifications |
WOLFPKCS11_PKCS11_V3_0 |
yes |
PKCS#11 v3.0 support |
WOLFPKCS11_PKCS11_V3_2 |
no |
PKCS#11 v3.2 support |
WOLFPKCS11_MLDSA |
no |
ML-DSA support |
WOLFPKCS11_MLKEM |
no |
ML-KEM support |
WOLFPKCS11_EXAMPLES |
yes |
Build examples |
WOLFPKCS11_TESTS |
yes |
Build and register tests |
WOLFPKCS11_COVERAGE |
no |
Code coverage support |
WOLFPKCS11_INSTALL |
yes |
Create install targets |
WOLFPKCS11_DEFAULT_TOKEN_PATH |
"" |
Default token storage path compiled into library |
WOLFPKCS11_BUILD_OUT_OF_TREE |
yes |
Generate build artifacts outside source tree |
BUILD_SHARED_LIBS |
ON |
Build shared (ON) or static (OFF) library |
WOLFPKCS11_STATIC_WOLFSSL |
no |
Link a static wolfSSL into the shared library and hide its symbols |
Two related preprocessor settings are available when wolfCrypt callbacks are
used. WOLFPKCS11_DEFAULT_DEVID sets the device ID assigned to a slot before
an object-specific device ID is selected; it cannot be combined with the TPM,
MAXQ10XX or STM32U5 DHUK backends, which set the slot's device ID themselves.
Key operations use the object's device ID, which is the slot's unless the
object sets CKA_WOLFSSL_DEVID. HKDF uses the base key's device ID on
wolfSSL 5.7.0 or later, except FIPS builds before v7 and self-test builds.
Those builds pass no device ID, which selects software unless a
WOLF_CRYPTO_CB_FIND finder remaps it. PBKDF2 key generation has no base key,
so it uses the slot's device ID. Device callbacks must complete synchronously;
an operation whose callback returns WC_PENDING_E fails.
WOLFPKCS11_PIN_KDF_SOFTWARE keeps PBKDF2 PIN hashing in software while key
operations continue to use the device. This is useful when a device callback
is intended for key operations but is too expensive for each PBKDF2
iteration. With crypto callbacks enabled it needs wolfSSL 5.7.4 or later,
because older SHA-256 init replaced an invalid device ID with the default
registered device. It cannot be combined with WOLF_CRYPTO_CB_FIND, because
a finder can remap an invalid device ID back to a registered callback. The
device must be registered with
the same wolfSSL instance that wolfPKCS11 uses, so an application cannot
register it for the self-contained library with a private static wolfSSL.
Note: wolfSSL must be built with the corresponding features enabled for the
options above to work (e.g. enabling WOLFPKCS11_AESCCM requires wolfSSL built
with -DWOLFSSL_AESCCM=yes).
Path into which files are stored that contain token data. wolfPKCS11 uses the first of the following that is set:
WOLFPKCS11_TOKEN_PATH environment variable.WOLFPKCS11_DEFAULT_TOKEN_PATH build-time setting.$HOME/.wolfPKCS11 on POSIX or
%APPDATA%\wolfPKCS11 on Windows).There is no fallback to /tmp; deployments must provide a secure storage
location explicitly.
WOLFPKCS11_DEFAULT_TOKEN_PATH is set with --with-default-token-path=PATH
(autotools) or -DWOLFPKCS11_DEFAULT_TOKEN_PATH=PATH (CMake). When defining it
directly, for example in user_settings.h, it must be a C string literal such
as #define WOLFPKCS11_DEFAULT_TOKEN_PATH "/var/lib/wolfpkcs11". Backslashes
are escape characters in a C string, so use forward slashes in Windows paths.
Note: releases 2.0 and 2.1 checked the home directory before
WOLFPKCS11_DEFAULT_TOKEN_PATH, so the build-time default was only used when
HOME was unset. Those releases also compiled the path set by
--with-default-token-path or the CMake option in with literal quote
characters around it, so the configured directory was never used. POSIX
deployments built with a default path that have existing tokens in
$HOME/.wolfPKCS11 should set WOLFPKCS11_TOKEN_PATH to that directory, or
move the token files into the build-time default directory. Builds that passed
an unquoted value directly, for example
CFLAGS="-DWOLFPKCS11_DEFAULT_TOKEN_PATH=/some/path", no longer compile; use
--with-default-token-path instead.
Releases 2.0 and 2.1 also looked up a non-existent APPDIR variable on
Windows, so no per-user default was used there and token data went to
WOLFPKCS11_DEFAULT_TOKEN_PATH (or token storage failed if it was unset).
Windows builds now fall back to %APPDATA%\wolfPKCS11 when no build-time
default is set.
Set to any value to stop storage of token data.
Summary
This release adds verify-only LMS/HSS and XMSS/XMSS^MT support, an option to link a static wolfSSL into libwolfpkcs11, and partial token writes that make creating and destroying token objects much faster on custom stores. It also fixes a large number of PKCS#11 specification compliance, memory-safety and concurrency issues found through static analysis and external reports, fixes TPM ECDH, the Windows ABI and the default token path, and enables ThreadSanitizer in CI.
Compatibility with 2.1 behavior
Some of these fixes change behavior that applications or stored tokens may depend on:
WOLFPKCS11_TOKEN_PATH, the NSS store
directory, WOLFPKCS11_DEFAULT_TOKEN_PATH, then the home directory, and a
path set with --with-default-token-path is now used. POSIX builds that set
a default path and have tokens in $HOME/.wolfPKCS11 need to set
WOLFPKCS11_TOKEN_PATH or move the token files. See the
WOLFPKCS11_TOKEN_PATH section above. (PR #225, PR #247)WOLFPKCS11_NO_PACKED_STRUCTS to keep the
previous layout. (PR #209)CKM_AES_CMAC now produces and checks a full 16-byte MAC. Earlier releases
used 8 bytes. (PR #243)CKA_CHECK_VALUE of a generic secret key is now the first three bytes of
the SHA-1 hash of its value, as PKCS#11 3.2 defines. AES-192 keys and
generic secrets that are not an AES key length now return a check value
instead of failing with CKR_FUNCTION_FAILED. (PR #248)C_GetAttributeValue returns CKR_ATTRIBUTE_TYPE_INVALID for attributes an
object does not have and keeps processing the template, and CKA_KEY_TYPE
is only an attribute of key objects. (PR #222)C_SetAttributeValue rejects changes to
CKA_TOKEN, CKA_PRIVATE, CKA_MODIFIABLE, key components and certificate
values. C_CreateObject requires the key or certificate value.
C_GenerateKey and C_GenerateKeyPair reject a class or key type that does
not match the mechanism. Setting CKA_ALWAYS_AUTHENTICATE to CK_TRUE
returns CKR_ATTRIBUTE_VALUE_INVALID. (PR #216, PR #243)C_DeriveKey,
C_EncapsulateKey and C_DecapsulateKey need a user login when the new key
is private. Closing all sessions now logs the application out, and setting
CKA_TRUSTED needs an SO session. (PR #207, PR #212, PR #227, PR #243)CKA_SIGN and CKA_DERIVE, and ECDH runs on the TPM. TPM EC keys
stored by earlier releases were created for signing only and cannot be used
for ECDH. (PR #210)CKR_FUNCTION_FAILED once the object ids run out
(about 268 million objects). Session objects now have their own id counter,
so session object handles start again at 1 after each C_Initialize.
(PR #255)C_DestroyObject, C_FindObjects can return token objects in a
different order. PKCS#11 does not define the order. (PR #257)MAXQ10XX_PRODUCTION_KEY, or
WOLFPKCS11_MAXQ10XX_TEST_KEY to use the built-in test provisioning key.
With neither the build fails. (PR #207)C_* functions, like the autotools build. (PR #258)_WIN32_WINNT below 0x0600, fails with an #error. (PR #254)Detail
--enable-lms,
--enable-xmss), using the PKCS#11 v3.3 mechanism, key type and attribute
values. Public keys can be imported, stored and used with C_Verify.
(PR #206)--with-static-wolfssl in autotools, WOLFPKCS11_STATIC_WOLFSSL in
CMake). The autotools build now also exports the PKCS#11 v3.0 and v3.2
functions, and the CMake package it installs no longer points at
NONE/include when configured without --prefix. (PR #258)C_SetAttributeValue on a token object
stores it straight away. (PR #257)%APPDATA%\wolfPKCS11. (PR #225)WOLFPKCS11_DEFAULT_TOKEN_PATH being ignored when HOME is set, and
being compiled in with extra quotes when set through configure or CMake.
(PR #247)sql:, dbm: or extern: prefix.
(PR #219)C_WrapKey leaving the operation active after a length query, which
broke pk12util -o through NSS. (PR #220)C_SetPIN leaving protected token objects encrypted under the old
token key, so they could not be read after the next C_Initialize.
(PR #226)CKA_CHECK_VALUE for AES-192 keys and generic secret keys.
(PR #248)C_GetAttributeValue failing the whole template for attributes an
object does not have. (PR #222)0x0FFFFFFF, which could read or destroy the wrong object.
(PR #255)C_DestroyObject removing another object that had been created at
the same address by another thread. (PR #252)pkcs11mtt under Wine, and fixed the data races
ThreadSanitizer reported. (PR #254)C_Login decodes keys that are already loaded.
With a wolfSSL built with HAVE_WOLF_BIGINT (for example
--enable-pkcs11), RSA and ECC keys leaked their big integers, and with
dynamic key buffers ML-DSA and ML-KEM keys leaked their key buffers. A new
ASAN CI build against such a wolfSSL catches this. (PR #261)WOLFPKCS11_NO_STORE. (PR #246)C_SetPIN, a failed login clears the derived token key, and logout
protects every decoded token object.CKA_UNIQUE_ID.CKR_BUFFER_TOO_SMALL reports the needed length and
keeps the operation for a retry, and lengths that do not fit in 32 bits
are rejected.CKA_ALWAYS_SENSITIVE and CKA_NEVER_EXTRACTABLE values from
the base key.C_GetInfo,
C_GetSlotInfo and C_GetTokenInfo are blank padded, and mechanism
flags and key sizes match what is implemented. SSL 3.0 key derivation is
no longer advertised.--enable-singlethreaded now defines WOLFPKCS11_SINGLE_THREADED instead
of wolfSSL's SINGLE_THREADED, so wolfPKCS11 uses the same wolfSSL
structure layout as a multi-threaded libwolfssl. (PR #243)ecb_check_value_error_test to generic_secret_check_value_test.
(PR #250)CONTRIBUTING.md. (PR #211)C_GetAttributeValue and
CKA_CHECK_VALUE issues (issue #221, issue #245) and to Nazar Serhiichuk
for reporting the Windows ABI issue (issue #208).Summary
This release adds post-quantum cryptography support (ML-DSA and ML-KEM), CMake build support, and Doxygen API documentation. It also closes a large number of PKCS#11 specification compliance gaps and bugs found through static and negative analysis, hardens memory safety in response to external security reports, and improves CI and interoperability testing.
Compatibility with 2.0 behavior
Several PKCS#11 attribute defaults were corrected to match the specification. These changes can affect applications and stored tokens created with 2.0. The following build defines restore the pre-2.1 (2.0) behavior if needed:
WOLFPKCS11_LEGACY_COPYABLE_FALSE_DEFAULT - restore the old behavior where an
unset CKA_COPYABLE reads back as CK_FALSE (the PKCS#11 default is
CK_TRUE).WOLFPKCS11_LEGACY_PRIVATE_FALSE_DEFAULT - restore the old behavior where an
unset CKA_PRIVATE reads back as CK_FALSE for CKO_PRIVATE_KEY /
CKO_SECRET_KEY (the PKCS#11 default is CK_TRUE). Also disables the
matching login-state check on object creation.WOLFPKCS11_LEGACY_WRAP_TRUE_DEFAULT - restore the old behavior where an
unset CKA_WRAP / CKA_UNWRAP defaults to CK_TRUE (the PKCS#11 default is
CK_FALSE).See the "Behavior changes for PKCS#11 spec compliance" section above for the
related C_DeriveKey, C_CopyObject, C_DestroyObject, encapsulation and
C_Login enforcement changes.
Detail
CKA_SEED private key import.
(PR #161)CKR_OPERATION_ACTIVE. (PR #176)C_WrapKey not checking CKA_EXTRACTABLE on the key being wrapped.
(PR #165)falseVal initialized to CK_TRUE instead of CK_FALSE. (PR #162)#ifndef macro. (PR #167)configure.ac. (PR #164)C_DestroyObject so completing an operation can no longer read
freed memory. (PR #201)C_VerifyRecover test and fixed test attributes. (PR #184)--enable-cryptocb usage. (PR #149)CK_ULONG length truncation in C_GenerateRandom and C_SeedRandom.
(PR #199)WOLFPKCS11_USER_SETTINGS. (PR #200)configure.ac start year. (PR #191)-dev package.
(PR #192)C_GenerateRandom /
C_SeedRandom length-truncation fix (PR #199) and for reporting several of
the memory-safety issues fixed in PR #201 (oversized CKA_VALUE_LEN
handling, the RSA verify-recover output-length type-punning, and the
use-after-free of an active object on C_DestroyObject).Summary
This release contains many new features so that it can be the PKCS11 backend for NSS. It also includes many bug fixes.
Detail
AES-CCMAES-ECBAES-CTSAES-CTRCKA_CERTIFICATE_TYPE search for CKC_X_509C_FindObjects on a certificate objectC_Digest*C_SignEncryptUpdateC_DecryptVerifyUpdateC_GetOperationState and C_SetOperationState (Digest only)C_SignRecoverInit and C_VerifyRecoverwolfPKCS11_Debugging_On and wolfPKCS11_Debugging_OffCKM_ECDSA_SHA*CKM_SHA*_RSA*CKM_AES_CMAC_GENERALCKM_AES_CMACCKM_AES_CBC_ENCRYPT_DATACKM_HKDF_DATACKM_HKDF_KEY_GENCKM_TLS12_KEY_AND_MAC_DERIVECKM_TLS12_MASTER_KEY_DERIVECKM_TLS12_MASTER_KEY_DERIVE_DHCKM_NSS_TLS_EXTENDED_MASTER_KEY_DERIVE (NSS builds only)CKM_NSS_TLS_EXTENDED_MASTER_KEY_DERIVE_DH (NSS builds only)CKM_NSS_TLS_PRF_GENERAL_SHA256 (NSS builds only)CKM_TLS_MACCKM_SHA1_RSA_PKCSCKM_SHA1_RSA_PKCS_PSSCKM_SHA3*CKM_MD5CKM_NSS_PKCS12_PBE_SHA*_HMAC_KEY_GEN (NSS builds only)CKM_PKCS5_PBKD2CKO_DATACKO_NSS_TRUST (NSS builds only)CKA_CERTIFICATE_TYPECKA_CERTIFICATE_CATEGORYCKA_IDCKA_ISSUERCKA_SERIAL_NUMBERCKA_PUBLIC_KEY_INFOCKA_URLCKA_HASH_OF_SUBJECT_PUBLIC_KEYCKA_HASH_OF_ISSUER_PUBLIC_KEYCKA_NAME_HASH_ALGORITHMCKA_CHECK_VALUECKA_CERT_SHA1_HASH (NSS builds only)CKA_CERT_MD5_HASH (NSS builds only)CKA_TRUST_SERVER_AUTH (NSS builds only)CKA_TRUST_CLIENT_AUTH (NSS builds only)CKA_TRUST_EMAIL_PROTECTION (NSS builds only)CKA_TRUST_CODE_SIGNING (NSS builds only)CKA_TRUST_STEP_UP_APPROVED (NSS builds only)CKA_NSS_EMAIL (NSS builds only)CKA_NSS_DB (NSS builds only, not stored)--enable-nss for NSS specific PKCS11 quirksC_SetAttributeValue sometimes erasing keysC_Loginmalloc(0) code pathC_CopyObject not doing a deep copyCKM_RSA_PKCS to wrap / unwrapC_DestroyObject now deletes files instead of leaving truncated files--enable-pbkdf2 or defining WOLFPKCS11_PBKDF2--pbkdf2-iterations and PBKDF2_ITERATIONS to set the number of
PBKDF2 iterations for pin handling (default 600,000).Summary
Added Visual Studio support for wolfPKCS11. Fixes for cast warnings and portability.
Detail
C_GetAttributeValue incorrectly erroring with CKR_ATTRIBUTE_VALUE_INVALID when data == NULL. The C_GetAttributeValue should set length if data field is NULL. (PR #27)WOLFPKCS11_USER_SETTINGS. (PR #28)Summary
Adds backend support for TPM 2.0 using wolfTPM. Adds AES CBC key wrap / unwrap support. Portability improvements. Improved testing with GitHub Actions.
Detail
WOLFSSL_USER_SETTINGS to avoid including wolfssl/options.hWOLFPKCS11_USER_SETTINGS to avoid including wolfPKCS11/options.hWOLFPKCS11_NO_TIME to make wc_GetTime() optional (it disables brute-force protections on token login)WOLFPKCS11_NO_TIME (PR #18)SetMPI/GetMPIData (PR #19)NO_DH ifdef gate when freeing PKCS11 object (PR #20)./autogen.sh. Updated m4 macros. (PR #21)WOLFPKCS11_TPM_STORE). Allow WOLFPKCS11_NO_STORE for TPM use case. (PR #23)WOLFPKCS11_NO_ENV when setenv/getenv are not available. (PR #23)-ldl for non-static builds. (PR #23)NO_MAIN_DRIVER. Support for SINGLE_THREADED. Add static to some globals. (PR #24)XREALLOC is not available. (PR #25)WOLFPKCS11_USER_ENV. (PR #25)CK_INVALID_SESSION.WP11_API visibility.curve_oid lookup with FIPS.config.h from the public pkcs11.h header.wolfSSL/wolfPKCS11 is a public repo on GitHub by wolfSSL. wolfSSL PKCS#11.
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker tagged it for Windows and Linux. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-23. GitHub counts 6 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Bitcoin Core integration/staging tree
LizardFS is an Open Source Distributed File System licensed under GPLv3.
Reverse engineer anything with agents, from app behavior down to native binaries.

A list of Free Software network services and web applications which can be hosted on your own servers
The wolfSSL library is a small, fast, portable implementation of TLS/SSL for embedded devices to the cloud. wolfSSL supports up to TLS 1.3 and DTLS 1.3! Update to wolfSSL 5.9.1 for the latest CVE fixes.
wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
wolfBoot is a portable, OS-agnostic, secure bootloader for microcontrollers, supporting firmware authentication and firmware update mechanisms.
wolfSSH is a small, fast, portable SSH implementation, including support for SCP and SFTP.
wolfTPM is a highly portable TPM 2.0 library, designed for embedded use.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/wolfSSL/wolfPKCS11Take My Repo has not tested this on your machine. Requirements come from the project's own documentation.