pkcs11-sslconnect is an example of integrating pkcs11 from smartcards and connect to a https via libopenssl.