diff --git a/CHANGES.md b/CHANGES.md index 6bc785403..a3aa42da5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ - #3005: Fix MUC messages with a fallback body not rendering. - #3007: Fix links becoming text when a message is edited - #3018: Fix MUC icons not functioning. +- #3028: Fix encrypted media from Conversations/Quicksy not properly decrypting ## 9.1.1 (2022-05-05) diff --git a/src/plugins/omemo/utils.js b/src/plugins/omemo/utils.js index cc5686f83..8a462310b 100644 --- a/src/plugins/omemo/utils.js +++ b/src/plugins/omemo/utils.js @@ -166,7 +166,6 @@ async function downloadFile(url) { } async function getAndDecryptFile (uri) { - const hash = uri.hash().slice(1); const protocol = (window.location.hostname === 'localhost' && uri.domain() === 'localhost') ? 'http' : 'https'; const http_url = uri.toString().replace(/^aesgcm/, protocol); const cipher = await downloadFile(http_url); @@ -174,8 +173,10 @@ async function getAndDecryptFile (uri) { log.error(`Could not decrypt a received encrypted file ${uri.toString()} since it could not be downloaded`); return new Error(__('Error: could not decrypt a received encrypted file, because it could not be downloaded')); } - const iv = hash.slice(0, 24); - const key = hash.slice(24); + + const hash = uri.hash().slice(1); + const key = hash.substring(hash.length-64); + const iv = hash.replace(key, ''); let content; try { content = await decryptFile(iv, key, cipher);