\section{KSSL Class Reference}
\label{classKSSL}\index{KSSL@{KSSL}}
{\bf KDE} SSL Wrapper Class {\bf KDE} SSL Class.  


{\tt \#include $<$kssl.h$>$}

Collaboration diagram for KSSL:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=285pt]{classKSSL__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KSSL} (bool init=true)
\item 
{\bf $\sim$KSSL} ()
\item 
bool {\bf initialize} ()
\item 
bool {\bf TLSInit} ()
\item 
bool {\bf set\-Session} (const {\bf KSSLSession} $\ast$session)
\item 
void {\bf close} ()
\item 
bool {\bf re\-Initialize} ()
\item 
bool {\bf reconfig} ()
\item 
void {\bf set\-Auto\-Reconfig} (bool ar)
\item 
int {\bf seed\-With\-EGD} ()
\item 
bool {\bf set\-Settings} ({\bf KSSLSettings} $\ast$settings)
\item 
{\bf KSSLSettings} $\ast$ {\bf settings} ()
\item 
bool {\bf set\-Client\-Certificate} ({\bf KSSLPKCS12} $\ast$pkcs)
\item 
void {\bf set\-Proxy\-Use} (bool active, {\bf QString} real\-IP=QString::null, int real\-Port=0, {\bf QString} proxy=QString::null) KDE\_\-DEPRECATED
\item 
void {\bf set\-Peer\-Host} ({\bf QString} real\-Host=QString::null)
\item 
int {\bf connect} (int sock)
\item 
int {\bf accept} (int sock)
\item 
int {\bf read} (void $\ast$buf, int len)
\item 
int {\bf peek} (void $\ast$buf, int len)
\item 
int {\bf write} (const void $\ast$buf, int len)
\item 
int {\bf pending} ()
\item 
{\bf KSSLConnection\-Info} \& {\bf connection\-Info} ()
\item 
{\bf KSSLPeer\-Info} \& {\bf peer\-Info} ()
\item 
const {\bf KSSLSession} $\ast$ {\bf session} () const 
\item 
bool {\bf reusing\-Session} () const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static bool {\bf does\-SSLWork} ()
\end{CompactItemize}


\subsection{Detailed Description}
{\bf KDE} SSL Wrapper Class {\bf KDE} SSL Class. 

This class implements KDE's SSL support by wrapping Open\-SSL.

\begin{Desc}
\item[Author:]George Staikos $<${\tt staikos@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[See also:]KExtended\-Socket, TCPSlave\-Base \end{Desc}




Definition at line 42 of file kssl.h.

\subsection{Constructor \& Destructor Documentation}
\index{KSSL@{KSSL}!KSSL@{KSSL}}
\index{KSSL@{KSSL}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KSSL::KSSL (bool {\em init} = {\tt true})}\label{classKSSL_a0}


Construct a KSSL object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em init}]Set this to false if you do not want this class to immediately initialize Open\-SSL.\end{description}
\end{Desc}


Definition at line 83 of file kssl.cc.

References initialize().\index{KSSL@{KSSL}!~KSSL@{$\sim$KSSL}}
\index{~KSSL@{$\sim$KSSL}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KSSL::$\sim${\bf KSSL} ()}\label{classKSSL_a1}


Destroy this KSSL object. 

Does not close any socket.

Definition at line 97 of file kssl.cc.

References close().

\subsection{Member Function Documentation}
\index{KSSL@{KSSL}!doesSSLWork@{doesSSLWork}}
\index{doesSSLWork@{doesSSLWork}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::does\-SSLWork ()\hspace{0.3cm}{\tt  [static]}}\label{classKSSL_e0}


Determine if SSL is available and works. 

\begin{Desc}
\item[Returns:]true is SSL is available and usable\end{Desc}


Definition at line 565 of file kssl.cc.\index{KSSL@{KSSL}!initialize@{initialize}}
\index{initialize@{initialize}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::initialize ()}\label{classKSSL_a2}


Initialize Open\-SSL. 

\begin{Desc}
\item[Returns:]true on success\end{Desc}
This will do nothing if it is already initialized. \begin{Desc}
\item[See also:]{\bf re\-Initialize}{\rm (p.\,\pageref{classKSSL_a6})}\end{Desc}


Definition at line 160 of file kssl.cc.

References QString::ascii(), endl(), KSSLSettings::get\-Cipher\-List(), QString::is\-Empty(), kd\-Debug(), KSSLSettings::load(), KSSLPeer\-Info::reset(), seed\-With\-EGD(), KSSLSettings::sslv2(), and KSSLSettings::sslv3().

Referenced by KSSL(), and re\-Initialize().\index{KSSL@{KSSL}!TLSInit@{TLSInit}}
\index{TLSInit@{TLSInit}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::TLSInit ()}\label{classKSSL_a3}


This is used for applicationss which do STARTTLS or something similar. 

It creates a TLS method regardless of the user's settings.

\begin{Desc}
\item[Returns:]true if TLS is successfully initialized\end{Desc}


Definition at line 125 of file kssl.cc.

References QString::ascii(), KSSLSettings::get\-Cipher\-List(), QString::is\-Empty(), KSSLSettings::load(), seed\-With\-EGD(), and KSSLSettings::tlsv1().\index{KSSL@{KSSL}!setSession@{setSession}}
\index{setSession@{setSession}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::set\-Session (const {\bf KSSLSession} $\ast$ {\em session})}\label{classKSSL_a4}


Set an SSL session to use. 

This deep copies the session so it doesn't have to remain valid. You need to call it after calling initialize or re\-Initialize. The ID is cleared in {\bf close()}{\rm (p.\,\pageref{classKSSL_a5})}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em session}]A valid session to reuse. If 0L, it will clear the session ID in memory.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success\end{Desc}


Definition at line 206 of file kssl.cc.

References KSSLSession::\_\-session, and session().\index{KSSL@{KSSL}!close@{close}}
\index{close@{close}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSSL::close ()}\label{classKSSL_a5}


Close the SSL session. 



Definition at line 227 of file kssl.cc.

References KSSLSettings::get\-EGDPath(), QString::is\-Empty(), QString::latin1(), and KSSLSettings::use\-EFile().

Referenced by re\-Initialize(), and $\sim$KSSL().\index{KSSL@{KSSL}!reInitialize@{reInitialize}}
\index{reInitialize@{reInitialize}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::re\-Initialize ()}\label{classKSSL_a6}


Reinitialize Open\-SSL. 

\begin{Desc}
\item[Returns:]true on success\end{Desc}
This is not generally needed unless you are reusing the KSSL object for a new session. \begin{Desc}
\item[See also:]{\bf initialize}{\rm (p.\,\pageref{classKSSL_a2})}\end{Desc}


Definition at line 252 of file kssl.cc.

References close(), and initialize().

Referenced by reconfig().\index{KSSL@{KSSL}!reconfig@{reconfig}}
\index{reconfig@{reconfig}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::reconfig ()}\label{classKSSL_a7}


Trigger a reread of KSSL configuration and {\bf re\-Initialize()}{\rm (p.\,\pageref{classKSSL_a6})} KSSL. 

\begin{Desc}
\item[Returns:]true on successful reinitalizations\end{Desc}
If you {\bf set\-Auto\-Reconfig()}{\rm (p.\,\pageref{classKSSL_a8})} to false, then this will simply {\bf re\-Initialize()}{\rm (p.\,\pageref{classKSSL_a6})} and not read in the new configuration. \begin{Desc}
\item[See also:]{\bf set\-Auto\-Reconfig}{\rm (p.\,\pageref{classKSSL_a8})}\end{Desc}


Definition at line 542 of file kssl.cc.

References re\-Initialize().

Referenced by set\-Settings().\index{KSSL@{KSSL}!setAutoReconfig@{setAutoReconfig}}
\index{setAutoReconfig@{setAutoReconfig}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSSL::set\-Auto\-Reconfig (bool {\em ar})}\label{classKSSL_a8}


Enable or disable automatic reconfiguration on {\bf initialize()}{\rm (p.\,\pageref{classKSSL_a2})}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ar}]Set to false in order to disable auto-reloading of the KSSL configuration during {\bf initialize()}{\rm (p.\,\pageref{classKSSL_a2})}.\end{description}
\end{Desc}
By default, KSSL will read its configuration on {\bf initialize()}{\rm (p.\,\pageref{classKSSL_a2})}. You might want to disable this for performance reasons.

Definition at line 547 of file kssl.cc.\index{KSSL@{KSSL}!seedWithEGD@{seedWithEGD}}
\index{seedWithEGD@{seedWithEGD}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::seed\-With\-EGD ()}\label{classKSSL_a9}


This will reseed the pseudo-random number generator with the EGD (entropy gathering daemon) if the EGD is configured and enabled. 

You don't need to call this yourself normally.

\begin{Desc}
\item[Returns:]0 on success\end{Desc}


Definition at line 104 of file kssl.cc.

References endl(), KSSLSettings::get\-EGDPath(), QString::is\-Empty(), kd\-Debug(), QString::latin1(), KSSLSettings::use\-EFile(), and KSSLSettings::use\-EGD().

Referenced by initialize(), and TLSInit().\index{KSSL@{KSSL}!setSettings@{setSettings}}
\index{setSettings@{setSettings}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::set\-Settings ({\bf KSSLSettings} $\ast$ {\em settings})}\label{classKSSL_a10}


Set a new {\bf KSSLSettings}{\rm (p.\,\pageref{classKSSLSettings})} instance as the settings. 

This deletes the current instance of {\bf KSSLSettings}{\rm (p.\,\pageref{classKSSLSettings})}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em settings}]A new, valid settings object.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success\end{Desc}


Definition at line 552 of file kssl.cc.

References reconfig(), and settings().\index{KSSL@{KSSL}!settings@{settings}}
\index{settings@{settings}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSSLSettings}$\ast$ KSSL::settings ()\hspace{0.3cm}{\tt  [inline]}}\label{classKSSL_a11}


One is built by the constructor, so this will only return a NULL pointer if you set one with {\bf set\-Settings()}{\rm (p.\,\pageref{classKSSL_a10})}. 

\begin{Desc}
\item[Returns:]the current settings instance\end{Desc}


Definition at line 159 of file kssl.h.

Referenced by set\-Settings().\index{KSSL@{KSSL}!setClientCertificate@{setClientCertificate}}
\index{setClientCertificate@{setClientCertificate}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::set\-Client\-Certificate ({\bf KSSLPKCS12} $\ast$ {\em pkcs})}\label{classKSSL_a12}


Use this to set the certificate to send to the server. 

Do NOT delete the {\bf KSSLPKCS12}{\rm (p.\,\pageref{classKSSLPKCS12})} object until you are done with the session. It is not defined when KSSL will be done with this.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pkcs}]the valid PKCS\#12 object to send.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the certificate was properly set to the session.\end{Desc}


Definition at line 627 of file kssl.cc.

References endl(), and kd\-Debug().\index{KSSL@{KSSL}!setProxyUse@{setProxyUse}}
\index{setProxyUse@{setProxyUse}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSSL::set\-Proxy\-Use (bool {\em active}, {\bf QString} {\em real\-IP} = {\tt QString::null}, int {\em real\-Port} = {\tt 0}, {\bf QString} {\em proxy} = {\tt QString::null})}\label{classKSSL_a13}


Set the status of the connection with respect to proxies. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em real\-IP}]is the IP address of the host you're connecting to \item[{\em real\-Port}]is the port of the host you're connecting to \item[{\em proxy}]is the IP or hostname of the proxy server \end{description}
\end{Desc}
\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}


Definition at line 618 of file kssl.cc.\index{KSSL@{KSSL}!setPeerHost@{setPeerHost}}
\index{setPeerHost@{setPeerHost}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSSL::set\-Peer\-Host ({\bf QString} {\em real\-Host} = {\tt QString::null})}\label{classKSSL_a14}


Set the peer hostname to be used for certificate verification. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em real\-Host}]the remote hostname as the user believes to be connecting to\end{description}
\end{Desc}


Definition at line 613 of file kssl.cc.\index{KSSL@{KSSL}!connect@{connect}}
\index{connect@{connect}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::connect (int {\em sock})}\label{classKSSL_a15}


Connect the SSL session to the remote host using the provided socket descriptor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]the socket descriptor to connect with. This must be an already connected socket. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 on success, 0 on error setting the file descriptor, -1 on other error.\end{Desc}


Definition at line 358 of file kssl.cc.

References endl(), and kd\-Debug().\index{KSSL@{KSSL}!accept@{accept}}
\index{accept@{accept}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::accept (int {\em sock})}\label{classKSSL_a16}


Connect the SSL session to the remote host using the provided socket descriptor. 

This is for use with an SSL server application.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]the socket descriptor to connect with. This must be an already connected socket. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 on success, 0 on error setting the file descriptor, -1 on other error.\end{Desc}


Definition at line 272 of file kssl.cc.

References endl(), and kd\-Debug().\index{KSSL@{KSSL}!read@{read}}
\index{read@{read}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::read (void $\ast$ {\em buf}, int {\em len})}\label{classKSSL_a17}


Read data from the remote host via SSL. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buf}]the buffer to read the data into. \item[{\em len}]the maximum length of data to read. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of bytes read, 0 on an exception, or -1 on error.\end{Desc}


Definition at line 476 of file kssl.cc.

References endl(), and kd\-Debug().\index{KSSL@{KSSL}!peek@{peek}}
\index{peek@{peek}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::peek (void $\ast$ {\em buf}, int {\em len})}\label{classKSSL_a18}


Peek at available data from the remote host via SSL. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buf}]the buffer to read the data into. \item[{\em len}]the maximum length of data to read. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of bytes read, 0 on an exception, or -1 on error.\end{Desc}


Definition at line 464 of file kssl.cc.\index{KSSL@{KSSL}!write@{write}}
\index{write@{write}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::write (const void $\ast$ {\em buf}, int {\em len})}\label{classKSSL_a19}


Write data to the remote host via SSL. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buf}]the buffer to read the data from. \item[{\em len}]the length of data to send from the buffer. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of bytes written, 0 on an exception, or -1 on error.\end{Desc}


Definition at line 514 of file kssl.cc.

References endl(), and kd\-Debug().\index{KSSL@{KSSL}!pending@{pending}}
\index{pending@{pending}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSSL::pending ()}\label{classKSSL_a20}


Determine if data is waiting to be read. 

\begin{Desc}
\item[Returns:]-1 on error, 0 if no data is waiting, $>$ 0 if data is waiting.\end{Desc}


Definition at line 453 of file kssl.cc.\index{KSSL@{KSSL}!connectionInfo@{connectionInfo}}
\index{connectionInfo@{connectionInfo}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSSLConnection\-Info} \& KSSL::connection\-Info ()}\label{classKSSL_a21}


Obtain a reference to the connection information. 

\begin{Desc}
\item[Returns:]a reference to the connection information, valid after connected \end{Desc}
\begin{Desc}
\item[See also:]{\bf KSSLConnection\-Info}{\rm (p.\,\pageref{classKSSLConnectionInfo})}\end{Desc}


Definition at line 607 of file kssl.cc.\index{KSSL@{KSSL}!peerInfo@{peerInfo}}
\index{peerInfo@{peerInfo}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSSLPeer\-Info} \& KSSL::peer\-Info ()}\label{classKSSL_a22}


Obtain a reference to the information about the peer. 

\begin{Desc}
\item[Returns:]a reference to the peer information, valid after connected \end{Desc}
\begin{Desc}
\item[See also:]{\bf KSSLPeer\-Info}{\rm (p.\,\pageref{classKSSLPeerInfo})}\end{Desc}


Definition at line 622 of file kssl.cc.\index{KSSL@{KSSL}!session@{session}}
\index{session@{session}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf KSSLSession} $\ast$ KSSL::session () const}\label{classKSSL_a23}


Obtain a pointer to the session information. 

\begin{Desc}
\item[Returns:]a pointer to the session information. This is valid after connected, while connected. It is deleted by the KSSL object which returns it. May return 0L if no valid session exists. \end{Desc}
\begin{Desc}
\item[See also:]{\bf KSSLSession}{\rm (p.\,\pageref{classKSSLSession})}\end{Desc}


Definition at line 661 of file kssl.cc.

Referenced by set\-Session().\index{KSSL@{KSSL}!reusingSession@{reusingSession}}
\index{reusingSession@{reusingSession}!KSSL@{KSSL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSSL::reusing\-Session () const}\label{classKSSL_a24}


Determine if we are currently reusing an SSL session ID. 

\begin{Desc}
\item[Returns:]true if we are reusing a session ID.\end{Desc}


Definition at line 665 of file kssl.cc.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kssl.h\item 
kssl.cc\end{CompactItemize}
