Skip to content

PKCS#11 mock module for unit testing of Pkcs11Interop library

License

Notifications You must be signed in to change notification settings

Pkcs11Interop/pkcs11-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PKCS11-MOCK

PKCS#11 mock module

Windows Linux macOS Android iOS

Table of Contents

Overview

PKCS11-MOCK is minimalistic C library that implements PKCS#11 v3.1 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.

Download

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.

Building the source

Windows

Execute the build script on a 64-bit Windows machine with Visual Studio 2022 (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.

Linux

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 24.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.

macOS

Execute the build script on a 64-bit macOS machine with Xcode and its "Command Line Tools" extension installed:

cd build/macos/
sh build.sh

The script should use Clang to build Mach-O universal binary (pkcs11-mock.dylib) usable on both Apple silicon and Intel-based Mac computers.

Android

Execute the build script on a 64-bit Windows machine with Android NDK r26d (or newer) unpacked in C:\android-ndk or in a folder defined by ANDROID_NDK environment variable:

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.

iOS

Execute the build script on a 64-bit macOS machine with Xcode and its "Command Line Tools" extension installed:

cd build/ios/
sh build.sh

The script should use Xcode to build the library with iphonesimulator SDK (libpkcs11-mock-iphonesimulator.a) and iphoneos SDK (libpkcs11-mock-iphoneos.a).

License

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.

About

PKCS11-MOCK has been written for the Pkcs11Interop project by Jaroslav Imrich.
Please visit project website - pkcs11interop.net - for more information.

About

PKCS#11 mock module for unit testing of Pkcs11Interop library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages