Browse Source

Fix message type metadata leakage in websocket protocol

pull/140/head
Duke Leto 4 years ago
parent
commit
6f230c90af
  1. 6
      src/websockets.cpp

6
src/websockets.cpp

@ -480,7 +480,11 @@ void AppDataServer::saveNonceHex(NonceType nt, QString noncehex) {
// Encrypt an outgoing message with the stored secret key.
QString AppDataServer::encryptOutgoing(QString msg) {
int padding = 256;
// This padding size is ~50% larger than current largest
// message size and makes all current message types
// indistinguishable. If some new message type can
// be larger than this, the padding should probably be increased
int padding = 16*1024;
qDebug() << "Encrypt msg(pad="<<padding<<") prepad len=" << msg.length();
if (msg.length() % padding > 0) {
msg = msg + QString(" ").repeated(padding - (msg.length() % padding));

Loading…
Cancel
Save