I am using below command to connect:-

curl --cert-type P12 --cert ./my.p12:password --cacert ./my-cert.pem https://host:8443/api/root

but getting this ERROR:

curl: (58) unable to load client cert: -8018 (SEC_ERROR_UNKNOWN_PKCS11_ERROR)

curl version ==:

curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.53.1 zlib/1.2.7 libidn/1.28 libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets 

OS version :-

CentOS Linux release 7.7.1908 (Core)

curl with -v results :

  • About to connect() to host port 8443 (#0)
  • Trying 10.X.X.X
  • Connected to host (10.X.X.X) port 8443 (#0)
  • Initializing NSS with certpath: sql:/etc/pki/nssdb
  • CAfile: ./my-cert.pem CApath: none
  • unable to load client cert: -8018 (SEC_ERROR_UNKNOWN_PKCS11_ERROR)
  • Unknown PKCS #11 error.
  • Closing connection 0 curl: (58) unable to load client cert: -8018 (SEC_ERROR_UNKNOWN_PKCS11_ERROR)

Try this:

taken from here

Change the following line in the configuration file /etc/opensc/opensc.conf:

# reader_drivers = openct, pcsc, ctapi;


reader_drivers = pcsc;
  • I dont have this file.
    – TKHN
    May 30 '21 at 11:42
  • not sure how will this work...mine is centos7
    – TKHN
    May 30 '21 at 11:46
  • A google of the key words opensec.conf location centos directed me to this page centos.pkgs.org/7/centos-x86_64/…, which showed the location on CentOS to be at /etc/opensec.conf. C'mon now, a little effort on your part is required
    – Shōgun8
    May 31 '21 at 8:43
  • yeah Buddy..I checked the same location..
    – TKHN
    May 31 '21 at 9:04
  • It seemed I need to have smart card confgured by admin
    – TKHN
    May 31 '21 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.