简体   繁体   English

curl/curl.h、libcurl、libcurl4-openssl-dev、libcurl4-nss-dev 库之间的区别?

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

i had the following curl headers, and i still could install the libcurl4 packages mentioned above-我有以下 curl 标头,我仍然可以安装上面提到的 libcurl4 包-

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? libcurl4-openssl-devlibcurl4-nss-dev彼此之间以及与这些 curl.h 文件有何不同?

i noticed the following files after i installed the two packages using apt-get in ubuntu-在 ubuntu 中使用 apt-get 安装这两个软件包后,我注意到以下文件-

/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?现在,如果我有一个像 - #include<curl/curl.h>这样的程序,我该如何编译它?

gcc -L /usr/include/curl/ -lcurl nginx-isolated.c doesn't seem to work. gcc -L /usr/include/curl/ -lcurl nginx-isolated.c似乎不起作用。

The different libcurl4- * -dev packages are libcurl built to use different TLS backends.不同的 libcurl4- * -dev 包是为使用不同的 TLS 后端而构建的 libcurl。 They all still provide (almost) the same API.它们仍然提供(几乎)相同的 API。 They are mutually exclusive and you link with libcurl with "-lcurl" no matter which of these packages you install.它们是相互排斥的,无论您安装这些软件包中的哪一个,您都可以使用“-lcurl”与 libcurl 链接。

curl/curl.h is a header file and is the same no matter which TLS backend you use. curl/curl.h 是一个头文件,无论您使用哪个 TLS 后端都是相同的。

libcurl is the name of the library. libcurl 是库的名称。

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.当您使用 HTTPS、FTPS 或其他使用 TLS 的服务器使用存储中存在的 CA 签名的证书进行通信时,您可以确定远程服务器确实是它声称的那样。 this way you validate trust sites.这样您就可以验证信任站点。

LibCurl have three flavours of TLS Backends. LibCurl 具有三种风格的 TLS 后端。

  • Certificate Verification with NSS使用 NSS 进行证书验证
  • Certificate Verification with OpenSSL使用 OpenSSL 进行证书验证
  • Certificate Verification with GnuTLS使用 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.他们三个是用于建立安全链接和验证信任 CA 证书的库,但每个库都有自己的特点、优点和缺点。

OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. OpenSSL是用于传输层安全性 (TLS) 和安全套接字层 (SSL) 协议的强大、商业级和功能齐全的工具包。 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. GnuTLS是一个安全通信库,实现了 SSL、TLS 和 DTLS 协议和围绕它们的技术。 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.它提供了一个简单的 C 语言应用程序编程接口 (API) 来访问安全通信协议以及用于解析和编写 X.509、PKCS #12 和其他所需结构的 API。

Network Security Services (NSS) is a set of libraries designed to support cross-platform development of security-enabled client and server applications.网络安全服务(NSS)是一组库,旨在支持启用安全的客户端和服务器应用程序的跨平台开发。 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.使用 NSS 构建的应用程序可以支持 SSL v3、TLS、PKCS #5、PKCS #7、PKCS #11、PKCS #12、S/MIME、X.509 v3 证书和其他安全标准。

Something very important is that when programming you must select a single library to work with since it is not possible to combine them.非常重要的一点是,在编程时您必须选择一个单独的库来使用,因为不可能将它们组合起来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM