we use seedbytes

This commit is contained in:
DenioD
2020-06-02 01:56:28 +02:00
parent 04575afd5a
commit ce3120dcd1
2 changed files with 17 additions and 15 deletions

View File

@@ -429,8 +429,9 @@ Tx MainWindow::createTxFromChatPage() {
////////////////Generate the secretkey for our message encryption ////////////////Generate the secretkey for our message encryption
const QByteArray ba2 = QByteArray::fromHex(hashEncryptionKey.toLatin1()); char *hashEncryptionKeyraw = NULL;
const unsigned char *hashEncryptionKeyraw = reinterpret_cast<const unsigned char *>(ba2.constData()); hashEncryptionKeyraw = new char[length+1];
strncpy(hashEncryptionKeyraw, hashEncryptionKey.toLocal8Bit(), length +1);
#define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw) #define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw)
#define MESSAGEAS1_LEN length #define MESSAGEAS1_LEN length
@@ -732,15 +733,15 @@ Tx MainWindow::createTxForSafeContactRequest()
QString memo = contactRequest.getMemo(); QString memo = contactRequest.getMemo();
// QString privkey = rpc->fetchPrivKey(myAddr); // QString privkey = rpc->fetchPrivKey(myAddr);
QString passphrase = this->getPassword(); QString passphrase = this->getPassword();
QString hashEncryptionKey = passphrase; QString hashEncryptionKey = "Test";
int length = hashEncryptionKey.length(); int length = hashEncryptionKey.length();
qDebug()<<"Encryption String :"<<hashEncryptionKey; qDebug()<<"Encryption String :"<<hashEncryptionKey;
////////////////Generate the secretkey for our message encryption ////////////////Generate the secretkey for our message encryption
char *hashEncryptionKeyraw = NULL;
const QByteArray ba2 = QByteArray::fromHex(hashEncryptionKey.toLatin1()); hashEncryptionKeyraw = new char[length+1];
const unsigned char *hashEncryptionKeyraw = reinterpret_cast<const unsigned char *>(ba2.constData()); strncpy(hashEncryptionKeyraw, hashEncryptionKey.toLocal8Bit(), length +1);
#define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw) #define MESSAGEAS1 ((const unsigned char *) hashEncryptionKeyraw)
#define MESSAGEAS1_LEN length #define MESSAGEAS1_LEN length

View File

@@ -993,8 +993,9 @@ void Controller::refreshTransactions() {
////////////////Generate the secretkey for our message encryption ////////////////Generate the secretkey for our message encryption
const QByteArray ba2 = QByteArray::fromHex(hashEncryptionKey.toLatin1()); char *hashEncryptionKeyraw = NULL;
const unsigned char *hashEncryptionKeyraw = reinterpret_cast<const unsigned char *>(ba2.constData()); hashEncryptionKeyraw = new char[length+1];
strncpy(hashEncryptionKeyraw, hashEncryptionKey.toLocal8Bit(), length +1);
const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1()); const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1());
const unsigned char *pubkeyBob = reinterpret_cast<const unsigned char *>(pubkeyBobArray.constData()); const unsigned char *pubkeyBob = reinterpret_cast<const unsigned char *>(pubkeyBobArray.constData());
@@ -1006,7 +1007,7 @@ void Controller::refreshTransactions() {
#define MESSAGEAS1_LEN length #define MESSAGEAS1_LEN length
unsigned char hash1[crypto_kx_SECRETKEYBYTES]; unsigned char hash1[crypto_kx_SEEDBYTES];
crypto_hash_sha256(hash1,MESSAGEAS1, MESSAGEAS1_LEN); crypto_hash_sha256(hash1,MESSAGEAS1, MESSAGEAS1_LEN);
unsigned char sk[crypto_kx_SECRETKEYBYTES]; unsigned char sk[crypto_kx_SECRETKEYBYTES];
@@ -1266,15 +1267,15 @@ void Controller::refreshTransactions() {
qDebug()<<"Encryption String :"<<hashEncryptionKey; qDebug()<<"Encryption String :"<<hashEncryptionKey;
char *cidchar = NULL; char *hashEncryptionKeyraw = NULL;
cidchar = new char[lengthcid+1]; hashEncryptionKeyraw = new char[length+1];
strncpy(cidchar, cid.toLocal8Bit(), lengthcid +1); strncpy(hashEncryptionKeyraw, hashEncryptionKey.toLocal8Bit(), length +1);
if ((memo.startsWith("{") == false) && (headerbytes > 0)) if ((memo.startsWith("{") == false) && (headerbytes > 0))
{ {
const QByteArray ba2 = QByteArray::fromHex(hashEncryptionKey.toLatin1()); //const QByteArray ba2 = QByteArray::fromHex(hashEncryptionKey.toLatin1());
const unsigned char *hashEncryptionKeyraw = reinterpret_cast<const unsigned char *>(ba2.constData()); // const unsigned char *hashEncryptionKeyraw = reinterpret_cast<const unsigned char *>(ba2.constData());
const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1()); const QByteArray pubkeyBobArray = QByteArray::fromHex(publickey.toLatin1());
const unsigned char *pubkeyBob = reinterpret_cast<const unsigned char *>(pubkeyBobArray.constData()); const unsigned char *pubkeyBob = reinterpret_cast<const unsigned char *>(pubkeyBobArray.constData());
@@ -1284,7 +1285,7 @@ void Controller::refreshTransactions() {
#define MESSAGEAS1_LEN length #define MESSAGEAS1_LEN length
unsigned char hash1[crypto_kx_SECRETKEYBYTES]; unsigned char hash1[crypto_kx_SEEDBYTES];
crypto_hash_sha256(hash1,MESSAGEAS1, MESSAGEAS1_LEN); crypto_hash_sha256(hash1,MESSAGEAS1, MESSAGEAS1_LEN);
unsigned char sk[crypto_kx_SECRETKEYBYTES]; unsigned char sk[crypto_kx_SECRETKEYBYTES];