4 #ifndef _libiqnet_ssl_lib_h_
5 #define _libiqnet_ssl_lib_h_
7 #include "api_export.h"
9 #include <openssl/ssl.h>
10 #include <boost/shared_ptr.hpp>
23 extern LIBIQXMLRPC_API Ctx* ctx;
26 void LIBIQXMLRPC_API throw_io_exception( SSL*,
int ret );
32 int verify(
bool preverified_ok, X509_STORE_CTX*)
const;
35 std::string cert_finger_sha256(X509_STORE_CTX*)
const;
38 virtual int do_verify(
bool preverified_ok, X509_STORE_CTX*)
const = 0;
49 class LIBIQXMLRPC_API
Ctx {
51 static Ctx* client_server(
const std::string& cert_path,
const std::string& key_path );
52 static Ctx* server_only(
const std::string& cert_path,
const std::string& key_path );
53 static Ctx* client_only();
61 void prepare_verify(SSL*,
bool server);
64 Ctx(
const std::string&,
const std::string&,
bool init_client );
68 boost::shared_ptr<Impl> impl_;
72 #pragma warning(disable: 4251)
76 class LIBIQXMLRPC_API
exception:
public std::exception {
77 unsigned long ssl_err;
82 explicit exception(
unsigned long ssl_err )
throw();
83 exception(
const std::string& msg )
throw();
86 const char* what()
const throw() {
return msg.c_str(); }
87 unsigned long code()
const throw() {
return ssl_err; }
93 exception(
"Libiqnet::ssl not initialized." ) {}
100 exception(
"Connection has been closed." ),
103 bool is_clean()
const {
return clean; }
Object-oriented networking/multithreading infrastructure.
Definition: acceptor.h:11
SSL context class. Initializes SSL library.
Definition: ssl_lib.h:49
Definition: ssl_lib.h:112
Definition: ssl_lib.h:118
Exception class to wrap errors generated by openssl library.
Definition: ssl_lib.h:76
Definition: ssl_lib.h:106