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

kio/kssl

  • kio
  • kssl
ksslcertificate.h
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 #ifndef _KSSLCERTIFICATE_H
22 #define _KSSLCERTIFICATE_H
23 
24 
25 // UPDATE: I like the structure of this class less and less every time I look
26 // at it. I think it needs to change.
27 //
28 //
29 // The biggest reason for making everything protected here is so that
30 // the class can have all it's methods available even if openssl is not
31 // available. Also, to create a new certificate you should use the
32 // KSSLCertificateFactory, and to manage the user's database of certificates,
33 // you should go through the KSSLCertificateHome.
34 //
35 // There should be no reason to touch the X509 stuff directly.
36 //
37 
38 #include <tqcstring.h>
39 #include <tqvaluelist.h>
40 
41 class TQString;
42 class TQStringList;
43 class TQCString;
44 class KSSL;
45 class KSSLCertificatePrivate;
46 class TQDateTime;
47 class KSSLCertChain;
48 class KSSLX509V3;
49 
50 #include <kdelibs_export.h>
51 
52 #ifdef Q_WS_WIN
53 #include "ksslconfig_win.h"
54 #else
55 #include "ksslconfig.h"
56 #endif
57 
58 #ifdef KSSL_HAVE_SSL
59 typedef struct x509_st X509;
60 #else
61 class X509;
62 #endif
63 
75 class KIO_EXPORT KSSLCertificate {
76 friend class KSSL;
77 friend class KSSLCertificateHome;
78 friend class KSSLCertificateFactory;
79 friend class KSSLCertificateCache;
80 friend class KSSLCertChain;
81 friend class KSSLPeerInfo;
82 friend class KSSLPKCS12;
83 friend class KSSLD;
84 friend class KSMIMECryptoPrivate;
85 
86 
87 public:
91  ~KSSLCertificate();
92 
98  static KSSLCertificate *fromString(TQCString cert);
99 
107  static KSSLCertificate *fromX509(X509 *x5);
108 
113  enum KSSLValidation { Unknown, Ok, NoCARoot, InvalidPurpose,
114  PathLengthExceeded, InvalidCA, Expired,
115  SelfSigned, ErrorReadingRoot, NoSSL,
116  Revoked, Untrusted, SignatureFailed,
117  Rejected, PrivateKeyFailed, InvalidHost,
118  Irrelevant, SelfSignedChain
119  };
120 
121  enum KSSLPurpose { None=0, SSLServer=1, SSLClient=2,
122  SMIMESign=3, SMIMEEncrypt=4, Any=5 };
123 
124  typedef TQValueList<KSSLValidation> KSSLValidationList;
125 
130  TQString toString();
131 
136  TQString getSubject() const;
137 
142  TQString getIssuer() const;
143 
148  TQString getNotBefore() const;
149 
154  TQString getNotAfter() const;
155 
160  TQDateTime getQDTNotBefore() const;
161 
166  TQDateTime getQDTNotAfter() const;
167 
172  TQByteArray toDer();
173 
178  TQByteArray toPem();
179 
184  TQByteArray toNetscape();
185 
190  TQString toText();
191 
196  TQString getSerialNumber() const;
197 
202  TQString getKeyType() const;
203 
208  TQString getPublicKeyText() const;
209 
215  TQString getMD5DigestText() const;
216 
221  TQString getMD5Digest() const;
222 
227  TQString getSignatureText() const;
228 
233  bool isValid();
234 
240  bool isValid(KSSLPurpose p);
241 
246  TQStringList subjAltNames() const;
247 
252  KSSLValidation validate();
253 
259  KSSLValidation validate(KSSLPurpose p);
260 
266  KSSLValidationList validateVerbose(KSSLPurpose p);
267 
275  KSSLValidationList validateVerbose(KSSLPurpose p, KSSLCertificate *ca);
276 
281  KSSLValidation revalidate();
282 
288  KSSLValidation revalidate(KSSLPurpose p);
289 
294  KSSLCertChain& chain();
295 
301  static TQString verifyText(KSSLValidation x);
302 
307  KSSLCertificate *replicate();
308 
313  KSSLCertificate(const KSSLCertificate& x); // copy constructor
314 
320  bool setCert(TQString& cert);
321 
327  KSSLX509V3& x509V3Extensions();
328 
333  bool isSigner();
334 
338  void getEmails(TQStringList& to) const;
339 
345  TQString getKDEKey() const;
346 
350  static TQString getMD5DigestFromKDEKey(const TQString& k);
351 
352 private:
353  KIO_EXPORT friend int operator!=(KSSLCertificate& x, KSSLCertificate& y);
354  KIO_EXPORT friend int operator==(KSSLCertificate& x, KSSLCertificate& y);
355 
356  KSSLCertificatePrivate *d;
357  int purposeToOpenSSL(KSSLPurpose p) const;
358 
359 protected:
360  KSSLCertificate();
361 
362  void setCert(X509 *c);
363  void setChain(void *c);
364  X509 *getCert();
365  KSSLValidation processError(int ec);
366 };
367 
368 KIO_EXPORT TQDataStream& operator<<(TQDataStream& s, const KSSLCertificate& r);
369 KIO_EXPORT TQDataStream& operator>>(TQDataStream& s, KSSLCertificate& r);
370 
371 KIO_EXPORT int operator==(KSSLCertificate& x, KSSLCertificate& y);
372 KIO_EXPORT inline int operator!=(KSSLCertificate& x, KSSLCertificate& y)
373 { return !(x == y); }
374 
375 #endif
376 

kio/kssl

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

kio/kssl

Skip menu "kio/kssl"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kssl by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |