Skip to main content
The CryptoHub-backed PKCS#11 module reports Cryptoki version 3.2 and implements the PKCS#11 v3.2 post-quantum objects, mechanisms, attributes, and functions. This page describes the module’s ML-DSA signature (FIPS 204) and ML-KEM key encapsulation (FIPS 203) support and shows how to use them from C. For the full advertised mechanism list, see Appendix A.
Post-quantum support depends on the module build and the backing CryptoHub release. Confirm the mechanisms and parameter sets your deployment advertises with C_GetMechanismList before you rely on them. The examples below reflect the build documented in Overview.

Post-quantum objects and attributes

The module exposes standardized PKCS#11 v3.2 post-quantum key types and attributes:

Parameter sets

Post-quantum keys are selected by parameter set through CKA_PARAMETER_SET, not by a key length in bits:
  • ML-DSA: ML-DSA-44, ML-DSA-65, ML-DSA-87 (selected with CKP_ML_DSA_44, CKP_ML_DSA_65, CKP_ML_DSA_87).
  • ML-KEM: ML-KEM-512, ML-KEM-768, ML-KEM-1024 (selected with CKP_ML_KEM_512, CKP_ML_KEM_768, CKP_ML_KEM_1024).

Usage requirements

  • ML-DSA keys require sign and verify usage (CKA_SIGN on the private key, CKA_VERIFY on the public key).
  • ML-KEM keys require the appropriate encapsulation or decapsulation usage and the correct public/private role: encapsulation uses an ML-KEM public key, and decapsulation requires the ML-KEM private key.

Discover the post-quantum mechanisms

Before you generate keys, confirm the module advertises the mechanisms and parameter sets you expect. Enumerate the mechanisms with C_GetMechanismList and inspect each one’s flags and ranges with C_GetMechanismInfo.
C

Generate an ML-DSA key pair

Generate an ML-DSA signing key pair by passing CKM_ML_DSA_KEY_PAIR_GEN and selecting the parameter set with CKA_PARAMETER_SET.
C

Sign and verify with ML-DSA

Sign with the pure CKM_ML_DSA mechanism. To sign a pre-hashed (externalized) message digest, use one of the CKM_HASH_ML_DSA* mechanisms instead and supply the matching digest.
C

Generate an ML-KEM key pair

Generate an ML-KEM key pair with CKM_ML_KEM_KEY_PAIR_GEN, selecting the parameter set with CKA_PARAMETER_SET and marking the keys for encapsulation and decapsulation.
C

Encapsulate and decapsulate with ML-KEM

ML-KEM uses the PKCS#11 v3.2 C_EncapsulateKey and C_DecapsulateKey functions. Encapsulation takes the recipient’s ML-KEM public key, produces a ciphertext, and returns a handle to a freshly derived shared-secret key. Decapsulation takes the ciphertext and the recipient’s private key and returns a handle to the same shared-secret key. Use the result-key template to shape the derived key (for example, as an AES key), and handle the ciphertext-sizing call by querying the required length first.
C

Handle post-quantum errors

Check for these return values when working with post-quantum mechanisms:

Java and SunPKCS11 limitations

Java’s SunPKCS11 provider and the JDK may lag the module’s PKCS#11 v3.2 post-quantum and KEM features. The native provider can expose mechanisms that the SunPKCS11 layer cannot name or invoke. Do not assume a Java application reaches every mechanism the native module advertises. For post-quantum operations, use the native C Cryptoki interface, or confirm your specific JDK and SunPKCS11 build support the ML-DSA and ML-KEM mechanisms before relying on them.