Re: CURLE_SSL_CACERT_BADFILE error for HTTPS URL
Date: Sat, 11 Jan 2020 23:32:36 +0400
On 1/10/20 10:22 PM, shiftag via curl-library wrote:
> Hello,
>
> I'm using static libcurl and openssl for my project. When I tried to
> access an HTTPS URL I got the following error: CURLE_SSL_CACERT_BADFILE
>
> I think this issue came from static openssl as it works fine when I
> was using the one on my system.
>
> I built the static libraries that way:
>
> - openssl:
>
> Â Â Â Â Â Â ./config
> Â Â Â Â Â Â Â Â Â no-shared
> Â Â Â Â Â Â Â Â Â no-stdio
> Â Â Â Â Â Â Â Â Â no-dsoÂ
> Â Â Â Â Â Â Â Â Â no-engine
>          no-srp  Â
>          no-psk Â
> Â Â Â Â Â Â Â Â Â no-ec2mÂ
> Â Â Â Â Â Â Â Â Â no-compÂ
> Â Â Â Â Â Â Â Â Â --prefix=$(PATHDEP) Â Â Â Â Â Â Â Â Â Â Â Â
> Â Â Â Â Â Â Â Â Â --openssldir=$(PATHDEP) Â Â Â Â Â
>       make                                     Â
> Â Â Â Â Â Â make install
>
> - curl:
>       ./buildconf                              Â
>       PKG_CONFIG_PATH=$(PATHDEP)/lib/pkgconfig ./configure    Â
>          --with-ssl         Â
> Â Â Â Â Â Â Â Â Â --disable-shared
>          --enable-static   Â
> Â Â Â Â Â Â Â Â Â --disable-ntlm-wb
>          --without-ntlm   Â
>          --disable-ldap   Â
>          --disable-telnet  Â
> Â Â Â Â Â Â Â Â Â --disable-ipv6Â Â Â Â
>          --disable-ldaps  Â
>          --disable-rtsp     Â
>          --disable-tftp      Â
> Â Â Â Â Â Â Â Â Â --disable-pop3Â Â Â Â
>          --disable-imap   Â
>          --disable-smb   Â
>          --disable-smtp   Â
>          --disable-gopher Â
>          --without-brotli     Â
> Â Â Â Â Â Â Â Â Â --without-librtmp
> Â Â Â Â Â Â Â Â Â --prefix=$(PATHDEP)
> Â Â Â Â Â Â make
> Â Â Â Â Â Â make install
>
> When statically building openssl the certs folder is empty, so I used
> mk-ca-bundle.pl file to instal the bundle. But the problem persist.
>
> Please, let me know if you need more details.
>
Hi again,
So it appears the issue is not related to the compilation. The normal
behavior of libcurl is checking /etc/ssl/certs, so I rebuild the content
of that directory with .crt files and the symbolink link to .pem with
the symbolink link to the hash (the one generated by c_rehash command).
But still the issue persist.
$ static-path/bin/curl -L -v https://www.google.com%c2 (curl compiled
statically)
*Â Â Trying 216.58.208.228:443...
* TCP_NODELAY set
* Connected to www.google.com (216.58.208.228) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* error setting certificate verify locations:
 CAfile: /xxx/static-path-set-with-configure/certs/ca-bundle.crt
 CApath: /xxx/static-path-set-with-configure/certs
* Closing connection 0
curl: (77) error setting certificate verify locations:
 CAfile: /xxx/static-path-set-with-configure/certs/ca-bundle.crt
 CApath: /xxx/static-path-set-with-configure/certs
so /xxx/static-path-set-with-configure/certs contains this :
lrwxrwxrwx shiftag users   45 B Sat Jan 11 22:55:09 2020 02265526.0 ⇒
Entrust_Root_Certification_Authority_-_G2.pem                                                                       Â
lrwxrwxrwx shiftag users   36 B Sat Jan 11 22:55:09 2020 03179a64.0 ⇒
Staat_der_Nederlanden_EV_Root_CA.pem  Â
[...]
lrwxrwxrwx shiftag users 45 B Sat Jan 11 22:52:56 2020
Entrust_Root_Certification_Authority_-_G2.pem ⇒
Entrust_Root_Certification_Authority_-_G2.crt
lrwxrwxrwx shiftag users 36 B Sat Jan 11 22:52:56 2020
Staat_der_Nederlanden_EV_Root_CA.pem ⇒ Staat_der_Nederlanden_EV_Root_CA.crt
[...]
Any idea ??
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-01-11