我正在查看 Boost 的SSL Client。评论中有对 OpenSSL 的引用(抱歉,没有行号):
// The verify callback can be used to check whether the certificate that is
// being presented is valid for the peer. For example, RFC 2818 describes
// the steps involved in doing this for HTTPS. Consult the OpenSSL
// documentation for more details. Note that the callback is called once
// for each certificate in the certificate chain, starting from the root
// certificate authority.
正确使用和验证 OpenSSL 可能很棘手。根据经验,我知道我必须执行以下操作才能正确使用该库:
- 在 Context 对象上禁用 SSLv2、SSLv3 和压缩
- 为链的构建和检查提供适当的根证书
- 调用
SSL_get_peer_certificate
并验证证书是非空的 - 调用
SSL_get_verify_result
并验证结果是X509_V_OK
- 执行名称匹配(CN 或 SAN 必须匹配请求的主机)
OpenSSL 1.1.0 将提供名称检查,但目前仅在 HEAD 中。从OpenSSL 更改日志:
Integrate hostname, email address and IP address checking with certificate
verification. New verify options supporting checking in opensl utility.
和:
New functions to check a hostname email or IP address against a
certificate. Add options x509 utility to print results of checks against
a certificate.
我看不到 Boost 在哪里执行客户端代码中的任何配置或检查。
Boost 究竟在配置什么,asio
在使用 SSL 时它在其库组件中检查或验证什么?