24 #include <ksslconfig.h> 30 #include <netinet/in.h> 31 #include <sys/socket.h> 32 #define crypt _openssl_crypt 33 #include <openssl/ssl.h> 34 #include <openssl/x509.h> 35 #include <openssl/x509v3.h> 36 #include <openssl/pem.h> 37 #include <openssl/rand.h> 49 #include <QtNetwork/QAbstractSocket> 54 #warning "kssl.cc contains temporary functions! Clean up" 55 #warning "kssl.cc needs to be ported to QSslSocket" 80 m_bAutoReconfig =
true;
101 if (m_cfg->useEGD() && !m_cfg->getEGDPath().isEmpty()) {
102 rc = d->kossl->RAND_egd(m_cfg->getEGDPath().toLatin1().constData());
104 kDebug(7029) <<
"KSSL: Error seeding PRNG with the EGD.";
105 else kDebug(7029) <<
"KSSL: PRNG was seeded with " << rc
106 <<
" bytes from the EGD." << endl;
107 }
else if (m_cfg->useEFile() && !m_cfg->getEGDPath().isEmpty()) {
108 rc = d->kossl->RAND_load_file(m_cfg->getEGDPath().toLatin1().constData(), -1);
110 kDebug(7029) <<
"KSSL: Error seeding PRNG with the entropy file.";
111 else kDebug(7029) <<
"KSSL: PRNG was seeded with " << rc
112 <<
" bytes from the entropy file." << endl;
121 kDebug(7029) <<
"KSSL initialize";
130 d->m_meth = d->kossl->SSLv23_client_method();
131 d->m_ctx = d->kossl->SSL_CTX_new(d->m_meth);
132 if (d->m_ctx == 0L) {
137 QString clist = m_cfg->getCipherList();
138 kDebug(7029) <<
"Cipher list: " << clist;
139 if (!clist.isEmpty())
140 d->kossl->SSL_CTX_set_cipher_list(d->m_ctx, const_cast<char *>(clist.toLatin1().constData()));
157 d->kossl->SSL_shutdown(d->m_ssl);
158 d->kossl->SSL_free(d->m_ssl);
162 d->kossl->SSL_CTX_free(d->m_ctx);
163 if (m_cfg->useEFile() && !m_cfg->getEGDPath().isEmpty()) {
164 d->kossl->RAND_write_file(m_cfg->getEGDPath().toLatin1().constData());
182 return reInitialize();
187 m_bAutoReconfig = ar;
204 bool KSSL::m_bSSLWorks =
true;
206 bool KSSL::m_bSSLWorks =
false;
bool reconfig()
Trigger a reread of KSSL configuration and reInitialize() KSSL.
int seedWithEGD()
This will reseed the pseudo-random number generator with the EGD (entropy gathering daemon) if the EG...
bool initialize()
Initialize OpenSSL.
KSSLSettings * settings()
One is built by the constructor, so this will only return a NULL pointer if you set one with setSetti...
KSSL(bool init=true)
Construct a KSSL object.
~KSSL()
Destroy this KSSL object.
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KSSLValidation
Result of the validate() call.
static bool doesSSLWork()
Determine if SSL is available and works.
void setAutoReconfig(bool ar)
Enable or disable automatic reconfiguration on initialize().
bool setSettings(KSSLSettings *settings)
Set a new KSSLSettings instance as the settings.
void close()
Close the SSL session.
KAction * close(const QObject *recvr, const char *slot, QObject *parent)
static KOpenSSLProxy * self()
Return an instance of class KOpenSSLProxy * You cannot delete this object.
bool reInitialize()
Reinitialize OpenSSL.