Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef QSSLCERTIFICATE_H
00044 #define QSSLCERTIFICATE_H
00045
00046 #include <QtCore/qnamespace.h>
00047 #include <QtCore/qbytearray.h>
00048 #include <QtCore/qcryptographichash.h>
00049 #include <QtCore/qregexp.h>
00050 #include <QtCore/qsharedpointer.h>
00051 #include <QtNetwork/qssl.h>
00052
00053 typedef struct x509_st X509;
00054
00055 QT_BEGIN_HEADER
00056
00057 QT_BEGIN_NAMESPACE
00058
00059 QT_MODULE(Network)
00060
00061 #ifndef QT_NO_OPENSSL
00062
00063 class QDateTime;
00064 class QIODevice;
00065 class QSslKey;
00066 class QStringList;
00067 template <typename T, typename U> class QMultiMap;
00068
00069 class QSslCertificatePrivate;
00070 class Q_NETWORK_EXPORT QSslCertificate
00071 {
00072 public:
00073 enum SubjectInfo {
00074 Organization,
00075 CommonName,
00076 LocalityName,
00077 OrganizationalUnitName,
00078 CountryName,
00079 StateOrProvinceName
00080 };
00081
00082 QSslCertificate(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
00083 QSslCertificate(
00084 const QByteArray &encoded = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem);
00085 QSslCertificate(const QSslCertificate &other);
00086 ~QSslCertificate();
00087 QSslCertificate &operator=(const QSslCertificate &other);
00088 bool operator==(const QSslCertificate &other) const;
00089 inline bool operator!=(const QSslCertificate &other) const { return !operator==(other); }
00090
00091 bool isNull() const;
00092 bool isValid() const;
00093 void clear();
00094
00095
00096 QByteArray version() const;
00097 QByteArray serialNumber() const;
00098 QByteArray digest(QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5) const;
00099 QString issuerInfo(SubjectInfo info) const;
00100 QString issuerInfo(const QByteArray &tag) const;
00101 QString subjectInfo(SubjectInfo info) const;
00102 QString subjectInfo(const QByteArray &tag) const;
00103 QMultiMap<QSsl::AlternateNameEntryType, QString> alternateSubjectNames() const;
00104 QDateTime effectiveDate() const;
00105 QDateTime expiryDate() const;
00106 QSslKey publicKey() const;
00107
00108 QByteArray toPem() const;
00109 QByteArray toDer() const;
00110
00111 static QList<QSslCertificate> fromPath(
00112 const QString &path, QSsl::EncodingFormat format = QSsl::Pem,
00113 QRegExp::PatternSyntax syntax = QRegExp::FixedString);
00114 static QList<QSslCertificate> fromDevice(
00115 QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
00116 static QList<QSslCertificate> fromData(
00117 const QByteArray &data, QSsl::EncodingFormat format = QSsl::Pem);
00118
00119 Qt::HANDLE handle() const;
00120
00121 private:
00122 QExplicitlySharedDataPointer<QSslCertificatePrivate> d;
00123 friend class QSslCertificatePrivate;
00124 friend class QSslSocketBackendPrivate;
00125 };
00126
00127 #ifndef QT_NO_DEBUG_STREAM
00128 class QDebug;
00129 Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslCertificate &certificate);
00130 Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QSslCertificate::SubjectInfo info);
00131 #endif
00132
00133 #endif // QT_NO_OPENSSL
00134
00135 QT_END_NAMESPACE
00136
00137 QT_END_HEADER
00138
00139 #endif