ksslcertificate.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _KSSLCERTIFICATE_H
00022 #define _KSSLCERTIFICATE_H
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <qcstring.h>
00043
00044 class QString;
00045 class QCString;
00046 class KSSL;
00047 class KSSLCertificatePrivate;
00048 class QDateTime;
00049 class KSSLCertChain;
00050 class KSSLX509V3;
00051
00052 #include "ksslconfig.h"
00053
00054 #ifdef KSSL_HAVE_SSL
00055 typedef struct x509_st X509;
00056 #else
00057 class X509;
00058 #endif
00059
00060 class KSSLCertificate {
00061 friend class KSSL;
00062 friend class KSSLCertificateHome;
00063 friend class KSSLCertificateFactory;
00064 friend class KSSLCertificateCache;
00065 friend class KSSLCertChain;
00066 friend class KSSLPeerInfo;
00067 friend class KSSLPKCS12;
00068 friend class KSSLD;
00069
00070 public:
00071 ~KSSLCertificate();
00072 static KSSLCertificate *fromString(QCString cert);
00073
00074 static KSSLCertificate *fromX509(X509 *x5);
00075
00076
00077
00078
00079
00080 enum KSSLValidation { Unknown, Ok, NoCARoot, InvalidPurpose,
00081 PathLengthExceeded, InvalidCA, Expired,
00082 SelfSigned, ErrorReadingRoot, NoSSL,
00083 Revoked, Untrusted, SignatureFailed,
00084 Rejected, PrivateKeyFailed };
00085
00086 enum KSSLPurpose { None=0, SSLServer=1, SSLClient=2,
00087 SMIMESign=3, SMIMEEncrypt=4, Any=5 };
00088
00089 QString toString();
00090
00091 QString getSubject() const;
00092
00093 QString getIssuer() const;
00094
00095 QString getNotBefore() const;
00096 QString getNotAfter() const;
00097
00098 QDateTime getQDTNotBefore() const;
00099 QDateTime getQDTNotAfter() const;
00100
00101 QByteArray toDer();
00102 QByteArray toPem();
00103 QByteArray toNetscape();
00104 QString toText();
00105
00106 QString getSerialNumber() const;
00107 QString getKeyType() const;
00108 QString getPublicKeyText() const;
00109 QString getMD5DigestText() const;
00110 QString getSignatureText() const;
00111
00112 bool isValid();
00113 bool isValid(KSSLPurpose p);
00114 KSSLValidation validate();
00115 KSSLValidation validate(KSSLPurpose p);
00116 KSSLValidation revalidate();
00117 KSSLValidation revalidate(KSSLPurpose p);
00118 KSSLCertChain& chain();
00119
00120 static QString verifyText(KSSLValidation x);
00121
00122 KSSLCertificate *replicate();
00123 KSSLCertificate(const KSSLCertificate& x);
00124
00125 friend int operator==(KSSLCertificate &x, KSSLCertificate &y);
00126 inline friend int operator!=(KSSLCertificate &x, KSSLCertificate &y)
00127 { return !(x == y); }
00128 bool setCert(QString& cert);
00129
00130 KSSLX509V3& x509V3Extensions();
00131
00132 bool isSigner();
00133
00134 private:
00135 KSSLCertificatePrivate *d;
00136 int purposeToOpenSSL(KSSLPurpose p) const;
00137
00138
00139 protected:
00140 KSSLCertificate();
00141
00142 void setCert(X509 *c);
00143 void setChain(void *c);
00144 X509 *getCert();
00145 KSSLValidation processError(int ec);
00146 };
00147
00148
00149 QDataStream& operator<<(QDataStream& s, const KSSLCertificate& r);
00150 QDataStream& operator>>(QDataStream& s, KSSLCertificate& r);
00151
00152 #endif
00153
This file is part of the documentation for kdelibs Version 3.1.0.