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.