diff ui/certificate.h @ 21:dc1e1e9e62ce

Add certificate class and use it
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 20 Feb 2014 10:58:28 +0000
parents
children 2f5db8c70bc2
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/certificate.h	Thu Feb 20 10:58:28 2014 +0000
@@ -0,0 +1,45 @@
+#ifndef CERTIFICATE_H
+#define CERTIFICATE_H
+/**
+ * @file certificate.h
+ * @brief Class around native certificates.
+ *
+ */
+
+#include <QByteArray>
+#include <QString>
+
+#ifdef Q_OS_WIN
+#include <windows.h>
+#include <wincrypt.h>
+#endif
+
+class Certificate
+{
+public:
+    /** @brief construct a certificate from an X509 ASN1 encoded byte array.
+     **/
+    Certificate(const QByteArray& asn1data);
+
+    ~Certificate();
+
+    /** @brief check if this certificate could be parsed */
+    bool isValid() {return mValid;}
+
+    /** @brief get a short description of the certificate
+     *
+     *  This description should be used as a short overview
+     *  for this certificate
+     *
+     **/
+    QString shortDescription();
+
+private:
+    bool mValid;
+    QString mShortDescription;
+
+#ifdef Q_OS_WIN
+    PCCERT_CONTEXT mPCertContext;
+#endif
+};
+#endif

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