diff 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
line wrap: on
line diff
--- a/ui/certificate.h	Wed Apr 09 14:25:54 2014 +0000
+++ b/ui/certificate.h	Wed Apr 09 14:26:53 2014 +0000
@@ -7,6 +7,7 @@
  */
 
 #include <QByteArray>
+#include <QDateTime>
 #include <QMap>
 #include <QString>
 
@@ -48,7 +49,8 @@
 
     /** @brief get details for the certificate
      *
-     * Get the X509 information that is returned by x509_crt_info
+     * Get a formatted details string usable for user visible
+     * certificate details.
      *
      **/
     const QString& details() const {return mDetails;}
@@ -62,17 +64,6 @@
      **/
     const QString& base64Line() const {return mBaseLine;}
 
-    /** @brief get a single attribute of the subject
-     *
-     * Returns a single attribute of the subject such as the
-     * common name.
-     *
-     * @param[in] attr the Attribute name. to get e.g. "CN"
-     *
-     * @returns the value of the attribute or a null string
-     **/
-    QString getSubjectAttr(const QString& attr) const;
-
     /** @brief Check if this certificate has the install instruction.
      *
      * This is shorthand for baseLine.startsWith("I:");
@@ -80,11 +71,20 @@
     bool isInstallCert() const {return mBaseLine.startsWith("I:");}
 
 private:
+    /** @brief Helper function to parse the details of a certificate **/
+    void parseDetails(const QByteArray& cert);
+
     bool mValid;
     bool mInstCert;
 
-    QString mDetails;
-    QString mBaseLine;
-    QMap <QString, QString> mSubjectAttrs;
+    QString mSubjectOU,
+            mSubjectCN,
+            mSubjectO,
+            mSubjectSN,
+            mDetails,
+            mBaseLine;
+
+    QDateTime mValidFrom,
+              mValidTo;
 };
 #endif

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