Fixes #3028 Encrypted media not properly decrypting
Turns out that older versions Quicksy/Conversations use an IV of 16 bytes although the spec states 12
This commit is contained in:
parent
18d8b69f00
commit
40024f4599
|
@ -23,6 +23,7 @@
|
||||||
- #3005: Fix MUC messages with a fallback body not rendering.
|
- #3005: Fix MUC messages with a fallback body not rendering.
|
||||||
- #3007: Fix links becoming text when a message is edited
|
- #3007: Fix links becoming text when a message is edited
|
||||||
- #3018: Fix MUC icons not functioning.
|
- #3018: Fix MUC icons not functioning.
|
||||||
|
- #3028: Fix encrypted media from Conversations/Quicksy not properly decrypting
|
||||||
|
|
||||||
|
|
||||||
## 9.1.1 (2022-05-05)
|
## 9.1.1 (2022-05-05)
|
||||||
|
|
|
@ -166,7 +166,6 @@ async function downloadFile(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAndDecryptFile (uri) {
|
async function getAndDecryptFile (uri) {
|
||||||
const hash = uri.hash().slice(1);
|
|
||||||
const protocol = (window.location.hostname === 'localhost' && uri.domain() === 'localhost') ? 'http' : 'https';
|
const protocol = (window.location.hostname === 'localhost' && uri.domain() === 'localhost') ? 'http' : 'https';
|
||||||
const http_url = uri.toString().replace(/^aesgcm/, protocol);
|
const http_url = uri.toString().replace(/^aesgcm/, protocol);
|
||||||
const cipher = await downloadFile(http_url);
|
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`);
|
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'));
|
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;
|
let content;
|
||||||
try {
|
try {
|
||||||
content = await decryptFile(iv, key, cipher);
|
content = await decryptFile(iv, key, cipher);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user