Search code examples
c#pkcs#11hsmpkcs11interop

How to use Pkcs11Interop with an NitroKey HSM to derive an shared secret with an EC


I bought a NitroKey HSM and manged to create an EC on it.

Now I want to derive a shared secret.
I found Pkcs11Interop, which seems to be the right tool for the job, but the handling is unclear.

A code snipplet or link to a working project would be very appreciated.


Solution

  • You can take a look at Pkcs11Admin application for a real world sample using Pkcs11Interop library.

    As far as I remember NitroKey HSM should be used with OpenSC middleware so your unmanaged library implementing PKCS#11 API will be opensc-pkcs11.dll.

    I believe these resources might be helpful for you:

    1. Getting started with Pkcs11Interop
    2. Pkcs11Interop code samples which contain also key derivation sample
    3. PKCS#11 specification