<分区>
我正在用 C++ 编写一个“终端”,客户端可以使用 SSL 连接到该终端以加密连接。我使用 Boost::asio
来处理套接字和 SSL。
我正在这样启动 SSL-Context:
boost::asio::ssl::context context_(io_service_, boost::asio::ssl::context::tlsv1);
如您所见,我将 SSL 版本设置为 TLSv1
。
这是上下文选项:
context_.set_options(boost::asio::ssl::context::default_workarounds
| boost::asio::ssl::context::no_sslv2
| boost::asio::ssl::context::single_dh_use);
context_.use_certificate_chain_file("CERTS/server.crt");
context_.use_private_key_file("CERTS/server.key", boost::asio::ssl::context::pem);
context_.use_tmp_dh_file("CERTS/dh512.pem");
当我现在使用 openssl s_client -connect localhost:8000 -tls1
连接到我的服务器时,握手在服务器端失败并出现错误:
“sslv3 警报握手失败”
另外,我注意到客户端有一条奇怪的线:
“140030998197920:error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small:s3_clnt.c:3329:”
这是什么意思?我创建证书时是否犯了错误?我完全按照 the answer to this question 中的描述进行了操作.