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

tdeio/kssl

  • tdeio
  • 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 <tdelibs_export.h>
51 
52 #ifdef TQ_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 typedef struct X509_crl_st X509_CRL;
61 #else
62 class X509;
63 class X509_CRL;
64 #endif
65 
77 class TDEIO_EXPORT KSSLCertificate {
78 friend class KSSL;
79 friend class KSSLCertificateHome;
80 friend class KSSLCertificateFactory;
81 friend class KSSLCertificateCache;
82 friend class KSSLCertChain;
83 friend class KSSLPeerInfo;
84 friend class KSSLPKCS12;
85 friend class KSSLD;
86 friend class KSMIMECryptoPrivate;
87 
88 
89 public:
93  ~KSSLCertificate();
94 
100  static KSSLCertificate *fromString(TQCString cert);
101 
107  static KSSLCertificate *crlFromString(TQCString cert);
108 
116  static KSSLCertificate *fromX509(X509 *x5);
117 
122  enum KSSLValidation { Unknown, Ok, NoCARoot, InvalidPurpose,
123  PathLengthExceeded, InvalidCA, Expired,
124  SelfSigned, ErrorReadingRoot, NoSSL,
125  Revoked, Untrusted, SignatureFailed,
126  Rejected, PrivateKeyFailed, InvalidHost,
127  Irrelevant, SelfSignedChain
128  };
129 
130  enum KSSLPurpose { None=0, SSLServer=1, SSLClient=2,
131  SMIMESign=3, SMIMEEncrypt=4, Any=5 };
132 
133  typedef TQValueList<KSSLValidation> KSSLValidationList;
134 
139  TQString toString();
140 
145  TQString getSubject() const;
146 
151  TQString getIssuer() const;
152 
157  TQString getNotBefore() const;
158 
163  TQString getNotAfter() const;
164 
169  TQDateTime getQDTNotBefore() const;
170 
175  TQDateTime getQDTNotAfter() const;
176 
181  TQDateTime getQDTLastUpdate() const;
182 
187  TQDateTime getQDTNextUpdate() const;
188 
193  TQByteArray toDer();
194 
199  TQByteArray toPem();
200 
205  TQByteArray toNetscape();
206 
211  TQString toText();
212 
217  TQString getSerialNumber() const;
218 
223  TQString getKeyType() const;
224 
229  TQString getPublicKeyText() const;
230 
236  TQString getMD5DigestText() const;
237 
242  TQString getMD5Digest() const;
243 
248  TQString getSignatureText() const;
249 
254  bool isValid();
255 
261  bool isValid(KSSLPurpose p);
262 
267  TQStringList subjAltNames() const;
268 
273  KSSLValidation validate();
274 
280  KSSLValidation validate(KSSLPurpose p);
281 
287  KSSLValidationList validateVerbose(KSSLPurpose p);
288 
296  KSSLValidationList validateVerbose(KSSLPurpose p, KSSLCertificate *ca);
297 
302  KSSLValidation revalidate();
303 
309  KSSLValidation revalidate(KSSLPurpose p);
310 
315  KSSLCertChain& chain();
316 
322  static TQString verifyText(KSSLValidation x);
323 
328  KSSLCertificate *replicate();
329 
334  KSSLCertificate(const KSSLCertificate& x); // copy constructor
335 
341  bool setCert(TQString& cert);
342 
348  KSSLX509V3& x509V3Extensions();
349 
354  bool isSigner();
355 
359  void getEmails(TQStringList& to) const;
360 
366  TQString getKDEKey() const;
367 
371  static TQString getMD5DigestFromKDEKey(const TQString& k);
372 
373 private:
374  TDEIO_EXPORT friend int operator!=(KSSLCertificate& x, KSSLCertificate& y);
375  TDEIO_EXPORT friend int operator==(KSSLCertificate& x, KSSLCertificate& y);
376 
377  KSSLCertificatePrivate *d;
378  int purposeToOpenSSL(KSSLPurpose p) const;
379 
380 protected:
381  KSSLCertificate();
382 
383  void setCert(X509 *c);
384  void setCRL(X509_CRL *c);
385  void setChain(void *c);
386  X509 *getCert();
387  KSSLValidation processError(int ec);
388 };
389 
390 TDEIO_EXPORT TQDataStream& operator<<(TQDataStream& s, const KSSLCertificate& r);
391 TDEIO_EXPORT TQDataStream& operator>>(TQDataStream& s, KSSLCertificate& r);
392 
393 TDEIO_EXPORT int operator==(KSSLCertificate& x, KSSLCertificate& y);
394 TDEIO_EXPORT inline int operator!=(KSSLCertificate& x, KSSLCertificate& y)
395 { return !(x == y); }
396 
397 #endif
398 
KSSLCertChain
KDE Certificate Chain Representation Class.
Definition: ksslcertchain.h:45
KSSLCertificate
KDE X.509 Certificate.
Definition: ksslcertificate.h:77
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
KSSLPKCS12
KDE PKCS#12 Certificate.
Definition: ksslpkcs12.h:61
KSSLPeerInfo
KDE SSL Peer Data.
Definition: ksslpeerinfo.h:42
KSSLX509V3
KDE X509v3 Flag Class.
Definition: ksslx509v3.h:38
KSSL
KDE SSL Wrapper Class.
Definition: kssl.h:42

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.