blob: 446e7474b1289e79f90aca1574c6d5251ba96fc6 (
plain)
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
|
#ifndef WMSPEER_H
#define WMSPEER_H
#include <QtCore/QObject>
#include <openssl/ec.h>
#include "saprotocol.h"
class WMSPeer : public QObject
{
Q_OBJECT
public:
WMSPeer(SAProtocol::Role role, const QString &localName, const QString &peerName, QObject *parent = 0);
~WMSPeer();
SAProtocol::SecurityFrame respondToServerChallenge(const SAProtocol::SecurityFrame &challenge);
bool verifyServerResponse(const SAProtocol::SecurityFrame &challenge);
private:
bool generateEccKey();
QByteArray computeSharedSecret(const QByteArray &remotePubKey) const;
QByteArray expandTemporaryKey();
static QByteArray getExpandedPskKey(quint16 index);
static QByteArray sha256(const QByteArray &message);
private:
EC_KEY *_key;
QByteArray _pubKey;
quint32 _id;
QString _serverName;
QString _clientName;
QByteArray _sharedSecret;
quint16 _clientTmpNum;
QByteArray _clientTmpKey;
quint16 _serverTmpNum;
QByteArray _serverTmpKey;
};
#endif // WMSPEER_H
|