Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

674
Vistas
PHP-SSLCURL Error- unable to load client cert: -8018 (SEC_ERROR_UNKNOWN_PKCS11_ERROR)

I am trying to consume a REST API that requires Client certificate authentication on my PHP code. I have the certificate converted into a .pem, .pfx, .crt, .key and .keystore format The API also requires Basic authentication using username and password

I have tried different implementation on the server, but I keep getting the Error "unable to load client cert: -8018 (SEC_ERROR_UNKNOWN_PKCS11_ERROR"

It's a linux box, RedHat, running on Apache and PHP.

Here is the Code snippet I currently have implemented

$username="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
$password="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
$certFile = "/etc/ssl/certs/cert/example.pem";
$certPass = "examplepass";
$keyFile = "/etc/ssl/certs/cert/example.key";
$caFile = "/etc/ssl/certs/cert/example.crt";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://www.example.com/some_protected_page');
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(
"Content-type: $content_type", 
));

// The --cert option
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_CAINFO, $certFile);
curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $certPass);
//curl_setopt($ch, CURLOPT_SSLKEY, $keyFile);
//curl_setopt($ch, CURLOPT_SSLKEYPASSWD, $certPass); 
curl_setopt($ch, CURLOPT_TIMEOUT, 300);

$adata =  curl_exec($ch);
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda