PKCS#11 mock module
PKCS11-MOCK is minimalistic C library that implements PKCS#11 v2.20 API. It is not a real cryptographic module but just a dummy mock object designed specifically for unit testing of Pkcs11Interop library.
The Wikipedia article on mock objects states:
In object-oriented programming, mock objects are simulated objects that mimic the behavior of real objects in controlled ways. A programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.
Following these simple principles PKCS11-MOCK does not depend on any hardware nor configuration and can be easily modified to return any response or data. It has been tested on several desktop and mobile platforms and as such might also be used as a lightweight skeleton for the development of portable PKCS#11 libraries.
Signed precompiled binaries as well as source code releases can be downloaded from releases page.
Archives with source code are signed with GnuPG key of Jaroslav Imrich.
Windows libraries are signed with code-signing certificate of Jaroslav Imrich.
Execute the build script on a 64-bit Windows machine with Visual Studio 2015 Community (or newer) installed:
cd build/windows/
build.bat
The script should use Visual Studio to build both 32-bit (pkcs11-mock-x86.dll
) and 64-bit (pkcs11-mock-x64.dll
) versions of the library.
Execute the build script on a 64-bit Linux machine with GCC, GNU Make and GCC multilib support installed (available in build-essential and gcc-multilib packages on Ubuntu 14.04 LTS):
cd build/linux/
sh build.sh
The script should use GCC to build both 32-bit (pkcs11-mock-x86.so
) and 64-bit (pkcs11-mock-x64.so
) versions of the library.
Execute the build script on a 64-bit Mac OS X machine with Xcode and its "Command Line Tools" extension installed:
cd build/osx/
sh build.sh
The script should use GCC to build both 32-bit (pkcs11-mock-x86.dylib
) and 64-bit (pkcs11-mock-x64.dylib
) versions of the library.
Execute the build script on a 64-bit Windows machine with Android NDK r14 (or newer) unpacked in C:\android-ndk
folder:
cd build/android/
build.bat
The script should use Android NDK to build the library for all supported architectures. Results will be located in libs
directory and its subdirectories.
Execute the build script on a 64-bit Mac OS X machine with Xcode and its "Command Line Tools" extension installed:
cd build/ios/
sh build.sh
The script should use Xcode to build Mach-O universal binary (libpkcs11-mock.a
) usable on all supported architectures.
PKCS11-MOCK is available under the terms of the Apache License, Version 2.0.
Human friendly license summary is available at tldrlegal.com but the full license text always prevails.
PKCS11-MOCK has been developed as a part of Pkcs11Interop project by Jaroslav Imrich.
Please visit project website - pkcs11interop.net - for more information.