寻找高级 C++ SSL 库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4236526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 14:54:23  来源:igfitidea点击:

Looking for a High Level C++ SSL Library

c++ssl

提问by Josh Renwald

I checked out quite a few SSL librarys tonight. OpenSSL looks good but lacks documentation, as most of them do. I thought I hit the Hymanpot when I found NetSieben's SSL C++ Library (http://www.netsieben.com/products/ssh/index.phtml) but after hours, I am unable to get it to compile. It says it needs Botan's lib, but absolutely no information how to link it to Botan or anything.

今晚我检查了很多 SSL 库。OpenSSL 看起来不错,但缺乏文档,就像大多数人一样。当我找到 NetSieben 的 SSL C++ 库 (http://www.netsieben.com/products/ssh/index.phtml) 时,我以为我中了大奖,但几个小时后,我无法编译它。它说它需要 Botan 的库,但绝对没有信息如何将它链接到 Botan 或任何东西。

So I am looking for a fairly easy to use SSL library. I am just using it for a client application to connect to an already existing server.

所以我正在寻找一个相当容易使用的 SSL 库。我只是将它用于客户端应用程序以连接到现有的服务器。

采纳答案by Larry

You might like CyaSSL, which is another SSL implementation. You can download it at http://www.yassl.com.

您可能喜欢 CyaSSL,它是另一种 SSL 实现。您可以在http://www.yassl.com下载它。

回答by David R.

To give a more thorough answer: There are a number of SSL libraries that are better documented than OpenSSL, which is notoriously bad.

给出一个更彻底的答案:有许多 SSL 库比 OpenSSL 有更好的文档记录,后者是出了名的糟糕。

If you look at the grand picture, the real alternatives as an SSL library are Botan, PolarSSL, Mozilla NSS, Wolfand GnuTLS.

纵观全局,SSL 库的真正替代品是BotanPolarSSLMozilla NSSWolf和 GnuTLS。

All except Botan are not C++ specific so they do not have nice C++ objects and resource management.

除了 Botan 之外,所有的都不是 C++ 特定的,所以它们没有很好的 C++ 对象和资源管理。

My personalpreference for SSL library is PolarSSL, because of the readability of the code, in-header API documentation and just general good experiences with it. It is used in some large FOSS projects and they have some kind of government accreditation.

个人对 SSL 库的偏好是 PolarSSL,因为代码的可读性、头内 API 文档以及使用它的一般良好体验。它被用于一些大型的 FOSS 项目并且他们有某种政府认证

I'm not a real fan of the wrappers like Boost.Asioas they still lack the proper documentation for the more in depth things. Boost.Asio itself is quiet ok and the examples are pretty decent though. If you only need a simple client, this might be the way to go.

我不是像Boost.Asio这样的包装器的真正粉丝,因为它们仍然缺乏用于更深入事物的适当文档。Boost.Asio 本身很安静,但示例相当不错。如果您只需要一个简单的客户端,这可能是要走的路。

Mozilla NSS is one of the older ones, but it does not support the newer TLS 1.1 and TLS 1.2 standards, which they actually should.

Mozilla NSS 是较旧的标准之一,但它不支持较新的 TLS 1.1 和 TLS 1.2 标准,而它们实际上应该支持。

Both Botan and CyaSSL are good alternatives too. Botan documentation is thorough on some parts and perhaps a bit lacking on other parts, but some large open source projects include Botan and have good experiences with it.

Botan 和 CyaSSL 也是不错的选择。Botan 文档在某些方面很全面,在其他方面可能有点欠缺,但是一些大型开源项目包括 Botan 并且有很好的使用经验。

In general, you can do a lot better than OpenSSL with any of these.

一般来说,使用其中任何一个,您都可以比 OpenSSL 做得更好。

Hope this helps!

希望这可以帮助!

回答by Sam Miller

Boost.Asioprovides SSL capabilities by wrappering OpenSSL. The examplesare fairly straightforward, for client-code it looks something like this

Boost.Asio通过包装 OpenSSL 来提供 SSL 功能。这些示例相当简单,对于客户端代码,它看起来像这样

ssl::context ctx(my_io_service, ssl::context::sslv23);
ctx.set_verify_mode(ssl::context::verify_peer);
ctx.load_verify_file("ca.pem");

ssl::stream<ip::tcp::socket> ssl_sock(my_io_service, ctx);
ip::tcp::socket::lowest_layer_type& sock = ssl_sock.lowest_layer();
sock.connect(my_endpoint);
sock.handshake();
sock.write(...);

note there are asynchronous methods async_connectand async_handshakeand async_writetoo.

请注意,还有异步方法async_connectasync_handshake等等async_write

回答by Paul

For a simple well-documented SSL library, you could look at https://polarssl.org.

对于一个简单的有据可查的 SSL 库,您可以查看https://polarssl.org

PolarSSL has full API documentationand example clients on its source page.

PolarSSL在其源页面上有完整的API 文档和示例客户端。

Disclaimer:I'm the lead-maintainer for PolarSSL

免责声明:我是 PolarSSL 的主要维护者

回答by wkl

Mozilla NSSis a relatively better documented set of libraries.

Mozilla NSS是一组文档相对较好的库。