From 443a15eeb95be355a32a77c42af0fe2f523147aa Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Wed, 24 Apr 2019 18:09:23 -0400 Subject: [PATCH] actually clear bit 63 instead of bit 55 --- src/utils/MegolmExportEncryption.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/MegolmExportEncryption.js b/src/utils/MegolmExportEncryption.js index 01c521da0c..2f2fc4cca7 100644 --- a/src/utils/MegolmExportEncryption.js +++ b/src/utils/MegolmExportEncryption.js @@ -147,7 +147,7 @@ export async function encryptMegolmKeyFile(data, password, options) { // clear bit 63 of the IV to stop us hitting the 64-bit counter boundary // (which would mean we wouldn't be able to decrypt on Android). The loss // of a single bit of iv is a price we have to pay. - iv[9] &= 0x7f; + iv[8] &= 0x7f; const [aesKey, hmacKey] = await deriveKeys(salt, kdfRounds, password); const encodedData = new TextEncoder().encode(data);