Skip to content
mingulovPublic

About

PKCS#11 3.2 software token written in Haskell, with OpenSSL doing the cryptography. A demonstrator for learning PKCS#11 and testing clients; use disposable keys, not a production HSM.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Haskoki

Try the interface used by smart cards and hardware security modules, using software on your computer. Haskoki lets you create a disposable key, sign a message, check its signature, and experiment with encryption. No hardware or Haskell knowledge required.

PKCS#11 is the common interface that applications use to ask a token to hold keys and perform cryptographic operations. Haskoki is a software token written in Haskell, a functional programming language. OpenSSL performs the cryptography; ordinary tools talk to Haskoki through libhaskoki.so, just as they would load another PKCS#11 module.

Use disposable keys. This is a demonstrator for learning and client testing, not a production HSM; its stored keys are not encrypted at rest.

Try it with Docker

With Docker running, paste this into a terminal:

mkdir -p out
docker run --rm --network none --user "$(id -u):$(id -g)" \
  -v "$PWD/out:/out" ghcr.io/mingulov/haskoki-demo:latest demo

The latest tag always points at the newest published demo (docker pull refreshes a cached copy). For the exact qualified bytes behind this page's claims, substitute the versioned tag from the releases page.

Docker downloads the image on the first run. The demo itself works offline: it generates keys, signs and verifies a message, checks a SHA-256 fingerprint, and encrypts then decrypts another message. Look for:

demo-ok: 8/8 verifications hold

That's the complete first run. No clone, compiler, account, PIN setup, or physical token is needed. Reports and disposable keys remain in out/demo-*/.

The latest published release is v0.5.0.0 (October 19, 2026). It adds the attribute-sensitivity model, sealed PQC private seeds, schema-3 stores with a migrate-once upgrade path, and an installed client portfolio on top of the v0.4.0.0 demo experience. v0.5.0.0 is a bounded release: its limitations are stated up front. The hands-on guide shows how to pin the published image, generate a key with pkcs11-tool, and sign your own message.

The demo image includes Haskoki, its runtime and crypto libraries, OpenSC pkcs11-tool, pkcs11-check, and pkcs11-proxy-ng, plus p11-kit server/client examples. Extra test-vector collections are an optional download. The tested platform is Linux x86-64 (amd64); Docker supplies the Linux libraries. Other platforms and ARM emulation have not been qualified. Image measurements and contents are in Try it.

Try the Firefox client-certificate experiment for a disposable browser desktop and explicit real-browser acceptance checks.

Where it came from

Haskoki explores a development idea: describe a token's rules in Haskell, test that model separately, then let real applications challenge the compiled module. The aim was easier development with broad, explicit coverage of PKCS#11 behavior: keys, sessions, errors, and interrupted work.

pkcs11-check supplies the external checks. pkcs11-proxy-ng keeps Haskell's runtime and shared libraries in a separate process, so a client can use Haskoki through a PKCS#11 shim. Reusing that transport avoided building a custom client/daemon protocol alongside the token.

Coding agents helped implement and review the project; tests and consumer runs supply the behavioral evidence. The development story explains the design, its milestones, and the recorded AI-token usage.

A side note: p11scope can observe PKCS#11 calls on Linux. It is optional and runs separately; an observer note explains that route.

Choose your next step

I want to... Start here
Generate a key and sign something myself Hands-on guide
Try the checker or another process Checker and remoting
Understand the project and its creation Development story
Load it in my own application Native reference and host requirements
Investigate support or build the project Coverage, results, developer toolchain

Haskoki exposes PKCS#11 2.40-3.2 interfaces, with 316 behavior-tested mechanisms out of 464 catalog entries. The published v0.5.0.0 image reports 21 documented findings on the full checker profile (v0.4.0.0 reported 22); the short smoke profile expects zero. Neither number establishes conformance or certification. See the results and limits before choosing it for an integration.

Apache-2.0 | Report a problem

About

PKCS#11 3.2 software token written in Haskell, with OpenSSL doing the cryptography. A demonstrator for learning PKCS#11 and testing clients; use disposable keys, not a production HSM.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages