Strip space chars from recovery passphrase

This commit is contained in:
Nicolas Werner 2021-12-15 18:25:10 +01:00
parent 57d1dffdbd
commit 6d69248109
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -1103,7 +1103,13 @@ ChatPage::decryptDownloadedSecrets(mtx::secret_storage::AesHmacSha2KeyDescriptio
if (text.isEmpty())
return;
auto decryptionKey = mtx::crypto::key_from_recoverykey(text.toStdString(), keyDesc);
// strip space chars from a recovery key. It can't contain those, but some clients insert them
// to make them easier to read.
QString stripped = text;
stripped.remove(' ');
stripped.remove('\n');
stripped.remove('\t');
auto decryptionKey = mtx::crypto::key_from_recoverykey(stripped.toStdString(), keyDesc);
if (!decryptionKey && keyDesc.passphrase) {
try {