| 1936 | }; |
| 1937 | |
| 1938 | class SSLClient final : public ClientImpl { |
| 1939 | public: |
| 1940 | explicit SSLClient(const std::string &host); |
| 1941 | |
| 1942 | explicit SSLClient(const std::string &host, int port); |
| 1943 | |
| 1944 | explicit SSLClient(const std::string &host, int port, |
| 1945 | const std::string &client_cert_path, |
| 1946 | const std::string &client_key_path, |
| 1947 | const std::string &private_key_password = std::string()); |
| 1948 | |
| 1949 | explicit SSLClient(const std::string &host, int port, X509 *client_cert, |
| 1950 | EVP_PKEY *client_key, |
| 1951 | const std::string &private_key_password = std::string()); |
| 1952 | |
| 1953 | ~SSLClient() override; |
| 1954 | |
| 1955 | bool is_valid() const override; |
| 1956 | |
| 1957 | void set_ca_cert_store(X509_STORE *ca_cert_store); |
| 1958 | void load_ca_cert_store(const char *ca_cert, std::size_t size); |
| 1959 | |
| 1960 | long get_openssl_verify_result() const; |
| 1961 | |
| 1962 | SSL_CTX *ssl_context() const; |
| 1963 | |
| 1964 | private: |
| 1965 | bool create_and_connect_socket(Socket &socket, Error &error) override; |
| 1966 | void shutdown_ssl(Socket &socket, bool shutdown_gracefully) override; |
| 1967 | void shutdown_ssl_impl(Socket &socket, bool shutdown_gracefully); |
| 1968 | |
| 1969 | bool process_socket(const Socket &socket, |
| 1970 | std::function<bool(Stream &strm)> callback) override; |
| 1971 | bool is_ssl() const override; |
| 1972 | |
| 1973 | bool connect_with_proxy(Socket &sock, Response &res, bool &success, |
| 1974 | Error &error); |
| 1975 | bool initialize_ssl(Socket &socket, Error &error); |
| 1976 | |
| 1977 | bool load_certs(); |
| 1978 | |
| 1979 | bool verify_host(X509 *server_cert) const; |
| 1980 | bool verify_host_with_subject_alt_name(X509 *server_cert) const; |
| 1981 | bool verify_host_with_common_name(X509 *server_cert) const; |
| 1982 | bool check_host_name(const char *pattern, size_t pattern_len) const; |
| 1983 | |
| 1984 | SSL_CTX *ctx_; |
| 1985 | std::mutex ctx_mutex_; |
| 1986 | std::once_flag initialize_cert_; |
| 1987 | |
| 1988 | std::vector<std::string> host_components_; |
| 1989 | |
| 1990 | long verify_result_ = 0; |
| 1991 | |
| 1992 | friend class ClientImpl; |
| 1993 | }; |
| 1994 | #endif |
| 1995 |
nothing calls this directly
no outgoing calls
no test coverage detected