1

I would like to load the pkcs11 engine provided by OpenSC using C code instead of the command line. The command line instruction goes as follows:

openssl engine dynamic -pre SO_PATH:/usr/lib/engines/engine_pkcs11.so -pre ID:pkcs11 -pre LIST_ADD:1 -pre LOAD -pre MODULE_PATH:opensc-pkcs11.so

which yields the result:

(dynamic) Dynamic engine loading support
[Success]: SO_PATH:/usr/lib/engines/engine_pkcs11.so
[Success]: ID:pkcs11
[Success]: LIST_ADD:1
[Success]: LOAD
[Success]: MODULE_PATH:opensc-pkcs11.so
Loaded: (pkcs11) pkcs11 engine

I want to do the same using C code in an independent program so that I can use the:

static X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)

function to get the certificate from the smart card.

user3883991
  • 71
  • 2
  • 6
  • What have you researched, or what have you tried? Or are you looking for someone to provide you with the code? – jww Jul 17 '15 at 06:00
  • I have used the shell to do the above but I need an independent program in C so that I can include the engine_pkcs11 header file and use the X509 function to get the certificate. After that I want to use the certificate for client side validation in an SSL handshake. But yes, I would be very helpful if someone could provide an example to load the engine in an independent program. Thanks – user3883991 Jul 17 '15 at 08:01
  • **Exact duplicate** of [Loading engine pkcs11 using c code](http://stackoverflow.com/questions/31402481/loading-engine-pkcs11-using-c-code). Don't just open the same question a second time. – DevSolar Jul 22 '15 at 11:51
  • @DevSolar [Loading engine pkcs11 usng c code](http://stackoverflow.com/questions/31402481/loading-engine-pkcs11-using-c-code) has been removed – John S Gruber Nov 08 '18 at 16:11

0 Answers0