• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/kssl
 

tdeio/kssl

  • tdeio
  • kssl
kssl.cpp
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 
25 // this hack provided by Malte Starostik to avoid glibc/openssl bug
26 // on some systems
27 #ifdef KSSL_HAVE_SSL
28 #include <unistd.h>
29 #include <netinet/in.h>
30 #include <sys/socket.h>
31 #define crypt _openssl_crypt
32 #include <openssl/ssl.h>
33 #include <openssl/x509.h>
34 #include <openssl/x509v3.h>
35 #include <openssl/pem.h>
36 #include <openssl/rand.h>
37 #undef crypt
38 #endif
39 
40 #include "kssl.h"
41 
42 #include <kdebug.h>
43 #include <kstandarddirs.h>
44 #include <ksock.h>
45 #include <ksockaddr.h>
46 
47 #include <kopenssl.h>
48 #include <ksslx509v3.h>
49 #include <ksslpkcs12.h>
50 #include <ksslsession.h>
51 #include <tdelocale.h>
52 #include <ksocks.h>
53 
54 
55 class KSSLPrivate {
56 public:
57  KSSLPrivate() {
58  lastInitTLS = false;
59  kossl = KOpenSSLProxy::self();
60  session = 0L;
61  }
62 
63  ~KSSLPrivate() {
64  delete session;
65  session = 0L;
66  }
67 
68  bool lastInitTLS;
69  KSSLCertificate::KSSLValidation m_cert_vfy_res;
70  TQString proxyPeer;
71 
72 #ifdef KSSL_HAVE_SSL
73  SSL *m_ssl;
74  SSL_CTX *m_ctx;
75  SSL_METHOD *m_meth;
76 #endif
77  KSSLSession *session;
78  KOSSL *kossl;
79 };
80 
81 
82 KSSL::KSSL(bool init) {
83  d = new KSSLPrivate;
84  m_bInit = false;
85  m_bAutoReconfig = true;
86  m_cfg = new KSSLSettings();
87 #ifdef KSSL_HAVE_SSL
88  d->m_ssl = 0L;
89 #endif
90 
91  if (init)
92  initialize();
93 }
94 
95 
96 KSSL::~KSSL() {
97  close();
98  delete m_cfg;
99  delete d;
100 }
101 
102 
103 int KSSL::seedWithEGD() {
104 int rc = 0;
105 #ifdef KSSL_HAVE_SSL
106  if (m_cfg->useEGD() && !m_cfg->getEGDPath().isEmpty()) {
107  rc = d->kossl->RAND_egd(m_cfg->getEGDPath().latin1());
108  if (rc < 0)
109  kdDebug(7029) << "KSSL: Error seeding PRNG with the EGD." << endl;
110  else kdDebug(7029) << "KSSL: PRNG was seeded with " << rc
111  << " bytes from the EGD." << endl;
112  } else if (m_cfg->useEFile() && !m_cfg->getEGDPath().isEmpty()) {
113  rc = d->kossl->RAND_load_file(m_cfg->getEGDPath().latin1(), -1);
114  if (rc < 0)
115  kdDebug(7029) << "KSSL: Error seeding PRNG with the entropy file." << endl;
116  else kdDebug(7029) << "KSSL: PRNG was seeded with " << rc
117  << " bytes from the entropy file." << endl;
118  }
119 #endif
120 return rc;
121 }
122 
123 
124 bool KSSL::TLSInit() {
125 #ifdef KSSL_HAVE_SSL
126 // kdDebug(7029) << "KSSL TLS initialize" << endl;
127  if (m_bInit)
128  return false;
129 
130  if (m_bAutoReconfig)
131  m_cfg->load();
132 
133  if (!m_cfg->tlsv1())
134  return false;
135 
136  seedWithEGD();
137  d->m_meth = d->kossl->TLS_client_method();
138  d->lastInitTLS = true;
139 
140  m_pi.reset();
141 
142  d->m_ctx = d->kossl->SSL_CTX_new(d->m_meth);
143  if (d->m_ctx == 0L) {
144  return false;
145  }
146 
147  // set cipher list
148  TQString clist = m_cfg->getCipherList();
149  //kdDebug(7029) << "Cipher list: " << clist << endl;
150  if (!clist.isEmpty())
151  d->kossl->SSL_CTX_set_cipher_list(d->m_ctx, const_cast<char *>(clist.ascii()));
152 
153  m_bInit = true;
154 return true;
155 #else
156 return false;
157 #endif
158 }
159 
160 
161 bool KSSL::initialize() {
162 #ifdef KSSL_HAVE_SSL
163  kdDebug(7029) << "KSSL initialize" << endl;
164  if (m_bInit)
165  return false;
166 
167  if (m_bAutoReconfig)
168  m_cfg->load();
169 
170  seedWithEGD();
171  // FIXME: we should be able to force SSL off entirely.
172  d->lastInitTLS = false;
173 
174  m_pi.reset();
175 
176  if (m_cfg->tlsv1() || (m_cfg->sslv3() && m_cfg->sslv2())) {
177  d->m_meth = d->kossl->TLS_client_method();
178  }
179  else if (m_cfg->sslv3()) {
180  d->m_meth = d->kossl->SSLv3_client_method();
181  }
182  else if (m_cfg->sslv2()) {
183  d->m_meth = d->kossl->SSLv2_client_method();
184  }
185 
186 /*
187 if (m_cfg->sslv2() && m_cfg->sslv3()) kdDebug(7029) << "Double method" << endl;
188 else if (m_cfg->sslv2()) kdDebug(7029) << "SSL2 method" << endl;
189 else if (m_cfg->sslv3()) kdDebug(7029) << "SSL3 method" << endl;
190 */
191 
192  d->m_ctx = d->kossl->SSL_CTX_new(d->m_meth);
193  if (d->m_ctx == 0L) {
194  return false;
195  }
196 
197  // set cipher list
198  TQString clist = m_cfg->getCipherList();
199  kdDebug(7029) << "Cipher list: " << clist << endl;
200  if (!clist.isEmpty())
201  d->kossl->SSL_CTX_set_cipher_list(d->m_ctx, const_cast<char *>(clist.ascii()));
202 
203  m_bInit = true;
204 return true;
205 #else
206 return false;
207 #endif
208 }
209 
210 
211 bool KSSL::takeSession(KSSLSession *session) {
212 #ifdef KSSL_HAVE_SSL
213  if (!session) {
214  delete d->session;
215  d->session = 0L;
216  return true;
217  }
218 
219  // Take session reference
220  d->session = new KSSLSession;
221  d->session->_session = session->_session;
222  session->_session = 0L;
223 
224  return true;
225 #else
226  return false;
227 #endif
228 }
229 
230 
231 void KSSL::close() {
232 #ifdef KSSL_HAVE_SSL
233 //kdDebug(7029) << "KSSL close" << endl;
234  if (!m_bInit)
235  return;
236 
237  delete d->session;
238  d->session = 0L;
239 
240  if (d->m_ssl) {
241  d->kossl->SSL_shutdown(d->m_ssl);
242  d->kossl->SSL_free(d->m_ssl);
243  d->m_ssl = 0L;
244  }
245 
246  d->kossl->SSL_CTX_free(d->m_ctx);
247  if (m_cfg->useEFile() && !m_cfg->getEGDPath().isEmpty()) {
248  d->kossl->RAND_write_file(m_cfg->getEGDPath().latin1());
249  }
250 
251  m_bInit = false;
252 #endif
253 }
254 
255 
256 bool KSSL::reInitialize() {
257  close();
258 return initialize();
259 }
260 
261 // get the callback file - it's hidden away in here
262 //#include "ksslcallback.c"
263 
264 
265 bool KSSL::setVerificationLogic() {
266 #if 0
267 #ifdef KSSL_HAVE_SSL
268  // SSL_set_verify_result(d->m_ssl, X509_V_OK);
269  // SSL_CTX_set_verify(d->m_ctx, SSL_VERIFY_PEER, X509Callback);
270 #endif
271 #endif
272 return true;
273 }
274 
275 
276 int KSSL::accept(int sock) {
277 #ifdef KSSL_HAVE_SSL
278 // kdDebug(7029) << "KSSL accept" << endl;
279 int rc;
280  if (!m_bInit)
281  return -1;
282  d->m_ssl = d->kossl->SSL_new(d->m_ctx);
283  if (!d->m_ssl)
284  return -1;
285 
286  if (d->session) {
287  if (1 == d->kossl->SSL_set_session(d->m_ssl,
288  static_cast<SSL_SESSION*>(d->session->_session))) {
289  kdDebug(7029) << "Session ID is being reused." << endl;
290  } else {
291  kdDebug(7029) << "Error attempting to reuse session." << endl;
292  delete d->session;
293  d->session = 0;
294  }
295  }
296 
297 /*
298  if (!setVerificationLogic()) {
299  d->kossl->SSL_shutdown(d->m_ssl);
300  d->kossl->SSL_free(d->m_ssl);
301  d->m_ssl = 0;
302  return -1;
303  }
304 */
305 
306  int off = SSL_OP_ALL;
307  if (!d->lastInitTLS && !m_cfg->tlsv1())
308  off |= SSL_OP_NO_TLSv1;
309  if (!m_cfg->sslv3())
310  off |= SSL_OP_NO_SSLv3;
311  if (!m_cfg->sslv2())
312  off |= SSL_OP_NO_SSLv2;
313 
314  d->kossl->_SSL_set_options(d->m_ssl, off);
315 
316  rc = d->kossl->SSL_set_fd(d->m_ssl, sock);
317  if (rc == 0) {
318  d->kossl->SSL_shutdown(d->m_ssl);
319  d->kossl->SSL_free(d->m_ssl);
320  d->m_ssl = 0;
321  return rc;
322  }
323 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
324  d->kossl->SSL_set_tlsext_host_name(d->m_ssl, d->proxyPeer.ascii());
325 #endif
326 
327  rc = d->kossl->SSL_accept(d->m_ssl);
328  if (rc == 1) {
329  setConnectionInfo();
330  setPeerInfo();
331  kdDebug(7029) << "KSSL connected OK" << endl;
332  } else {
333  kdDebug(7029) << "KSSL accept failed - rc = " << rc << endl;
334  kdDebug(7029) << " ERROR = "
335  << d->kossl->SSL_get_error(d->m_ssl, rc) << endl;
336  d->kossl->SSL_shutdown(d->m_ssl);
337  d->kossl->SSL_free(d->m_ssl);
338  d->m_ssl = 0;
339  return -1;
340  }
341 
342  if (!d->kossl->_SSL_session_reused(d->m_ssl)) {
343  if (d->session) {
344  kdDebug(7029) << "Session reuse failed. New session used instead." << endl;
345  delete d->session;
346  d->session = 0L;
347  }
348  }
349 
350  if (!d->session) {
351  SSL_SESSION *sess = d->kossl->SSL_get1_session(d->m_ssl);
352  if (sess) {
353  d->session = new KSSLSession;
354  d->session->_session = sess;
355  }
356  }
357 
358 return rc;
359 #else
360 return -1;
361 #endif
362 }
363 
364 
365 int KSSL::connect(int sock) {
366 #ifdef KSSL_HAVE_SSL
367 // kdDebug(7029) << "KSSL connect" << endl;
368 int rc;
369  if (!m_bInit)
370  return -1;
371  d->m_ssl = d->kossl->SSL_new(d->m_ctx);
372  if (!d->m_ssl)
373  return -1;
374 
375  if (d->session) {
376  if (1 == d->kossl->SSL_set_session(d->m_ssl,
377  static_cast<SSL_SESSION*>(d->session->_session))) {
378  kdDebug(7029) << "Session ID is being reused." << endl;
379  } else {
380  kdDebug(7029) << "Error attempting to reuse session." << endl;
381  delete d->session;
382  d->session = 0;
383  }
384  }
385 
386 /*
387  if (!setVerificationLogic()) {
388  d->kossl->SSL_shutdown(d->m_ssl);
389  d->kossl->SSL_free(d->m_ssl);
390  d->m_ssl = 0;
391  return -1;
392  }
393 */
394 
395  int off = SSL_OP_ALL;
396  if (!d->lastInitTLS && !m_cfg->tlsv1())
397  off |= SSL_OP_NO_TLSv1;
398  if (!m_cfg->sslv3())
399  off |= SSL_OP_NO_SSLv3;
400  if (!m_cfg->sslv2())
401  off |= SSL_OP_NO_SSLv2;
402 
403  d->kossl->_SSL_set_options(d->m_ssl, off);
404 
405  rc = d->kossl->SSL_set_fd(d->m_ssl, sock);
406  if (rc == 0) {
407  d->kossl->SSL_shutdown(d->m_ssl);
408  d->kossl->SSL_free(d->m_ssl);
409  d->m_ssl = 0;
410  return rc;
411  }
412 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
413  d->kossl->SSL_set_tlsext_host_name(d->m_ssl, d->proxyPeer.ascii());
414 #endif
415 
416 connect_again:
417  rc = d->kossl->SSL_connect(d->m_ssl);
418  if (rc == 1) {
419  setConnectionInfo();
420  setPeerInfo();
421  kdDebug(7029) << "KSSL connected OK" << endl;
422  } else {
423  int err = d->kossl->SSL_get_error(d->m_ssl, rc);
424  if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
425  // nonblocking - but we block anyways in connect() :)
426  goto connect_again;
427  } else {
428  kdDebug(7029) << "KSSL connect failed - rc = "
429  << rc << endl;
430  kdDebug(7029) << " ERROR = "
431  << err << endl;
432  d->kossl->ERR_print_errors_fp(stderr);
433  d->kossl->SSL_shutdown(d->m_ssl);
434  d->kossl->SSL_free(d->m_ssl);
435  d->m_ssl = 0;
436  return -1;
437  }
438  }
439 
440  if (!d->kossl->_SSL_session_reused(d->m_ssl)) {
441  if (d->session) {
442  kdDebug(7029) << "Session reuse failed. New session used instead." << endl;
443  delete d->session;
444  d->session = 0L;
445  }
446  }
447 
448  if (!d->session) {
449  SSL_SESSION *sess = d->kossl->SSL_get1_session(d->m_ssl);
450  if (sess) {
451  d->session = new KSSLSession;
452  d->session->_session = sess;
453  }
454  }
455 
456 return rc;
457 #else
458 return -1;
459 #endif
460 }
461 
462 
463 int KSSL::pending() {
464 #ifdef KSSL_HAVE_SSL
465  if (!m_bInit)
466  return -1;
467 return d->kossl->SSL_pending(d->m_ssl);
468 #else
469 return -1;
470 #endif
471 }
472 
473 
474 int KSSL::peek(void *buf, int len) {
475 #ifdef KSSL_HAVE_SSL
476  if (!m_bInit)
477  return -1;
478  // FIXME: enhance to work the way read() does below, handling errors
479 return d->kossl->SSL_peek(d->m_ssl, buf, len);
480 #else
481 return -1;
482 #endif
483 }
484 
485 
486 int KSSL::read(void *buf, int len) {
487 #ifdef KSSL_HAVE_SSL
488  int rc = 0;
489  int maxIters = 10;
490 
491  if (!m_bInit)
492  return -1;
493 
494 read_again:
495  rc = d->kossl->SSL_read(d->m_ssl, (char *)buf, len);
496  if (rc <= 0) {
497  int err = d->kossl->SSL_get_error(d->m_ssl, rc);
498 
499  if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
500  kdDebug(7029) << "SSL read() returning 0: " << err << endl;
501  if (maxIters-- > 0) {
502  ::usleep(20000); // 20ms sleep
503  goto read_again;
504  }
505  return 0;
506  }
507 
508  kdDebug(7029) << "SSL READ ERROR: " << err << endl;
509  if (err != SSL_ERROR_NONE &&
510  err != SSL_ERROR_ZERO_RETURN && err != SSL_ERROR_SYSCALL) {
511  rc = -1; // OpenSSL returns 0 on error too
512  d->kossl->ERR_print_errors_fp(stderr);
513  }
514 
515 // else if (err == SSL_ERROR_ZERO_RETURN)
516 // rc = 0;
517  }
518 return rc;
519 #else
520 return -1;
521 #endif
522 }
523 
524 
525 int KSSL::write(const void *buf, int len) {
526 #ifdef KSSL_HAVE_SSL
527  if (!m_bInit)
528  return -1;
529 
530 write_again:
531  int rc = d->kossl->SSL_write(d->m_ssl, (const char *)buf, len);
532  if (rc <= 0) { // OpenSSL returns 0 on error too
533  int err = d->kossl->SSL_get_error(d->m_ssl, rc);
534 
535  if (err == SSL_ERROR_WANT_WRITE) {
536  ::usleep(20000); // 20ms sleep
537  goto write_again;
538  }
539 
540  kdDebug(7029) << "SSL WRITE ERROR: " << err << endl;
541  if (err != SSL_ERROR_NONE &&
542  err != SSL_ERROR_ZERO_RETURN && err != SSL_ERROR_SYSCALL)
543  rc = -1;
544  }
545 
546 return rc;
547 #else
548 return -1;
549 #endif
550 }
551 
552 
553 bool KSSL::reconfig() {
554  return reInitialize();
555 }
556 
557 
558 void KSSL::setAutoReconfig(bool ar) {
559  m_bAutoReconfig = ar;
560 }
561 
562 
563 bool KSSL::setSettings(KSSLSettings *settings) {
564  delete m_cfg;
565  m_cfg = settings;
566  return reconfig();
567 }
568 
569 
570 #ifdef KSSL_HAVE_SSL
571 bool KSSL::m_bSSLWorks = true;
572 #else
573 bool KSSL::m_bSSLWorks = false;
574 #endif
575 
576 bool KSSL::doesSSLWork() {
577  return m_bSSLWorks;
578 }
579 
580 
581 void KSSL::setConnectionInfo() {
582 #ifdef KSSL_HAVE_SSL
583 SSL_CIPHER *sc;
584 char buf[1024];
585 
586  buf[0] = 0; // for safety.
587  sc = d->kossl->SSL_get_current_cipher(d->m_ssl);
588  if (!sc) {
589  kdDebug(7029) << "KSSL get current cipher failed - we're probably gonna crash!" << endl;
590  return;
591  }
592 
593  // set the number of bits, bits used
594  m_ci.m_iCipherUsedBits = d->kossl->SSL_CIPHER_get_bits(sc, &(m_ci.m_iCipherBits));
595  // set the cipher version
596  m_ci.m_cipherVersion = d->kossl->SSL_CIPHER_get_version(sc);
597  // set the cipher name
598  m_ci.m_cipherName = d->kossl->SSL_CIPHER_get_name(sc);
599  // set the cipher description
600  m_ci.m_cipherDescription = d->kossl->SSL_CIPHER_description(sc, buf, 1023);
601 
602 #endif
603 }
604 
605 
606 void KSSL::setPeerInfo() {
607 #ifdef KSSL_HAVE_SSL
608  m_pi.setPeerHost(d->proxyPeer);
609  m_pi.m_cert.setCert(d->kossl->SSL_get_peer_certificate(d->m_ssl));
610  STACK_OF(X509) *xs = d->kossl->SSL_get_peer_cert_chain(d->m_ssl);
611  if (xs)
612  xs = reinterpret_cast<STACK_OF(X509)*>(d->kossl->OPENSSL_sk_dup(xs)); // Leak?
613  m_pi.m_cert.setChain((void *)xs);
614 #endif
615 }
616 
617 
618 KSSLConnectionInfo& KSSL::connectionInfo() {
619  return m_ci;
620 }
621 
622 
623 // KDE 4: Make it const TQString &
624 void KSSL::setPeerHost(TQString realHost) {
625  d->proxyPeer = realHost;
626 }
627 
628 // deprecated
629 void KSSL::setProxyUse(bool, TQString, int, TQString) {
630 }
631 
632 
633 KSSLPeerInfo& KSSL::peerInfo() {
634  return m_pi;
635 }
636 
637 
638 bool KSSL::setClientCertificate(KSSLPKCS12 *pkcs) {
639 #ifdef KSSL_HAVE_SSL
640  if (!pkcs || !pkcs->getCertificate())
641  return false;
642 
643 int rc;
644 X509 *x = pkcs->getCertificate()->getCert();
645 EVP_PKEY *k = pkcs->getPrivateKey();
646 
647  if (!x || !k) return false;
648 
649  if (!pkcs->getCertificate()->x509V3Extensions().certTypeSSLClient())
650  return false;
651 
652  rc = d->kossl->SSL_CTX_use_certificate(d->m_ctx, x);
653  if (rc <= 0) {
654  kdDebug(7029) << "KSSL - SSL_CTX_use_certificate failed. rc = " << rc << endl;
655  return false;
656  }
657 
658  rc = d->kossl->SSL_CTX_use_PrivateKey(d->m_ctx, k);
659  if (rc <= 0) {
660  kdDebug(7029) << "KSSL - SSL_CTX_use_PrivateKey failed. rc = " << rc << endl;
661  return false;
662  }
663 
664  return true;
665 #else
666  return false;
667 #endif
668 }
669 
670 const KSSLSession* KSSL::session() const {
671  return d->session;
672 }
673 
674 bool KSSL::reusingSession() const {
675 #ifdef KSSL_HAVE_SSL
676  return (d->m_ssl && d->kossl->_SSL_session_reused(d->m_ssl));
677 #else
678  return false;
679 #endif
680 }
681 
KOpenSSLProxy::self
static KOpenSSLProxy * self()
Return an instance of class KOpenSSLProxy * You cannot delete this object.
Definition: kopenssl.cpp:743
KSSLCertificate::x509V3Extensions
KSSLX509V3 & x509V3Extensions()
Access the X.509v3 parameters.
Definition: ksslcertificate.cpp:1153
KSSLCertificate::KSSLValidation
KSSLValidation
A CA certificate can be validated as Irrelevant when it was not used to sign any other relevant certi...
Definition: ksslcertificate.h:122
KSSLCertificate::setCert
bool setCert(TQString &cert)
Re-set the certificate from a base64 string.
Definition: ksslcertificate.cpp:1138
KSSLConnectionInfo
KDE SSL Connection Information.
Definition: ksslconnectioninfo.h:40
KSSLPKCS12
KDE PKCS#12 Certificate.
Definition: ksslpkcs12.h:61
KSSLPKCS12::getPrivateKey
EVP_PKEY * getPrivateKey()
Get the private key.
Definition: ksslpkcs12.cpp:176
KSSLPKCS12::getCertificate
KSSLCertificate * getCertificate()
Get the X.509 certificate.
Definition: ksslpkcs12.cpp:181
KSSLPeerInfo
KDE SSL Peer Data.
Definition: ksslpeerinfo.h:42
KSSLPeerInfo::reset
void reset()
Clear out the host name.
Definition: ksslpeerinfo.cpp:163
KSSLPeerInfo::setPeerHost
void setPeerHost(TQString host=TQString::null)
Set the host that we are connected to.
Definition: ksslpeerinfo.cpp:60
KSSLSession
KDE SSL Session Information.
Definition: ksslsession.h:42
KSSLSettings
KDE SSL Settings.
Definition: ksslsettings.h:39
KSSLSettings::getCipherList
TQString getCipherList()
Get the OpenSSL cipher list for selecting the list of ciphers to use in a connection.
Definition: ksslsettings.cpp:125
KSSLSettings::sslv2
bool sslv2() const
Does the user allow SSLv2.
Definition: ksslsettings.cpp:107
KSSLSettings::sslv3
bool sslv3() const
Does the user allow SSLv3.
Definition: ksslsettings.cpp:112
KSSLSettings::tlsv1
bool tlsv1() const
Does the user allow TLSv1.
Definition: ksslsettings.cpp:117
KSSLSettings::load
void load()
Load the user's settings.
Definition: ksslsettings.cpp:201
KSSLSettings::useEFile
bool useEFile() const
Does the user want to use an entropy file?
Definition: ksslsettings.cpp:331
KSSLSettings::getEGDPath
TQString & getEGDPath()
Get the configured path to the entropy gathering daemon or entropy file.
Definition: ksslsettings.cpp:339
KSSLSettings::useEGD
bool useEGD() const
Does the user want to use the Entropy Gathering Daemon?
Definition: ksslsettings.cpp:330
KSSLX509V3::certTypeSSLClient
bool certTypeSSLClient()
Determine if this certificate can be used by an SSL client.
Definition: ksslx509v3.cpp:85
KSSL::setProxyUse
void setProxyUse(bool active, TQString realIP=TQString::null, int realPort=0, TQString proxy=TQString::null) TDE_DEPRECATED
Set the status of the connection with respect to proxies.
Definition: kssl.cpp:629
KSSL::setAutoReconfig
void setAutoReconfig(bool ar)
Enable or disable automatic reconfiguration on initialize().
Definition: kssl.cpp:558
KSSL::reconfig
bool reconfig()
Trigger a reread of KSSL configuration and reInitialize() KSSL.
Definition: kssl.cpp:553
KSSL::setSettings
bool setSettings(KSSLSettings *settings)
Set a new KSSLSettings instance as the settings.
Definition: kssl.cpp:563
KSSL::doesSSLWork
static bool doesSSLWork()
Determine if SSL is available and works.
Definition: kssl.cpp:576
KSSL::close
void close()
Close the SSL session.
Definition: kssl.cpp:231
KSSL::reInitialize
bool reInitialize()
Reinitialize OpenSSL.
Definition: kssl.cpp:256
KSSL::takeSession
bool takeSession(KSSLSession *session)
Set an SSL session to use.
Definition: kssl.cpp:211
KSSL::KSSL
KSSL(bool init=true)
Construct a KSSL object.
Definition: kssl.cpp:82
KSSL::reusingSession
bool reusingSession() const
Determine if we are currently reusing an SSL session ID.
Definition: kssl.cpp:674
KSSL::accept
int accept(int sock)
Connect the SSL session to the remote host using the provided socket descriptor.
Definition: kssl.cpp:276
KSSL::write
int write(const void *buf, int len)
Write data to the remote host via SSL.
Definition: kssl.cpp:525
KSSL::pending
int pending()
Determine if data is waiting to be read.
Definition: kssl.cpp:463
KSSL::peerInfo
KSSLPeerInfo & peerInfo()
Obtain a reference to the information about the peer.
Definition: kssl.cpp:633
KSSL::connectionInfo
KSSLConnectionInfo & connectionInfo()
Obtain a reference to the connection information.
Definition: kssl.cpp:618
KSSL::seedWithEGD
int seedWithEGD()
This will reseed the pseudo-random number generator with the EGD (entropy gathering daemon) if the EG...
Definition: kssl.cpp:103
KSSL::settings
KSSLSettings * settings()
One is built by the constructor, so this will only return a NULL pointer if you set one with setSetti...
Definition: kssl.h:158
KSSL::connect
int connect(int sock)
Connect the SSL session to the remote host using the provided socket descriptor.
Definition: kssl.cpp:365
KSSL::setClientCertificate
bool setClientCertificate(KSSLPKCS12 *pkcs)
Use this to set the certificate to send to the server.
Definition: kssl.cpp:638
KSSL::peek
int peek(void *buf, int len)
Peek at available data from the remote host via SSL.
Definition: kssl.cpp:474
KSSL::~KSSL
~KSSL()
Destroy this KSSL object.
Definition: kssl.cpp:96
KSSL::TLSInit
bool TLSInit()
This is used for applicationss which do STARTTLS or something similar.
Definition: kssl.cpp:124
KSSL::setPeerHost
void setPeerHost(TQString realHost=TQString::null)
Set the peer hostname to be used for certificate verification.
Definition: kssl.cpp:624
KSSL::session
const KSSLSession * session() const
Obtain a pointer to the session information.
Definition: kssl.cpp:670
KSSL::read
int read(void *buf, int len)
Read data from the remote host via SSL.
Definition: kssl.cpp:486
KSSL::initialize
bool initialize()
Initialize OpenSSL.
Definition: kssl.cpp:161

tdeio/kssl

Skip menu "tdeio/kssl"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/kssl

Skip menu "tdeio/kssl"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/kssl by doxygen 1.9.1
This website is maintained by Timothy Pearson.