std::string DecryptSymmetrical(const std::string& key, const TBuffer& data) { assert(key.size() == AES::MAX_KEYLENGTH + AES::BLOCKSIZE); string result; result.resize(data.Size()); CFB_Mode<AES>::Decryption cfbDecryption((byte*)key.data(), AES::MAX_KEYLENGTH, (byte*)key.data() + AES::MAX_KEYLENGTH); cfbDecryption.ProcessData((byte*)result.data(), (byte*)data.Data(), data.Size()); return result; }
void TClient::SendOfflineMessage(const string& friendLogin, const TBuffer& data) { string response; response.resize(1); response[0] = RT_SendMessage; TOfflineMessage offlineMessage; offlineMessage.set_friendlogin(friendLogin); offlineMessage.set_encryptedmessage(data.Data(), data.Size()); response += offlineMessage.SerializeAsString(); response = EncryptSymmetrical(State.sessionkey(), Compress(response)); UdtClient->Send(Serialize(response)); }
void TVocaGuiApp::OnCaptcha(const TBuffer& data) { qDebug() << Q_FUNC_INFO; QImage captchaImage; captchaImage.loadFromData((const unsigned char*)data.Data(), data.Size()); emit CaptchaAvailable(captchaImage); }