ServerCore/TLS.h
2025-01-28 16:26:40 -08:00

68 lines
1.3 KiB
C++

#ifndef __TLS_h__
#define __TLS_h__
#include "ZString.h"
#include "TLSInfo.h"
#include <openssl/ssl.h>
namespace core {
///
/// TLS
///
/// This object provides the support methods to handle TLS on the server core and
/// session environment.
///
class TLS {
public:
///
///
///
TLS();
///
/// Use this constructor when the SSL context needs to be created as when opening
/// a server TCPSocket.
///
TLS(TLSInfo *tlsInfo);
///
/// Use this constructor on creation of a new TCPSocket that needs access to
/// the generating server's SSL context.
///
TLS(SSL_CTX *ctx);
///
/// The destructor for this object.
///
~TLS();
void createContext(TLSInfo *tlsInfo);
SSL_CTX *ctx;
protected:
void receiveData(coreutils::ZString &buffer);
void registerSocket(int fd);
void acceptSocket();
private:
char *sip_cacert = (char *)"../testkeys/certs/pbxca.crt";
char *sip_cert = (char *)"../testkeys/certs/pbxserver.crt";
char *sip_key = (char *)"../testkeys/certs/pbxserver.key";
bool initialized = false;
SSL *ssl;
};
}
#endif