forked from Cutehacks/duperagent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssl.h
67 lines (52 loc) · 1.68 KB
/
ssl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2016 Cutehacks AS. All rights reserved.
// License can be found in the LICENSE file.
#ifndef SSLCERTIFICATE_H
#define SSLCERTIFICATE_H
#include <QObject>
#include <QtNetwork/QSslConfiguration>
#include <QtNetwork/QSslCertificate>
#include <QtQml/QJSValue>
class QQmlEngine;
namespace com { namespace cutehacks { namespace duperagent {
class SslCertificate : public QObject
{
Q_OBJECT
Q_PROPERTY(QJSValue subject READ subject)
Q_PROPERTY(QJSValue issuerInfo READ issuerInfo)
Q_PROPERTY(QJSValue issuer READ issuer)
Q_PROPERTY(QByteArray raw READ raw)
Q_PROPERTY(QDateTime valid_from READ valid_from)
Q_PROPERTY(QDateTime valid_to READ valid_to)
Q_PROPERTY(QString fingerprint READ fingerprint)
Q_PROPERTY(QString serialNumber READ serialNumber)
public:
explicit SslCertificate(QQmlEngine *m_engine, const QSslCertificate&);
inline QJSValue self() const { return m_self; }
QJSValue subject() const;
QJSValue issuerInfo() const;
QJSValue issuer() const;
QByteArray raw() const;
QDateTime valid_from() const;
QDateTime valid_to() const;
QString fingerprint() const;
QString serialNumber() const;
private:
QJSValue m_self;
QQmlEngine *m_engine;
QSslCertificate m_cert;
};
class SecureConnectEvent : public QObject {
Q_OBJECT
public:
explicit SecureConnectEvent(QQmlEngine *, const QSslConfiguration&);
inline QJSValue self() const { return m_self; }
Q_INVOKABLE QJSValue getPeerCertificate();
Q_INVOKABLE QString getProtocol();
Q_INVOKABLE QJSValue getCipher();
private:
QJSValue m_self;
QQmlEngine *m_engine;
QSslConfiguration m_ssl;
};
} } }
#endif // SSLCERTIFICATE_H