pkcs11 2.40.0-alpha.4

Twofold (deimos/derelict) binding to PKCS #11 Cryptoki interface

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Build state

Build Status Coverage Status


Twofold binding to PKCS #11 Cryptoki interface (Version 2.40 Plus Errata 01) {1,2 PKCS#11}

configuration 'deimos': Static binding, the "import-only" C header's declarations.
configuration 'derelict': Dynamic binding (DerelictUtil), the header's declarations + derelict runtime loading (any pkcs#11 implementing shared library(s)) interface.

With configuration 'derelict', the version identifier PKCS11DYNAMICBINDINGONE is set as default by dub.json, meaning, that connecting to exactly one only PKCS#11 implementing library is as easy as shown in the code snippet below. In the one-library-case, You won't have to deal with the CKFUNCTIONLISTPTR. There is also version identifier PKCS11DYNAMICBINDINGMULTIPLE for cases, where multiple/different PKCS#11 libraries will be used by an application. Version identifier P11KIT may be used with PKCS11DYNAMICBINDINGONE, i.a. to select the PKCS#11 implementing library via the p11-kit configuration.

For more information on dynamic binding and Your options with derelict-util, look at {4 Derelict}.
Here's some sample code:

// Written in the D programming language
// configuration 'derelict'
import std.stdio;
import pkcs11;

int main() {
	PKCS11.load(); // uses default library: {5 OpenSC}, or do specify explicitely

	CK_RV rv;
	if ((rv=C_Initialize(null)) != CKR_OK) {
		writeln("Failed to initialze Cryptoki");
		return 1;


1 PKCS#11
2 PKCS#11 headers
3 PKCS#11 programming intro
4 Derelict
5 OpenSC, opensc.conf/debug/debug_file, inspect (high-level) Cryptoki communication
(6 Inspect (low-level) PC/SC communication)

Not yet covered: v3.0
7 PKCS#11
8 PKCS#11 headers

  • Carsten Blüggel
2.40.0-alpha.4 2019-Jun-21
2.40.0-alpha.3 2017-Mar-19
2.40.0-alpha.2 2017-Feb-26
2.40.0-alpha.1 2017-Feb-17
~master 2019-Jun-21
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 125 downloads total

Short URL: