Skip to main content

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

  1. A C compiler, for example gcc.
  2. Set up the Primus PKCS#11 Provider on your machine.
    1. To check that it is properly configured, run ppin -l, or see the troubleshooting.
  3. The pkcs11.h header file.
    1. 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.
    2. The standard header files can be found on the OASIS website. This suffices if you only want to use standardized PKCS#11 features.

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
Get started withCloudHSM for free.
Other questions?Ask Sales.
Feedback
Need help?