mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 19:04:27 +02:00
Bugfixes and CR
This commit is contained in:
parent
3c572b0f7a
commit
a4b8bf0be6
6 changed files with 21 additions and 12 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include <ResourceCache.h>
|
#include <ResourceCache.h>
|
||||||
#include <ScriptCache.h>
|
#include <ScriptCache.h>
|
||||||
#include <EntityEditFilters.h>
|
#include <EntityEditFilters.h>
|
||||||
|
#include <NetworkingConstants.h>
|
||||||
|
|
||||||
#include "AssignmentParentFinder.h"
|
#include "AssignmentParentFinder.h"
|
||||||
#include "EntityNodeData.h"
|
#include "EntityNodeData.h"
|
||||||
|
|
|
@ -84,9 +84,9 @@ private:
|
||||||
QMap<QUuid, QMap<QUuid, ViewerSendingStats>> _viewerSendingStats;
|
QMap<QUuid, QMap<QUuid, ViewerSendingStats>> _viewerSendingStats;
|
||||||
|
|
||||||
static const int DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 45 * 60 * 1000; // 45m
|
static const int DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 45 * 60 * 1000; // 45m
|
||||||
static const int DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 75 * 60 * 1000; // 1h15m
|
static const int DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 60 * 60 * 1000; // 1h
|
||||||
int _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 45m
|
int _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 45m
|
||||||
int _MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 1h15m
|
int _MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 1h
|
||||||
QTimer _dynamicDomainVerificationTimer;
|
QTimer _dynamicDomainVerificationTimer;
|
||||||
void startDynamicDomainVerification();
|
void startDynamicDomainVerification();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1266,8 +1266,8 @@
|
||||||
"name": "dynamicDomainVerificationTimeMax",
|
"name": "dynamicDomainVerificationTimeMax",
|
||||||
"label": "Dynamic Domain Verification Time (seconds) - Maximum",
|
"label": "Dynamic Domain Verification Time (seconds) - Maximum",
|
||||||
"help": "The upper limit on the amount of time that passes before Dynamic Domain Verification on entities occurs. Units are seconds.",
|
"help": "The upper limit on the amount of time that passes before Dynamic Domain Verification on entities occurs. Units are seconds.",
|
||||||
"placeholder": "4500",
|
"placeholder": "3600",
|
||||||
"default": "4500",
|
"default": "3600",
|
||||||
"advanced": true
|
"advanced": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -741,7 +741,7 @@ void Wallet::handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> pack
|
||||||
if (decryptionStatus != -1) {
|
if (decryptionStatus != -1) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
QByteArray decryptedTextByteArray = QByteArray(reinterpret_cast<char*>(decryptedText), decryptionStatus);
|
QByteArray decryptedTextByteArray = QByteArray(reinterpret_cast<const char*>(decryptedText), decryptionStatus);
|
||||||
int decryptedTextByteArraySize = decryptedTextByteArray.size();
|
int decryptedTextByteArraySize = decryptedTextByteArray.size();
|
||||||
int certIDSize = certID.size();
|
int certIDSize = certID.size();
|
||||||
// setup the packet
|
// setup the packet
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
|
#include <NetworkingConstants.h>
|
||||||
|
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
|
|
||||||
|
@ -1159,18 +1160,23 @@ void EntityTree::startPendingTransferStatusTimer(const QString& certID, const En
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray EntityTree::computeEncryptedNonce(const QString& certID, const QString ownerKey) {
|
QByteArray EntityTree::computeEncryptedNonce(const QString& certID, const QString ownerKey) {
|
||||||
QUuid nonce = QUuid::createUuid();
|
|
||||||
const auto text = reinterpret_cast<const unsigned char*>(qPrintable(nonce.toString()));
|
|
||||||
const unsigned int textLength = nonce.toString().length();
|
|
||||||
|
|
||||||
QString ownerKeyWithHeaders = ("-----BEGIN RSA PUBLIC KEY-----\n" + ownerKey + "\n-----END RSA PUBLIC KEY-----");
|
QString ownerKeyWithHeaders = ("-----BEGIN RSA PUBLIC KEY-----\n" + ownerKey + "\n-----END RSA PUBLIC KEY-----");
|
||||||
BIO* bio = BIO_new_mem_buf((void*)ownerKeyWithHeaders.toUtf8().constData(), -1);
|
BIO* bio = BIO_new_mem_buf((void*)ownerKeyWithHeaders.toUtf8().constData(), -1);
|
||||||
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); // NO NEWLINE
|
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); // NO NEWLINE
|
||||||
RSA* rsa = PEM_read_bio_RSAPublicKey(bio, NULL, NULL, NULL);
|
RSA* rsa = PEM_read_bio_RSAPublicKey(bio, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (rsa) {
|
if (rsa) {
|
||||||
|
QUuid nonce = QUuid::createUuid();
|
||||||
|
const unsigned int textLength = nonce.toString().length();
|
||||||
QByteArray encryptedText(RSA_size(rsa), 0);
|
QByteArray encryptedText(RSA_size(rsa), 0);
|
||||||
const int encryptStatus = RSA_public_encrypt(textLength, text, reinterpret_cast<unsigned char*>(encryptedText.data()), rsa, RSA_PKCS1_OAEP_PADDING);
|
const int encryptStatus = RSA_public_encrypt(textLength,
|
||||||
|
reinterpret_cast<const unsigned char*>(qPrintable(nonce.toString())),
|
||||||
|
reinterpret_cast<unsigned char*>(encryptedText.data()),
|
||||||
|
rsa,
|
||||||
|
RSA_PKCS1_OAEP_PADDING);
|
||||||
|
if (bio) {
|
||||||
|
BIO_free(bio);
|
||||||
|
}
|
||||||
RSA_free(rsa);
|
RSA_free(rsa);
|
||||||
if (encryptStatus == -1) {
|
if (encryptStatus == -1) {
|
||||||
long error = ERR_get_error();
|
long error = ERR_get_error();
|
||||||
|
@ -1181,10 +1187,13 @@ QByteArray EntityTree::computeEncryptedNonce(const QString& certID, const QStrin
|
||||||
|
|
||||||
QWriteLocker locker(&_certNonceMapLock);
|
QWriteLocker locker(&_certNonceMapLock);
|
||||||
_certNonceMap.insert(certID, nonce);
|
_certNonceMap.insert(certID, nonce);
|
||||||
|
|
||||||
qCDebug(entities) << "Challenging ownership of Cert ID" << certID << "by encrypting and sending nonce" << nonce << "to owner.";
|
qCDebug(entities) << "Challenging ownership of Cert ID" << certID << "by encrypting and sending nonce" << nonce << "to owner.";
|
||||||
|
|
||||||
return encryptedText;
|
return encryptedText;
|
||||||
} else {
|
} else {
|
||||||
|
if (bio) {
|
||||||
|
BIO_free(bio);
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <NetworkingConstants.h>
|
|
||||||
|
|
||||||
#include <Octree.h>
|
#include <Octree.h>
|
||||||
#include <SpatialParentFinder.h>
|
#include <SpatialParentFinder.h>
|
||||||
|
|
Loading…
Reference in a new issue