#pragma once #include "identitymanager.h" #include "nvhttp.h" #include #include #include class NvPairingManager { public: enum PairState { PAIRED, PIN_WRONG, FAILED, ALREADY_IN_PROGRESS }; explicit NvPairingManager(QString address); ~NvPairingManager(); PairState pair(QString appVersion, QString pin); private: QByteArray generateRandomBytes(int length); QByteArray saltPin(QByteArray salt, QString pin); QByteArray encrypt(QByteArray plaintext, AES_KEY* key); QByteArray decrypt(QByteArray ciphertext, AES_KEY* key); QByteArray getSignatureFromPemCert(QByteArray certificate); bool verifySignature(QByteArray data, QByteArray signature, QByteArray serverCertificate); QByteArray signMessage(QByteArray message); NvHTTP m_Http; X509* m_Cert; EVP_PKEY* m_PrivateKey; };