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

tdeio/kssl

  • tdeio
  • kssl
ksslcertificatecache.cpp
1/* This file is part of the KDE project
2 *
3 * Copyright (C) 2000, 2001 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
22#include "ksslcertificatecache.h"
23#include "ksslcertchain.h"
24#include "ksslcertificate.h"
25
26#include <stdlib.h>
27#include <kdebug.h>
28#include <dcopclient.h>
29#include <kdatastream.h>
30
31
32class KSSLCertificateCache::KSSLCertificateCachePrivate {
33 public:
34 DCOPClient *dcc;
35
36 KSSLCertificateCachePrivate() { dcc = new DCOPClient; dcc->attach(); }
37 ~KSSLCertificateCachePrivate() { delete dcc;}
38
39};
40
41
42
43KSSLCertificateCache::KSSLCertificateCache() {
44 d = new KSSLCertificateCachePrivate;
45}
46
47
48KSSLCertificateCache::~KSSLCertificateCache() {
49 delete d;
50}
51
52
53void KSSLCertificateCache::saveToDisk() {
54 kdDebug() << "Deprecated function KSSLCertificateCache::saveToDisk() called" << endl;
55}
56
57
58void KSSLCertificateCache::clearList() {
59 kdDebug() << "Deprecated function KSSLCertificateCache::clearList() called" << endl;
60}
61
62
63void KSSLCertificateCache::loadDefaultPolicies() {
64 kdDebug() << "Deprecated function KSSLCertificateCache::loadDefaultPolicies() called" << endl;
65}
66
67
68void KSSLCertificateCache::reload() {
69 TQByteArray data, retval;
70 TQCString rettype;
71 TQDataStream arg(data, IO_WriteOnly);
72 d->dcc->call("kded", "kssld",
73 "cacheReload()",
74 data, rettype, retval);
75}
76
77
78void KSSLCertificateCache::addCertificate(KSSLCertificate& cert,
79 KSSLCertificatePolicy policy, bool permanent) {
80 TQByteArray data, retval;
81 TQCString rettype;
82 TQDataStream arg(data, IO_WriteOnly);
83 arg << cert;
84 arg << policy;
85 arg << permanent;
86 d->dcc->call("kded", "kssld",
87 "cacheAddCertificate(KSSLCertificate,KSSLCertificateCache::KSSLCertificatePolicy,bool)",
88 data, rettype, retval);
89}
90
91
92// KDE 4: Make it const TQString &
93KSSLCertificateCache::KSSLCertificatePolicy KSSLCertificateCache::getPolicyByCN(TQString& cn) {
94 TQByteArray data, retval;
95 TQCString rettype;
96 TQDataStream arg(data, IO_WriteOnly);
97 arg << cn;
98 bool rc = d->dcc->call("kded", "kssld",
99 "cacheGetPolicyByCN(TQString)",
100 data, rettype, retval);
101
102 if (rc && rettype == "KSSLCertificateCache::KSSLCertificatePolicy") {
103 TQDataStream retStream(retval, IO_ReadOnly);
104 KSSLCertificateCache::KSSLCertificatePolicy drc;
105 retStream >> drc;
106 return drc;
107 }
108return KSSLCertificateCache::Ambiguous;
109}
110
111
112KSSLCertificateCache::KSSLCertificatePolicy KSSLCertificateCache::getPolicyByCertificate(KSSLCertificate& cert) {
113 TQByteArray data, retval;
114 TQCString rettype;
115 TQDataStream arg(data, IO_WriteOnly);
116 arg << cert;
117 bool rc = d->dcc->call("kded", "kssld",
118 "cacheGetPolicyByCertificate(KSSLCertificate)",
119 data, rettype, retval);
120
121 if (rc && rettype == "KSSLCertificateCache::KSSLCertificatePolicy") {
122 TQDataStream retStream(retval, IO_ReadOnly);
123 KSSLCertificateCache::KSSLCertificatePolicy drc;
124 retStream >> drc;
125 return drc;
126 }
127return KSSLCertificateCache::Ambiguous;
128}
129
130
131// KDE 4: Make it const TQString &
132bool KSSLCertificateCache::seenCN(TQString& cn) {
133 TQByteArray data, retval;
134 TQCString rettype;
135 TQDataStream arg(data, IO_WriteOnly);
136 arg << cn;
137 bool rc = d->dcc->call("kded", "kssld",
138 "cacheSeenCN(TQString)",
139 data, rettype, retval);
140
141 if (rc && rettype == "bool") {
142 TQDataStream retStream(retval, IO_ReadOnly);
143 bool drc;
144 retStream >> drc;
145 return drc;
146 }
147
148return false;
149}
150
151
152bool KSSLCertificateCache::seenCertificate(KSSLCertificate& cert) {
153 TQByteArray data, retval;
154 TQCString rettype;
155 TQDataStream arg(data, IO_WriteOnly);
156 arg << cert;
157 bool rc = d->dcc->call("kded", "kssld",
158 "cacheSeenCertificate(KSSLCertificate)",
159 data, rettype, retval);
160
161 if (rc && rettype == "bool") {
162 TQDataStream retStream(retval, IO_ReadOnly);
163 bool drc;
164 retStream >> drc;
165 return drc;
166 }
167
168return false;
169}
170
171
172bool KSSLCertificateCache::isPermanent(KSSLCertificate& cert) {
173 TQByteArray data, retval;
174 TQCString rettype;
175 TQDataStream arg(data, IO_WriteOnly);
176 arg << cert;
177 bool rc = d->dcc->call("kded", "kssld",
178 "cacheIsPermanent(KSSLCertificate)",
179 data, rettype, retval);
180
181 if (rc && rettype == "bool") {
182 TQDataStream retStream(retval, IO_ReadOnly);
183 bool drc;
184 retStream >> drc;
185 return drc;
186 }
187
188return false;
189}
190
191
192// KDE 4: Make it const TQString &
193bool KSSLCertificateCache::removeByCN(TQString& cn) {
194 TQByteArray data, retval;
195 TQCString rettype;
196 TQDataStream arg(data, IO_WriteOnly);
197 arg << cn;
198 bool rc = d->dcc->call("kded", "kssld",
199 "cacheRemoveByCN(TQString)",
200 data, rettype, retval);
201
202 if (rc && rettype == "bool") {
203 TQDataStream retStream(retval, IO_ReadOnly);
204 bool drc;
205 retStream >> drc;
206 return drc;
207 }
208
209return false;
210}
211
212
213bool KSSLCertificateCache::removeByCertificate(KSSLCertificate& cert) {
214 TQByteArray data, retval;
215 TQCString rettype;
216 TQDataStream arg(data, IO_WriteOnly);
217 arg << cert;
218 bool rc = d->dcc->call("kded", "kssld",
219 "cacheRemoveByCertificate(KSSLCertificate)",
220 data, rettype, retval);
221
222 if (rc && rettype == "bool") {
223 TQDataStream retStream(retval, IO_ReadOnly);
224 bool drc;
225 retStream >> drc;
226 return drc;
227 }
228
229return false;
230}
231
232
233// KDE 4: Make it const TQString &
234bool KSSLCertificateCache::modifyByCN(TQString& cn,
235 KSSLCertificateCache::KSSLCertificatePolicy policy,
236 bool permanent,
237 TQDateTime& expires) {
238 TQByteArray data, retval;
239 TQCString rettype;
240 TQDataStream arg(data, IO_WriteOnly);
241 arg << cn << policy << permanent << expires;
242 bool rc = d->dcc->call("kded", "kssld",
243 "cacheModifyByCN(TQString,KSSLCertificateCache::KSSLCertificatePolicy,bool,TQDateTime)",
244 data, rettype, retval);
245
246 if (rc && rettype == "bool") {
247 TQDataStream retStream(retval, IO_ReadOnly);
248 bool drc;
249 retStream >> drc;
250 return drc;
251 }
252
253return false;
254}
255
256
257bool KSSLCertificateCache::modifyByCertificate(KSSLCertificate& cert,
258 KSSLCertificateCache::KSSLCertificatePolicy policy,
259 bool permanent,
260 TQDateTime& expires) {
261 TQByteArray data, retval;
262 TQCString rettype;
263 TQDataStream arg(data, IO_WriteOnly);
264 arg << cert << policy << permanent << expires;
265 bool rc = d->dcc->call("kded", "kssld",
266 "cacheModifyByCertificate(KSSLCertificate,KSSLCertificateCache::KSSLCertificatePolicy,bool,TQDateTime)",
267 data, rettype, retval);
268
269 if (rc && rettype == "bool") {
270 TQDataStream retStream(retval, IO_ReadOnly);
271 bool drc;
272 retStream >> drc;
273 return drc;
274 }
275
276return false;
277}
278
279
280TQStringList KSSLCertificateCache::getHostList(KSSLCertificate& cert) {
281 TQByteArray data, retval;
282 TQCString rettype;
283 TQDataStream arg(data, IO_WriteOnly);
284 arg << cert;
285 bool rc = d->dcc->call("kded", "kssld",
286 "cacheGetHostList(KSSLCertificate)",
287 data, rettype, retval);
288
289 if (rc && rettype == "TQStringList") {
290 TQDataStream retStream(retval, IO_ReadOnly);
291 TQStringList drc;
292 retStream >> drc;
293 return drc;
294 }
295return TQStringList();
296}
297
298
299// KDE 4: Make it const TQString &
300bool KSSLCertificateCache::addHost(KSSLCertificate& cert, TQString& host) {
301 TQByteArray data, retval;
302 TQCString rettype;
303 TQDataStream arg(data, IO_WriteOnly);
304 arg << cert << host;
305 bool rc = d->dcc->call("kded", "kssld",
306 "cacheAddHost(KSSLCertificate,TQString)",
307 data, rettype, retval);
308
309 if (rc && rettype == "bool") {
310 TQDataStream retStream(retval, IO_ReadOnly);
311 bool drc;
312 retStream >> drc;
313 return drc;
314 }
315
316return false;
317}
318
319
320// KDE 4: Make it const TQString &
321bool KSSLCertificateCache::removeHost(KSSLCertificate& cert, TQString& host) {
322 TQByteArray data, retval;
323 TQCString rettype;
324 TQDataStream arg(data, IO_WriteOnly);
325 arg << cert << host;
326 bool rc = d->dcc->call("kded", "kssld",
327 "cacheRemoveHost(KSSLCertificate,TQString)",
328 data, rettype, retval);
329
330 if (rc && rettype == "bool") {
331 TQDataStream retStream(retval, IO_ReadOnly);
332 bool drc;
333 retStream >> drc;
334 return drc;
335 }
336
337return false;
338}
339
340
341TQStringList KSSLCertificateCache::getKDEKeyByEmail(const TQString &email) {
342 TQByteArray data, retval;
343 TQCString rettype;
344 TQDataStream arg(data, IO_WriteOnly);
345 arg << email;
346 bool rc = d->dcc->call("kded", "kssld",
347 "getKDEKeyByEmail(TQString)",
348 data, rettype, retval);
349
350 if (rc && rettype == "TQStringList") {
351 TQDataStream retStream(retval, IO_ReadOnly);
352 TQStringList drc;
353 retStream >> drc;
354 return drc;
355 }
356
357 return TQStringList();
358}
359
360
361KSSLCertificate *KSSLCertificateCache::getCertByMD5Digest(const TQString &key) {
362 TQByteArray data, retval;
363 TQCString rettype;
364 TQDataStream arg(data, IO_WriteOnly);
365 arg << key;
366 bool rc = d->dcc->call("kded", "kssld",
367 "getCertByMD5Digest(TQString)",
368 data, rettype, retval);
369
370 if (rc && rettype == "KSSLCertificate") {
371 TQDataStream retStream(retval, IO_ReadOnly);
372 KSSLCertificate *drc = new KSSLCertificate;
373 retStream >> *drc;
374 if (drc->getCert())
375 return drc;
376 delete drc; // should not happen too often if used in conjunction with getKDEKeyByEmail
377 }
378
379 return 0L;
380}
381
382
383TQDataStream& operator<<(TQDataStream& s, const KSSLCertificateCache::KSSLCertificatePolicy& p) {
384 s << (TQ_UINT32)p;
385return s;
386}
387
388
389TQDataStream& operator>>(TQDataStream& s, KSSLCertificateCache::KSSLCertificatePolicy& p) {
390 TQ_UINT32 pd;
391 s >> pd;
392 p = (KSSLCertificateCache::KSSLCertificatePolicy) pd;
393 return s;
394}
395
396
397
398
399
KSSLCertificate
KDE X.509 Certificate.
Definition: ksslcertificate.h:77

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.4
This website is maintained by Timothy Pearson.