Using PKCS#11 from C
The code samples on GitHub show how to use keys on a Securosys HSM from C via the PKCS#11 provider.
Prerequisites
- A C compiler, for example
gcc
. - Set up the Primus PKCS#11 Provider on your machine.
- To check that it is properly configured, run
ppin -l
, or see the troubleshooting.
- To check that it is properly configured, run
- The
pkcs11.h
header file.- The Securosys-specific header file is located at
$PRIMUS_HOME/include/pkcs11.h
(if you have installed the Primus PKCS#11 Provider). This is needed if you want to use Securosys-specific extensions, such as attestation. - The standard header files can be found on the OASIS website. This suffices if you only want to use standardized PKCS#11 features.
- The Securosys-specific header file is located at
Download the Sample
git clone https://github.com/securosys-com/hsm-api-examples.git
cd hsm-api-examples/pkcs/c
Compile and Run
make
./bin/rsa