Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between curl/curl.h, libcurl, libcurl4-openssl-dev, libcurl4-nss-dev libraries?

Tags:

c

curl

libcurl

i had the following curl headers, and i still could install the libcurl4 packages mentioned above-

kafka@metamorphosis:~$ ll /usr/include/curl/
total 200
drwxr-xr-x  2 root root  4096 Jan 16 13:29 ./
drwxr-xr-x 51 root root 20480 Jan 16 13:29 ../
-rw-r--r--  1 root root  7303 Dec 18 01:11 curlbuild.h
-rw-r--r--  1 root root 83928 Dec 18 01:11 curl.h
-rw-r--r--  1 root root  8934 Dec 18 01:11 curlrules.h
-rw-r--r--  1 root root  2741 Dec 18 01:11 curlver.h
-rw-r--r--  1 root root  3472 Dec 18 01:11 easy.h
-rw-r--r--  1 root root  2790 Dec 18 01:11 mprintf.h
-rw-r--r--  1 root root 13836 Dec 18 01:11 multi.h
-rw-r--r--  1 root root  1330 Dec 18 01:11 stdcheaders.h
-rw-r--r--  1 root root 36918 Dec 18 01:11 typecheck-gcc.h

How are libcurl4-openssl-dev and libcurl4-nss-dev different from each other and from these curl.h files?

i noticed the following files after i installed the two packages using apt-get in ubuntu-

/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0
/usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.la
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.a
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libcurl.pc

Now if i have a program with a line like- #include<curl/curl.h> , how do i go about compiling it?

gcc -L /usr/include/curl/ -lcurl nginx-isolated.c doesn't seem to work.

like image 511
erbdex Avatar asked Jan 16 '14 08:01

erbdex


2 Answers

When you communicate using HTTPS, FTPS or other TLS-using servers using certificates that are signed by CAs present in the store, you can be sure that the remote server really is the one it claims to be. this way you validate trust sites.

LibCurl have three flavours of TLS Backends.

  • Certificate Verification with NSS
  • Certificate Verification with OpenSSL
  • Certificate Verification with GnuTLS

The three of them are libraries for establish a secure link and validate trust CA Certificates but each library has is own features, pros and cons.

OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.

GnuTLS is a secure communications library implementing the SSL, TLS and DTLS protocols and technologies around them. It provides a simple C language application programming interface (API) to access the secure communications protocols as well as APIs to parse and write X.509, PKCS #12, and other required structures.

Network Security Services (NSS) is a set of libraries designed to support cross-platform development of security-enabled client and server applications. Applications built with NSS can support SSL v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security standards.

Something very important is that when programming you must select a single library to work with since it is not possible to combine them.

like image 153
Bayron Jonathan Vazquez Avatar answered Nov 10 '22 09:11

Bayron Jonathan Vazquez


The different libcurl4-*-dev packages are libcurl built to use different TLS backends. They all still provide (almost) the same API. They are mutually exclusive and you link with libcurl with "-lcurl" no matter which of these packages you install.

curl/curl.h is a header file and is the same no matter which TLS backend you use.

libcurl is the name of the library.

like image 24
Daniel Stenberg Avatar answered Nov 10 '22 08:11

Daniel Stenberg