Hello, i'm trying to make an http request but i have the error Error: unhandled exception: error:0A00018A:SSL routines::dh key too small [SslError] i read in stackoverflow that is a problem with the certificate of the server. I tried in another programming language and i could make the request successfully out of the box.
My question is what additional configuration do i need. The url is https://www.correosdemexico.gob.mx/SSLServicios/ConsultaCP/Descarga.aspx and i used the getContent method of httpclient.
for http(s) requests i would use puppy ( https://github.com/treeform/puppy ) , since puppy use the apis provided by the system (winapi or curl).
Btw. i could not do a any request to the url you provided (from germany). The server does not answer to me.
Thanks for your reply, puppy worked perfectly fine, and it fits my inmediate wish of learning nim by doing small examples.
But still if someone knows how to do it with with the stdlib i'll be grateful. I also tried downloading the cacert.pem used by curl but it did not work and neither disabling verification.
var ctx = newContext(verifyMode = CVerifyNone)
var client = newHttpClient(sslContext = ctx)
I did not have problems accessing from outside mexico (us).
curl "https://www.correosdemexico.gob.mx/SSLServicios/ConsultaCP/Descarga.aspx" --verbose
* Trying 187.218.53.183:443...
* Connected to www.correosdemexico.gob.mx (187.218.53.183) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=www.correosdemexico.gob.mx
* start date: Jul 20 03:57:20 2023 GMT
* expire date: Jul 20 22:51:04 2024 GMT
* subjectAltName: host "www.correosdemexico.gob.mx" matched cert's "www.correosdemexico.gob.mx"
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
* SSL certificate verify ok.
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /SSLServicios/ConsultaCP/Descarga.aspx HTTP/1.1
> Host: www.correosdemexico.gob.mx
> User-Agent: curl/7.81.0
> Accept: */*
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Cache-Control: private
< Content-Type: text/html; charset=iso-8859-1
< Server: Microsoft-IIS/8.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Sat, 10 Feb 2024 15:46:04 GMT
< Content-Length: 11917