comparison ui/certificate.h @ 338:64e38886f903

Use certhelp for certificate parsing and add some dummy info
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 09 Apr 2014 14:26:53 +0000
parents ffd47b045d19
children 36c68dfb821d
comparison
equal deleted inserted replaced
337:2207e94a0cc3 338:64e38886f903
5 * @brief Class around native certificates. 5 * @brief Class around native certificates.
6 * 6 *
7 */ 7 */
8 8
9 #include <QByteArray> 9 #include <QByteArray>
10 #include <QDateTime>
10 #include <QMap> 11 #include <QMap>
11 #include <QString> 12 #include <QString>
12 13
13 #ifdef Q_OS_WIN 14 #ifdef Q_OS_WIN
14 #include <windows.h> 15 #include <windows.h>
46 **/ 47 **/
47 QString shortDescription() const; 48 QString shortDescription() const;
48 49
49 /** @brief get details for the certificate 50 /** @brief get details for the certificate
50 * 51 *
51 * Get the X509 information that is returned by x509_crt_info 52 * Get a formatted details string usable for user visible
53 * certificate details.
52 * 54 *
53 **/ 55 **/
54 const QString& details() const {return mDetails;} 56 const QString& details() const {return mDetails;}
55 57
56 /** @brief get the line from which this certificate was constructed 58 /** @brief get the line from which this certificate was constructed
60 * I:BASE64ENCODEDATA... 62 * I:BASE64ENCODEDATA...
61 * 63 *
62 **/ 64 **/
63 const QString& base64Line() const {return mBaseLine;} 65 const QString& base64Line() const {return mBaseLine;}
64 66
65 /** @brief get a single attribute of the subject
66 *
67 * Returns a single attribute of the subject such as the
68 * common name.
69 *
70 * @param[in] attr the Attribute name. to get e.g. "CN"
71 *
72 * @returns the value of the attribute or a null string
73 **/
74 QString getSubjectAttr(const QString& attr) const;
75
76 /** @brief Check if this certificate has the install instruction. 67 /** @brief Check if this certificate has the install instruction.
77 * 68 *
78 * This is shorthand for baseLine.startsWith("I:"); 69 * This is shorthand for baseLine.startsWith("I:");
79 **/ 70 **/
80 bool isInstallCert() const {return mBaseLine.startsWith("I:");} 71 bool isInstallCert() const {return mBaseLine.startsWith("I:");}
81 72
82 private: 73 private:
74 /** @brief Helper function to parse the details of a certificate **/
75 void parseDetails(const QByteArray& cert);
76
83 bool mValid; 77 bool mValid;
84 bool mInstCert; 78 bool mInstCert;
85 79
86 QString mDetails; 80 QString mSubjectOU,
87 QString mBaseLine; 81 mSubjectCN,
88 QMap <QString, QString> mSubjectAttrs; 82 mSubjectO,
83 mSubjectSN,
84 mDetails,
85 mBaseLine;
86
87 QDateTime mValidFrom,
88 mValidTo;
89 }; 89 };
90 #endif 90 #endif

http://wald.intevation.org/projects/trustbridge/