From 1aed6e9ed004d11e2d8669ee462651541035ce57 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Tue, 2 Jun 2020 00:26:06 +0200 Subject: [PATCH] change server to client --- src/chatmodel.cpp | 8 +++++--- src/controller.cpp | 49 +++++++++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index f29be0f..69751ad 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -422,10 +422,10 @@ Tx MainWindow::createTxFromChatPage() { QString pubkey = this->getPubkeyByAddress(addr); QString passphrase = this->getPassword(); - QString hashEncryptionKey = passphrase; + QString hashEncryptionKey = "Test"; int length = hashEncryptionKey.length(); - qDebug()<<"Encryption String :"<(header), crypto_secretstream_xchacha20poly1305_HEADERBYTES).toHex(); QString publickeyAlice = QByteArray(reinterpret_cast(pk), crypto_kx_PUBLICKEYBYTES).toHex(); - QString hmemo= createHeaderMemo(type,cid,myAddr,publickeyAlice,headerbytes); + qDebug()<<"Headerbyte erstellung : "<(ciphertext), CIPHERTEXT_LEN).toHex(); diff --git a/src/controller.cpp b/src/controller.cpp index a4f315d..cd1c3e4 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -948,6 +948,7 @@ void Controller::refreshTransactions() { if (chatModel->getHeaderByTx(txid) != QString("0xdeadbeef")){ headerbytes = chatModel->getHeaderByTx(txid); + qDebug()<<"headerbytes outgoing found"<getPassword(); - QString hashEncryptionKey = passphrase; + QString hashEncryptionKey = "Test"; int length = hashEncryptionKey.length(); qDebug()<<"Encryption String :"<(ba2.constData()); - #define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw) - #define MESSAGEAS1_LEN length - const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1()); - const unsigned char *pubkeyBob = reinterpret_cast(pubkeyBobArray.constData()); + const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1()); + const unsigned char *pubkeyBob = reinterpret_cast(pubkeyBobArray.constData()); + + qDebug()<<"Pubkey benutzt incoming transaction:"<(ba1.constData()); + qDebug()<<"Header benutzt incoming transaction:"<getHeaderByTx(txid) != QString("0xdeadbeef")){ headerbytes = chatModel->getHeaderByTx(txid); + qDebug()<<"HEADERBYTE INCOMING"<getPassword(); - QString hashEncryptionKey = passphrase; + int lengthcid = cid.length(); + QString passphrase = main->getPassword(); + QString hashEncryptionKey = "Test"; int length = hashEncryptionKey.length(); qDebug()<<"Encryption String :"<(ba2.constData()); - #define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw) - #define MESSAGEAS1_LEN length - - const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1()); + + const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1()); const unsigned char *pubkeyBob = reinterpret_cast(pubkeyBobArray.constData()); #define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw)/////////// - #define MESSAGEAS1_LEN 12 + #define MESSAGEAS1_LEN length unsigned char hash1[crypto_kx_SECRETKEYBYTES]; @@ -1303,7 +1302,7 @@ void Controller::refreshTransactions() { /////Create the shared key for sending the message - if (crypto_kx_server_session_keys(client_rx, client_tx, + if (crypto_kx_client_session_keys(client_rx, client_tx, pk, sk, pubkeyBob) != 0) { /* Suspicious client public key, bail out */ }