From d8d8fc7a0d139e7b864eee3b573bd208f823ad4f Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 19 Oct 2014 18:45:03 +0200 Subject: initial import, no crypto --- wmspeer.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 wmspeer.h (limited to 'wmspeer.h') diff --git a/wmspeer.h b/wmspeer.h new file mode 100644 index 0000000..446e747 --- /dev/null +++ b/wmspeer.h @@ -0,0 +1,46 @@ +#ifndef WMSPEER_H +#define WMSPEER_H + +#include +#include + +#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 -- cgit v1.2.3