CURL en Windows. SSL

<< < (2/2)

el-brujo:

Citar

Download the latest cacert.pem from https://curl.haxx.se/ca/cacert.pem

Add the following line to php.ini: (if this is shared hosting and you don't have access to php.ini then you could add this to .user.ini in public_html).

curl.cainfo="/path/to/downloaded/cacert.pem"

Make sure you enclose the path within double quotation marks!!!


Citar

I found out you need to download the .pem file here https://curl.haxx.se/docs/caextract.html

And add these settings...

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1);           
curl_easy_setopt(curl, CURLOPT_CAINFO, "PATH TO FILE\\cacert.pem");
curl_easy_setopt(curl, CURLOPT_CAPATH, "PATH TO FILE\\cacert.pem");


engel lex:
por aclarar un poco

Cita de: marax en 16 Mayo 2021, 21:43 pm

¿Que es "Certificado del emisor"?


el SSL no es unidireccional, es decir, no es que la pagina te pasa su certificado y listo, sino que es bidireccional, ella te pasa un certificado y tu le pasas uno, ambos son requeridos para el cifrado asimetrico....

El certificado del emisor, es tu certificado, el curl en tu windows aparentemente no lo consigue y por lo tanto no puede terminar el saludo SSL (handshake)

lo que propone el-brujo, es la solución oficial, que te descargues el certificado oficial de curl (cacert.pem) y que lo incluyas en el código (CURLOPT_CAINFO y CURLOPT_CAPATH)

Usuario887:
Hola,

gracias por su atencion, pero el problema inicial persiste:

Citar

C:\Users\Programming\Desktop\CURL test>main https://www.google.com/
*   Trying 142.250.185.4:443...
* Connected to www.google.com (142.250.185.4) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: cacert.pem
*  CApath: cacert.pem
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=www.google.com
*  start date: May  3 11:24:19 2021 GMT
*  expire date: Jul 26 11:24:18 2021 GMT
*  subjectAltName: host "www.google.com" matched cert's "www.google.com"
*  issuer: C=US; O=Google Trust Services; CN=GTS CA 1O1
*  SSL certificate verify ok.
* No OCSP response received
* Closing connection 0
Failed to get web page: SSL server certificate status verification FAILED

C:\Users\Programming\Desktop\CURL test>

MinusFour:
Cita de: marax en 21 Mayo 2021, 19:29 pm

Hola,

gracias por su atencion, pero el problema inicial persiste:



No uses:

Código:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1);

Los servidores de google (o al menos al que estás intentando conectarte) no soportan esa extensión.

Edit:
¿O quizás es algo que te haga falta a ti?

Usuario887:
Tienes razon, MinusFour. Ese era el problema.

Ahora funciona.

Gracias por su atencion.

Navegación

[0] Índice de Mensajes

[*] Página Anterior