view ui/certificate.h @ 94:f1ebab8639dc

Do not save the x509 cert as a member variable
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 21 Mar 2014 10:06:50 +0000
parents ba8a548ff252
children 2551ad24d3c2
line wrap: on
line source
#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 a line of a certificate list.
     *
     * The first two characters of the string are expected to be
     * the command. I: or R:
     *
     *  @param[in] b64Line The line from the certificate list.
     **/
    Certificate(const QString& b64Line = QString());

    /** @brief check if this certificate could be parsed */
    bool isValid() const {return mValid;}

    /** @brief get a short description of the certificate
     *
     *  This description should be used as a short overview
     *  for this certificate
     *
     **/
    const QString& shortDescription() const {return mShortDescription;}

    /** @brief get details for the certificate
     *
     * Get the X509 information that is returned by x509_crt_info
     *
     **/
    const QString& details() const {return mDetails;}

    /** @brief get the line from which this certificate was constructed
     *
     * The resulting line includes the instruction e.g.
     *
     * I:BASE64ENCODEDATA...
     *
     **/
    const QString& base64Line() const {return mBaseLine;}

private:
    bool mValid;

    QString mDetails;
    QString mShortDescription;
    QString mBaseLine;
};
#endif

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