1234567891011121314151617181920212223242526272829303132 |
- #pragma once
- #ifdef USE_MITM
- #include "IBBS2chProxySocket.h"
- #ifdef USE_GNUTLS
- #include <gnutls/gnutls.h>
- #else
- #include <openssl/ssl.h>
- #endif
- class BBS2chProxySecureSocket : public IBBS2chProxySocket {
- public:
- BBS2chProxySecureSocket(int sock, const char *host);
- ~BBS2chProxySecureSocket();
- static int initializeCerts(const char *certPath, const char *keyPath);
- static void generateAndPrintSelfSignedCertificate(void);
- virtual int read(char *buffer, int length);
- virtual int readLine(char *buffer, int maxLength);
- virtual int write(const char *buffer, int length);
- virtual int writeString(const std::string &str);
- virtual void close(void);
- private:
- int socket;
- #ifdef USE_GNUTLS
- gnutls_session_t session;
- gnutls_certificate_credentials_t x509_cred;
- #else
- SSL_CTX *ctx;
- SSL *ssl;
- #endif
- };
- #endif
|