Commit dbfd4601 authored by JC Brand's avatar JC Brand

Don't include `additionalData` when en/decrypting with crypto.subtle

Otherwise compatibility with Conversations is broken.
Unfortunately this means that OMEMO won't work on Edge, because it
for some reason requires the additionalData.

References:
* https://github.com/conversejs/converse.js/issues/1187#issuecomment-426276243
* https://stackoverflow.com/questions/42933162/web-crypto-api-using-microsoft-edge-38-14393-0-0/42950731

Fixes #1187
parent 148eaeac
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
## 4.0.2 (Unreleased) ## 4.0.2 (Unreleased)
- M4A and WEBM files, when sent as XEP-0066 Out of Band Data, are now playable directly in chat - M4A and WEBM files, when sent as XEP-0066 Out of Band Data, are now playable directly in chat
- OMEMO fixes for Edge.
- Updated French and Spanish translations - Updated French and Spanish translations
- Two new languages supported, [Hindi](https://hosted.weblate.org/languages/hi/conversejs/) and [Romanian](https://hosted.weblate.org/languages/ro/conversejs/) - Two new languages supported, [Hindi](https://hosted.weblate.org/languages/hi/conversejs/) and [Romanian](https://hosted.weblate.org/languages/ro/conversejs/)
- #1187 UTF-8 characters have the wrong encoding when using OMEMO - #1187 UTF-8 characters have the wrong encoding when using OMEMO
......
...@@ -72906,7 +72906,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -72906,7 +72906,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
algo = { algo = {
'name': 'AES-GCM', 'name': 'AES-GCM',
'iv': iv, 'iv': iv,
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH 'tagLength': TAG_LENGTH
}, },
encrypted = await crypto.subtle.encrypt(algo, key, u.stringToArrayBuffer(plaintext)), encrypted = await crypto.subtle.encrypt(algo, key, u.stringToArrayBuffer(plaintext)),
...@@ -72929,7 +72928,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -72929,7 +72928,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
algo = { algo = {
'name': "AES-GCM", 'name': "AES-GCM",
'iv': u.base64ToArrayBuffer(obj.iv), 'iv': u.base64ToArrayBuffer(obj.iv),
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH 'tagLength': TAG_LENGTH
}; };
return u.arrayBufferToString((await crypto.subtle.decrypt(algo, key_obj, cipher))); return u.arrayBufferToString((await crypto.subtle.decrypt(algo, key_obj, cipher)));
...@@ -218,7 +218,6 @@ ...@@ -218,7 +218,6 @@
algo = { algo = {
'name': 'AES-GCM', 'name': 'AES-GCM',
'iv': iv, 'iv': iv,
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH 'tagLength': TAG_LENGTH
}, },
encrypted = await crypto.subtle.encrypt(algo, key, u.stringToArrayBuffer(plaintext)), encrypted = await crypto.subtle.encrypt(algo, key, u.stringToArrayBuffer(plaintext)),
...@@ -242,7 +241,6 @@ ...@@ -242,7 +241,6 @@
algo = { algo = {
'name': "AES-GCM", 'name': "AES-GCM",
'iv': u.base64ToArrayBuffer(obj.iv), 'iv': u.base64ToArrayBuffer(obj.iv),
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH 'tagLength': TAG_LENGTH
} }
return u.arrayBufferToString(await crypto.subtle.decrypt(algo, key_obj, cipher)); return u.arrayBufferToString(await crypto.subtle.decrypt(algo, key_obj, cipher));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment