September 17, 2019, 08:19:42 AM

Author Topic: BaH.libcurl with https fails, "BADCERT_NOT_TRUSTED"  (Read 918 times)

Offline nokkusuu

  • Jr. Member
  • **
  • Posts: 5
BaH.libcurl with https fails, "BADCERT_NOT_TRUSTED"
« on: June 02, 2018, 06:48:05 PM »
When using libcurl (newest version, should support TLS) I get an error saying BADCERT_NOT_TRUSTED.

Code: [Select]
Executing:test.debug.exe
* Rebuilt URL to: https://www.google.com/
*   Trying 172.217.4.196...
* TCP_NODELAY set
* Connected to www.google.com (172.217.4.196) port 443 (#0)
* mbedTLS: Connecting to www.google.com:443
* mbedTLS: Set min SSL version to TLS 1.0
* mbedTLS: Handshake complete, cipher is TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
* Cert verify failed: BADCERT_NOT_TRUSTED
* Closing connection 0

Process complete

I'm no expert with this stuff, so I'm very confused. Any help is appreciated.

Offline Brucey

  • Jr. Member
  • **
  • Posts: 86
Re: BaH.libcurl with https fails, "BADCERT_NOT_TRUSTED"
« Reply #1 on: June 02, 2018, 09:20:23 PM »
Hi,

You need to provide libcurl with certificates it can validate against. Have a look at ex_08.bmx in the examples folder, which shows how to connect to google.com over https.

The other option is not to validate, but you'd typically not want to do that.

Offline nokkusuu

  • Jr. Member
  • **
  • Posts: 5
Re: BaH.libcurl with https fails, "BADCERT_NOT_TRUSTED"
« Reply #2 on: June 03, 2018, 01:53:24 AM »
I don't see an ex_08.bmx. I'm using the latest version from GitHub; is there a newer version elsewhere?

EDIT: Nevermind, I found an example in an older version of libcurlssl, with the name ex_08.bmx. I assume that's the file you were referring to. Works well now, thanks!

Offline Derron

  • Hero Member
  • *****
  • Posts: 2402
Re: BaH.libcurl with https fails, "BADCERT_NOT_TRUSTED"
« Reply #3 on: June 03, 2018, 06:40:17 AM »
nokkusuu is right, ex_08.bmx is no longer in the repository.


bye
Ron

Offline Brucey

  • Jr. Member
  • **
  • Posts: 86
Re: BaH.libcurl with https fails, "BADCERT_NOT_TRUSTED"
« Reply #4 on: June 03, 2018, 02:16:23 PM »
Apologies, the example was missing from the current module.