mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 21:05:04 +02:00
Send empty decrypted text if impossible to decrypt
This commit is contained in:
parent
19945c5991
commit
23e627a46f
1 changed files with 48 additions and 44 deletions
|
@ -718,6 +718,8 @@ bool Wallet::changePassphrase(const QString& newPassphrase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallet::handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
void Wallet::handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
bool challengeOriginatedFromClient = packet->getType() == PacketType::ChallengeOwnershipRequest;
|
bool challengeOriginatedFromClient = packet->getType() == PacketType::ChallengeOwnershipRequest;
|
||||||
unsigned char decryptedText[64];
|
unsigned char decryptedText[64];
|
||||||
int certIDByteArraySize;
|
int certIDByteArraySize;
|
||||||
|
@ -738,20 +740,25 @@ void Wallet::handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> pack
|
||||||
}
|
}
|
||||||
|
|
||||||
RSA* rsa = readKeys(keyFilePath().toStdString().c_str());
|
RSA* rsa = readKeys(keyFilePath().toStdString().c_str());
|
||||||
|
int decryptionStatus = -1;
|
||||||
|
|
||||||
if (rsa) {
|
if (rsa) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
|
||||||
|
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
const int decryptionStatus = RSA_private_decrypt(encryptedTextByteArraySize,
|
decryptionStatus = RSA_private_decrypt(encryptedTextByteArraySize,
|
||||||
reinterpret_cast<const unsigned char*>(encryptedText.constData()),
|
reinterpret_cast<const unsigned char*>(encryptedText.constData()),
|
||||||
decryptedText,
|
decryptedText,
|
||||||
rsa,
|
rsa,
|
||||||
RSA_PKCS1_OAEP_PADDING);
|
RSA_PKCS1_OAEP_PADDING);
|
||||||
|
|
||||||
RSA_free(rsa);
|
RSA_free(rsa);
|
||||||
|
} else {
|
||||||
|
qCDebug(commerce) << "During entity ownership challenge, creating the RSA object failed.";
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray decryptedTextByteArray = QByteArray(reinterpret_cast<const char*>(decryptedText), decryptionStatus);
|
QByteArray decryptedTextByteArray;
|
||||||
|
if (decryptionStatus > -1) {
|
||||||
|
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
|
||||||
|
@ -791,9 +798,6 @@ void Wallet::handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> pack
|
||||||
qCWarning(entities) << "RSA error:" << error_str;
|
qCWarning(entities) << "RSA error:" << error_str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
qCDebug(commerce) << "During entity ownership challenge, creating the RSA object failed.";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallet::account() {
|
void Wallet::account() {
|
||||||
|
|
Loading…
Reference in a new issue