20 #include <openssl/ssl.h>
41 Error(
"WrapWithSSL",
"the context could not be created");
46 Error(
"WrapWithSSL",
"could not set the CA file and/or the CA path");
51 Error(
"WrapWithSSL",
"could not set the client certificate");
56 Error(
"WrapWithSSL",
"could not set the client private key");
62 Error(
"WrapWithSSL",
"cannot create the ssl struct");
68 Error(
"WrapWithSSL",
"cannot bind to the socket %d",
fSocket);
74 Error(
"WrapWithSSL",
"cannot connect");
92 :
TSocket(addr, service, tcpwindowsize)
100 :
TSocket(addr, port, tcpwindowsize)
108 :
TSocket(host, service, tcpwindowsize)
116 :
TSocket(url, port, tcpwindowsize)
175 const char *ucert,
const char *ukey)
191 Error(
"Recv",
"not implemented");
203 if (length == 0)
return 0;
214 n = SSL_peek(
fSSL, (
char*)buffer + offset, (
int)remain);
216 n =
SSL_read(
fSSL, (
char*)buffer + offset, (
int)remain);
220 Error(
"RecvRaw",
"failed to read from the socket");
225 SSL_set_quiet_shutdown(
fSSL, 1);
238 if (opt ==
kPeek)
return n;
256 Error(
"Send",
"not implemented");
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
#define SSL_CTX_use_certificate_chain_file
static char fgSSLCAPath[]
This class represents an Internet Protocol (IP) address.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Int_t Send(const TMessage &mess)
Send a TMessage object.
#define SSL_CTX_use_PrivateKey_file
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
ClassImp(TSSLSocket) TSSLSocket
virtual void Close(Option_t *opt="")
Close the socket.
Double_t length(const TVector2 &v)
static void SetUpSSL(const char *cafile, const char *capath, const char *ucert, const char *ukey)
Set up the static configuration variables.
void Close(Option_t *option="")
Close the SSL connection.
void WrapWithSSL()
Wraps the socket with OpenSSL.
static ULong64_t fgBytesSent
static ULong64_t fgBytesRecv
static void ResetErrno()
Static function resetting system error number.
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
static char fgSSLCAFile[]
virtual ~TSSLSocket()
Close gracefully the connection, and free SSL structures.