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
This commit is contained in:
JC Brand 2018-10-02 21:28:24 +02:00
parent 148eaeacf5
commit dbfd460125
3 changed files with 0 additions and 5 deletions

View File

@ -3,7 +3,6 @@
## 4.0.2 (Unreleased)
- 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
- 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

2
dist/converse.js vendored
View File

@ -72906,7 +72906,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
algo = {
'name': 'AES-GCM',
'iv': iv,
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH
},
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_
algo = {
'name': "AES-GCM",
'iv': u.base64ToArrayBuffer(obj.iv),
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH
};
return u.arrayBufferToString((await crypto.subtle.decrypt(algo, key_obj, cipher)));

View File

@ -218,7 +218,6 @@
algo = {
'name': 'AES-GCM',
'iv': iv,
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH
},
encrypted = await crypto.subtle.encrypt(algo, key, u.stringToArrayBuffer(plaintext)),
@ -242,7 +241,6 @@
algo = {
'name': "AES-GCM",
'iv': u.base64ToArrayBuffer(obj.iv),
'additionalData': new Uint8Array(1),
'tagLength': TAG_LENGTH
}
return u.arrayBufferToString(await crypto.subtle.decrypt(algo, key_obj, cipher));