How To

These recipes use the Fe11 0.1.0 public API. Each explains the application inputs, the native operation, the result and the ownership needed to handle failure. The complete Rust sources are in examples/how_to.rs and its modules: setup, operations, keys, lifecycle and PQC. They are ordinary library examples: the functions run only when your application calls them.

TaskGuide
Load a module, choose a token and open a sessionModule setup
Authenticate and preserve cleanup errorsAuthentication and lifecycle
Hash messages and obtain random bytesHashing and random data
Find RSA objects, generate a pair and signKeys and signatures
Encrypt and authenticate application recordsAES-GCM
Generate ML-DSA or SLH-DSA keys and signPQC signatures
Select external prehash or native message hashingPQC prehash modes
Establish native shared keys with ML-KEMML-KEM
Select software public-key verificationVerification engine
Preserve native errors and incomplete outcomesError handling

§Use the examples

An application using all examples can declare:

[dependencies]
fe11 = "=0.1.0"
fe11-sys = "=0.1.0"

The direct fe11-sys dependency supplies standardized attribute constants in the search example. The optional verification engine is built and loaded separately. Choose a native module matching your application target and the required PKCS#11 interface. Module capability discovery helps select operations; their native results determine whether a particular key and parameter combination succeeds.

From the Fe11 source workspace, type-check every recipe with:

cargo check -p fe11 --example how_to

This command compiles the example library and its dependencies without calling a PKCS#11 module. Supply paths, resource budgets, identities, credentials and key policies from application configuration when integrating a recipe. Budget values describe memory, handles and input sizes; derive them from the application workload. The examples intentionally accept those values as arguments.

All How To guides