iobroker.admin 6.2.2 → 6.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +3 -3
  2. package/io-package.json +13 -13
  3. package/package.json +1 -1
  4. package/www/asset-manifest.json +7 -7
  5. package/www/index.html +1 -1
  6. package/www/js/adapter-settings.js +55 -57
  7. package/www/lib/js/crypto-js/aes.js +234 -0
  8. package/www/lib/js/crypto-js/bower.json +39 -0
  9. package/www/lib/js/crypto-js/cipher-core.js +890 -0
  10. package/www/lib/js/crypto-js/core.js +807 -0
  11. package/www/lib/js/crypto-js/crypto-js.js +6191 -0
  12. package/www/lib/js/crypto-js/enc-base64.js +136 -0
  13. package/www/lib/js/crypto-js/enc-base64url.js +140 -0
  14. package/www/lib/js/crypto-js/enc-hex.js +18 -0
  15. package/www/lib/js/crypto-js/enc-latin1.js +18 -0
  16. package/www/lib/js/crypto-js/enc-utf16.js +149 -0
  17. package/www/lib/js/crypto-js/enc-utf8.js +18 -0
  18. package/www/lib/js/crypto-js/evpkdf.js +134 -0
  19. package/www/lib/js/crypto-js/format-hex.js +66 -0
  20. package/www/lib/js/crypto-js/format-openssl.js +18 -0
  21. package/www/lib/js/crypto-js/hmac-md5.js +18 -0
  22. package/www/lib/js/crypto-js/hmac-ripemd160.js +18 -0
  23. package/www/lib/js/crypto-js/hmac-sha1.js +18 -0
  24. package/www/lib/js/crypto-js/hmac-sha224.js +18 -0
  25. package/www/lib/js/crypto-js/hmac-sha256.js +18 -0
  26. package/www/lib/js/crypto-js/hmac-sha3.js +18 -0
  27. package/www/lib/js/crypto-js/hmac-sha384.js +18 -0
  28. package/www/lib/js/crypto-js/hmac-sha512.js +18 -0
  29. package/www/lib/js/crypto-js/hmac.js +143 -0
  30. package/www/lib/js/crypto-js/index.js +18 -0
  31. package/www/lib/js/crypto-js/lib-typedarrays.js +76 -0
  32. package/www/lib/js/crypto-js/md5.js +268 -0
  33. package/www/lib/js/crypto-js/mode-cfb.js +80 -0
  34. package/www/lib/js/crypto-js/mode-ctr-gladman.js +116 -0
  35. package/www/lib/js/crypto-js/mode-ctr.js +58 -0
  36. package/www/lib/js/crypto-js/mode-ecb.js +40 -0
  37. package/www/lib/js/crypto-js/mode-ofb.js +54 -0
  38. package/www/lib/js/crypto-js/package.json +70 -0
  39. package/www/lib/js/crypto-js/pad-ansix923.js +49 -0
  40. package/www/lib/js/crypto-js/pad-iso10126.js +44 -0
  41. package/www/lib/js/crypto-js/pad-iso97971.js +40 -0
  42. package/www/lib/js/crypto-js/pad-nopadding.js +30 -0
  43. package/www/lib/js/crypto-js/pad-pkcs7.js +18 -0
  44. package/www/lib/js/crypto-js/pad-zeropadding.js +47 -0
  45. package/www/lib/js/crypto-js/pbkdf2.js +145 -0
  46. package/www/lib/js/crypto-js/rabbit-legacy.js +190 -0
  47. package/www/lib/js/crypto-js/rabbit.js +192 -0
  48. package/www/lib/js/crypto-js/rc4.js +139 -0
  49. package/www/lib/js/crypto-js/ripemd160.js +267 -0
  50. package/www/lib/js/crypto-js/sha1.js +150 -0
  51. package/www/lib/js/crypto-js/sha224.js +80 -0
  52. package/www/lib/js/crypto-js/sha256.js +199 -0
  53. package/www/lib/js/crypto-js/sha3.js +326 -0
  54. package/www/lib/js/crypto-js/sha384.js +83 -0
  55. package/www/lib/js/crypto-js/sha512.js +326 -0
  56. package/www/lib/js/crypto-js/tripledes.js +779 -0
  57. package/www/lib/js/crypto-js/x64-core.js +304 -0
  58. package/www/static/js/{5710.66d0a0cb.chunk.js → 5710.44014f30.chunk.js} +2 -2
  59. package/www/static/js/{5710.66d0a0cb.chunk.js.map → 5710.44014f30.chunk.js.map} +1 -1
  60. package/www/static/js/8596.eecce458.chunk.js +3 -0
  61. package/www/static/js/8596.eecce458.chunk.js.map +1 -0
  62. package/www/static/js/{main.dec36354.js → main.d3df889c.js} +2 -2
  63. package/www/static/js/{main.dec36354.js.map → main.d3df889c.js.map} +1 -1
  64. package/www/static/js/8596.ff72c56e.chunk.js +0 -3
  65. package/www/static/js/8596.ff72c56e.chunk.js.map +0 -1
package/README.md CHANGED
@@ -108,6 +108,9 @@ The icons may not be reused in other projects without the proper flaticon licens
108
108
  -->
109
109
 
110
110
  ## Changelog
111
+ ### 6.2.3 (2022-07-18)
112
+ * (AlCalzone) Implemented AES-192 encryption and decryption in GUI
113
+
111
114
  ### 6.2.2 (2022-07-18)
112
115
  * (bluefox) Corrected JSON config table and login page
113
116
 
@@ -122,9 +125,6 @@ The icons may not be reused in other projects without the proper flaticon licens
122
125
  * (bluefox) Fixed GUI issues
123
126
  * (bluefox) Release candidate 1
124
127
 
125
- ### 6.1.10 (2022-07-04)
126
- * (bluefox) Fixed issue with map
127
-
128
128
  ## License
129
129
  The MIT License (MIT)
130
130
 
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "admin",
4
- "version": "6.2.2",
4
+ "version": "6.2.3",
5
5
  "titleLang": {
6
6
  "en": "Admin",
7
7
  "de": "Admin",
@@ -18,6 +18,18 @@
18
18
  "connectionType": "local",
19
19
  "dataSource": "push",
20
20
  "news": {
21
+ "6.2.3": {
22
+ "en": "Implemented AES-192 encryption and decryption in GUI",
23
+ "de": "AES-192 Verschlüsselung und Entschlüsselung in GUI",
24
+ "ru": "Реализовано шифрование AES-192 и расшифровка в GUI",
25
+ "pt": "Implementado criptografia AES-192 e descriptografia em GUI",
26
+ "nl": "Vertaling:",
27
+ "fr": "Mise en œuvre du chiffrement et du décryptage AES-192 dans GUI",
28
+ "it": "Implementato AES-192 crittografia e decrittografia in GUI",
29
+ "es": "Cifrado y descifrado AES-192 implementado en GUI",
30
+ "pl": "Poprawione szyfrowanie AES-192 oraz deszyfrowanie w GUI",
31
+ "zh-cn": "AES-192 加密和加密集团"
32
+ },
21
33
  "6.2.2": {
22
34
  "en": "Corrected JSON config table and login page",
23
35
  "de": "JSON config Tabelle und Anmeldeseite korrigiert",
@@ -89,18 +101,6 @@
89
101
  "es": "Alguna GUI arreglado",
90
102
  "pl": "Niektóre rozwiązania GUI",
91
103
  "zh-cn": "一些古伊特公司做的"
92
- },
93
- "6.1.8": {
94
- "en": "Corrected the host update instructions",
95
- "de": "Korrektur der Host-Update-Anweisungen",
96
- "ru": "Исправлена инструкция по обновлению хоста",
97
- "pt": "Corrigido as instruções de atualização do host",
98
- "nl": "Vertaling:",
99
- "fr": "Correction des instructions de mise à jour de l'hôte",
100
- "it": "Corretto le istruzioni di aggiornamento dell'host",
101
- "es": "Corregido las instrucciones de actualización del host",
102
- "pl": "Poprawiona procedura aktualizacji hosta",
103
- "zh-cn": "修改东道国政府最新指示"
104
104
  }
105
105
  },
106
106
  "desc": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iobroker.admin",
3
3
  "description": "The adapter opens a webserver for the ioBroker admin UI.",
4
- "version": "6.2.2",
4
+ "version": "6.2.3",
5
5
  "contributors": [
6
6
  "bluefox <dogafox@gmail.com>",
7
7
  "apollon77",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "files": {
3
- "main.js": "./static/js/main.dec36354.js",
3
+ "main.js": "./static/js/main.d3df889c.js",
4
4
  "static/css/5710.d6229a1b.chunk.css": "./static/css/5710.d6229a1b.chunk.css",
5
- "static/js/5710.66d0a0cb.chunk.js": "./static/js/5710.66d0a0cb.chunk.js",
5
+ "static/js/5710.44014f30.chunk.js": "./static/js/5710.44014f30.chunk.js",
6
6
  "static/js/6090.d1503f4f.chunk.js": "./static/js/6090.d1503f4f.chunk.js",
7
7
  "static/js/9039.4c211996.chunk.js": "./static/js/9039.4c211996.chunk.js",
8
8
  "static/js/2652.9a062c3e.chunk.js": "./static/js/2652.9a062c3e.chunk.js",
@@ -176,7 +176,7 @@
176
176
  "static/js/4191.a518a3ff.chunk.js": "./static/js/4191.a518a3ff.chunk.js",
177
177
  "static/js/2486.a8ed5e8f.chunk.js": "./static/js/2486.a8ed5e8f.chunk.js",
178
178
  "static/js/6322.763e2306.chunk.js": "./static/js/6322.763e2306.chunk.js",
179
- "static/js/8596.ff72c56e.chunk.js": "./static/js/8596.ff72c56e.chunk.js",
179
+ "static/js/8596.eecce458.chunk.js": "./static/js/8596.eecce458.chunk.js",
180
180
  "worker-xquery.js": "./744aef747001c7b433be1c2506249a70.js",
181
181
  "static/media/wizard-welcome.jpg": "./static/media/wizard-welcome.06f62f65d3031a66f279.jpg",
182
182
  "worker-javascript.js": "./542e43220c9098c8a7c5bcb91772c1bd.js",
@@ -769,9 +769,9 @@
769
769
  "jsx.js": "./ffd3b83e8b5878f4785591ff54b1dfff.js",
770
770
  "d.js": "./70074e0c785c9a808dea76c7c7d17af3.js",
771
771
  "mode-text.js": "./25718a469574ade47e23567d8c543169.js",
772
- "main.dec36354.js.map": "./static/js/main.dec36354.js.map",
772
+ "main.d3df889c.js.map": "./static/js/main.d3df889c.js.map",
773
773
  "5710.d6229a1b.chunk.css.map": "./static/css/5710.d6229a1b.chunk.css.map",
774
- "5710.66d0a0cb.chunk.js.map": "./static/js/5710.66d0a0cb.chunk.js.map",
774
+ "5710.44014f30.chunk.js.map": "./static/js/5710.44014f30.chunk.js.map",
775
775
  "6090.d1503f4f.chunk.js.map": "./static/js/6090.d1503f4f.chunk.js.map",
776
776
  "9039.4c211996.chunk.js.map": "./static/js/9039.4c211996.chunk.js.map",
777
777
  "2652.9a062c3e.chunk.js.map": "./static/js/2652.9a062c3e.chunk.js.map",
@@ -946,9 +946,9 @@
946
946
  "4191.a518a3ff.chunk.js.map": "./static/js/4191.a518a3ff.chunk.js.map",
947
947
  "2486.a8ed5e8f.chunk.js.map": "./static/js/2486.a8ed5e8f.chunk.js.map",
948
948
  "6322.763e2306.chunk.js.map": "./static/js/6322.763e2306.chunk.js.map",
949
- "8596.ff72c56e.chunk.js.map": "./static/js/8596.ff72c56e.chunk.js.map"
949
+ "8596.eecce458.chunk.js.map": "./static/js/8596.eecce458.chunk.js.map"
950
950
  },
951
951
  "entrypoints": [
952
- "static/js/main.dec36354.js"
952
+ "static/js/main.d3df889c.js"
953
953
  ]
954
954
  }
package/www/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="admin - ioBroker"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="stylesheet" href="./css/leaflet.css"/><link rel="manifest" href="./manifest.json"/><script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./lib/js/socket.io.js"></script><script type="text/javascript" src="./lib/js/sparkline.js"></script><title>Admin</title><script>window.loginHideLogo="@@loginHideLogo@@",window.loginMotto="@@loginMotto@@",window.login="@@auth@@",window.loginLogo="@@loginLogo@@",window.loginLink="@@loginLink@@",window.loginTitle="@@loginTitle@@",window.loginBackgroundColor="@@loginBackgroundColor@@",window.loginBackgroundImage="@@loginBackgroundImage@@",window.vendorPrefix="@@vendorPrefix@@",window.disableDataReporting="@@disableDataReporting@@",window.loadingBackgroundColor="@@loadingBackgroundColor@@",window.loadingBackgroundImage="@@loadingBackgroundImage@@",window.loadingHideLogo="@@loadingHideLogo@@"</script><style>.root{background-color:rgba(255,255,255,.87);border-radius:10px}.unsupported{width:200px;background-color:#aaa;margin:auto;margin-top:3rem;padding:10px;line-height:25px;border-radius:4px;text-align:center}.leaflet-container{height:400px;width:100%}</style><script>setTimeout((()=>{const o=document.body;window.location.search.includes("?login")?(window.loginBackgroundColor&&-1===window.loginBackgroundColor.indexOf("loginBackgroundColor")&&(o.style.backgroundColor=window.loginBackgroundColor),window.loginBackgroundImage&&-1===window.loginBackgroundImage.indexOf("loginBackgroundImage")&&(o.style.backgroundImage="url("+window.loginBackgroundImage+")",o.style.backgroundSize="cover")):(window.loadingBackgroundColor&&-1===window.loadingBackgroundColor.indexOf("loadingBackgroundColor")&&(o.style.backgroundColor=window.loadingBackgroundColor),window.loadingBackgroundImage&&-1===window.loadingBackgroundImage.indexOf("loadingBackgroundImage")&&(o.style.backgroundImage="url("+window.loadingBackgroundImage+")",o.style.backgroundSize="cover"))}),0),window.addEventListener("load",(function o(n){window.removeEventListener("load",o,!1);if(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./)){const o=document.getElementById("root");o.classList.add("unsupported"),o.innerHTML="Browser is not supported. Please use Firefox or Chrome."}}),!1)</script><script defer="defer" src="./static/js/main.dec36354.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="admin - ioBroker"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="stylesheet" href="./css/leaflet.css"/><link rel="manifest" href="./manifest.json"/><script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./lib/js/socket.io.js"></script><script type="text/javascript" src="./lib/js/sparkline.js"></script><title>Admin</title><script>window.loginHideLogo="@@loginHideLogo@@",window.loginMotto="@@loginMotto@@",window.login="@@auth@@",window.loginLogo="@@loginLogo@@",window.loginLink="@@loginLink@@",window.loginTitle="@@loginTitle@@",window.loginBackgroundColor="@@loginBackgroundColor@@",window.loginBackgroundImage="@@loginBackgroundImage@@",window.vendorPrefix="@@vendorPrefix@@",window.disableDataReporting="@@disableDataReporting@@",window.loadingBackgroundColor="@@loadingBackgroundColor@@",window.loadingBackgroundImage="@@loadingBackgroundImage@@",window.loadingHideLogo="@@loadingHideLogo@@"</script><style>.root{background-color:rgba(255,255,255,.87);border-radius:10px}.unsupported{width:200px;background-color:#aaa;margin:auto;margin-top:3rem;padding:10px;line-height:25px;border-radius:4px;text-align:center}.leaflet-container{height:400px;width:100%}</style><script>setTimeout((()=>{const o=document.body;window.location.search.includes("?login")?(window.loginBackgroundColor&&-1===window.loginBackgroundColor.indexOf("loginBackgroundColor")&&(o.style.backgroundColor=window.loginBackgroundColor),window.loginBackgroundImage&&-1===window.loginBackgroundImage.indexOf("loginBackgroundImage")&&(o.style.backgroundImage="url("+window.loginBackgroundImage+")",o.style.backgroundSize="cover")):(window.loadingBackgroundColor&&-1===window.loadingBackgroundColor.indexOf("loadingBackgroundColor")&&(o.style.backgroundColor=window.loadingBackgroundColor),window.loadingBackgroundImage&&-1===window.loadingBackgroundImage.indexOf("loadingBackgroundImage")&&(o.style.backgroundImage="url("+window.loadingBackgroundImage+")",o.style.backgroundSize="cover"))}),0),window.addEventListener("load",(function o(n){window.removeEventListener("load",o,!1);if(window.navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./)){const o=document.getElementById("root");o.classList.add("unsupported"),o.innerHTML="Browser is not supported. Please use Firefox or Chrome."}}),!1)</script><script defer="defer" src="./static/js/main.d3df889c.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -424,6 +424,34 @@ function preInit () {
424
424
  }
425
425
  }
426
426
 
427
+ function _load(native, onChange) {
428
+ load(native, onChange);
429
+
430
+ // init selects
431
+ if (isMaterialize) {
432
+ $('select').select();
433
+ M.updateTextFields();
434
+
435
+ // workaround for materialize checkbox problem
436
+ $('input[type="checkbox"]+span').off('click').on('click', function (event) {
437
+ var $input = $(this).prev();
438
+ if (!$input.prop('disabled')) {
439
+ $input.prop('checked', !$input.prop('checked')).trigger('change');
440
+ // prevent propagation to prevent original handling from reverting our value change
441
+ event.preventDefault();
442
+ event.stopImmediatePropagation();
443
+ }
444
+ });
445
+ }
446
+ }
447
+
448
+ function loadScript(src, onload) {
449
+ var script = document.createElement('script');
450
+ script.onload = onload
451
+ script.src = src;
452
+ document.getElementsByTagName('head')[0].appendChild(script);
453
+ }
454
+
427
455
  function loadSettings(callback) {
428
456
  socket.emit('getObject', id, async function (err, res) {
429
457
  if (!err && res && res.native) {
@@ -436,11 +464,16 @@ function preInit () {
436
464
  } else {
437
465
  // decode all native attributes listed in res.encryptedNative
438
466
  if (res.encryptedNative && typeof res.encryptedNative === 'object' && res.encryptedNative instanceof Array) {
439
- for (var i = 0; i < res.encryptedNative.length; i++) {
440
- if (res.native[res.encryptedNative[i]]) {
441
- res.native[res.encryptedNative[i]] = await decrypt(res.native[res.encryptedNative[i]]);
467
+ // load crypto library
468
+ loadScript('../../lib/js/crypto-js/crypto-js.js', function () {
469
+ for (var i = 0; i < res.encryptedNative.length; i++) {
470
+ if (res.native[res.encryptedNative[i]]) {
471
+ res.native[res.encryptedNative[i]] = decrypt(res.native[res.encryptedNative[i]]);
472
+ }
442
473
  }
443
- }
474
+
475
+ _load(res.native, onChange);
476
+ });
444
477
  } else {
445
478
  var idx = supportedFeatures.indexOf('ADAPTER_AUTO_DECRYPT_NATIVE');
446
479
  if (idx !== -1) {
@@ -449,23 +482,7 @@ function preInit () {
449
482
  }
450
483
  }
451
484
 
452
- load(res.native, onChange);
453
- // init selects
454
- if (isMaterialize) {
455
- $('select').select();
456
- M.updateTextFields();
457
-
458
- // workaround for materialize checkbox problem
459
- $('input[type="checkbox"]+span').off('click').on('click', function (event) {
460
- var $input = $(this).prev();
461
- if (!$input.prop('disabled')) {
462
- $input.prop('checked', !$input.prop('checked')).trigger('change');
463
- // prevent propagation to prevent original handling from reverting our value change
464
- event.preventDefault();
465
- event.stopImmediatePropagation();
466
- }
467
- });
468
- }
485
+ _load(res.native, onChange);
469
486
  }
470
487
  if (typeof callback === 'function') {
471
488
  callback();
@@ -2421,7 +2438,7 @@ function decryptLegacy(key, value) {
2421
2438
  key = systemSecret;
2422
2439
  }
2423
2440
  var result = '';
2424
- for(var i = 0; i < value.length; i++) {
2441
+ for (var i = 0; i < value.length; i++) {
2425
2442
  result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
2426
2443
  }
2427
2444
  return result;
@@ -2472,40 +2489,23 @@ async function decrypt(key, value) {
2472
2489
  }
2473
2490
 
2474
2491
  // if not encrypted as aes-192 or key not a valid 48 digit hex -> fallback
2475
- if (!value.startsWith(`$/aes-256-cbc:`) || !/^[0-9a-f]{64}$/.test(key)) {
2492
+ if (!value.startsWith(`$/aes-192-cbc:`) || !/^[0-9a-f]{48}$/.test(key)) {
2476
2493
  return decryptLegacy(key, value);
2477
2494
  }
2478
2495
 
2496
+ // algorithm:iv:encryptedValue
2479
2497
  var textParts = value.split(':', 3);
2480
- // var algorithm = textParts[0];
2481
- var valueEncBytes = new Uint8Array(hex2array(textParts[2]));
2482
-
2483
- var iv = new Uint8Array(hex2array(textParts[1]));
2484
- var _key = await window.crypto.subtle.importKey('raw', hex2array(key), { name: 'AES-CBC' }, true, ['encrypt', 'decrypt']);
2485
- var dec = await window.crypto.subtle.decrypt({ name: 'AES-CBC', iv }, _key, valueEncBytes.buffer);
2486
- var decBytes = new Uint8Array(dec);
2487
- return new TextDecoder().decode(decBytes);
2488
- }
2489
2498
 
2490
- function hex2array(hex) {
2491
- var bytes = new Uint8Array(Math.ceil(hex.length / 2));
2492
- for (var i = 0; i < bytes.length; i++) {
2493
- bytes[i] = parseInt(hex.substr(i * 2, 2), 16);
2494
- }
2495
- return bytes;
2496
- }
2499
+ var _key = CryptoJS.enc.Hex.parse(key);
2500
+ var iv = CryptoJS.enc.Hex.parse(textParts[1]);
2497
2501
 
2498
- function array2hex(bytes) {
2499
- var convertedBack = '';
2500
- for (var i = 0; i < bytes.length; i++) {
2501
- if (bytes[i] < 16) {
2502
- convertedBack += '0';
2503
- }
2504
- convertedBack += bytes[i].toString(16);
2505
- }
2502
+ var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Hex.parse(textParts[2]) });
2503
+
2504
+ var decryptedBinary = CryptoJS.AES.decrypt(cipherParams, _key, { iv: iv });
2506
2505
 
2507
- return convertedBack;
2506
+ return CryptoJS.enc.Utf8.stringify(decryptedBinary);
2508
2507
  }
2508
+
2509
2509
  /**
2510
2510
  * Encrypt the password/value with given key
2511
2511
  * Usage:
@@ -2522,6 +2522,7 @@ function array2hex(bytes) {
2522
2522
  * ```
2523
2523
  * @param {string} key - Secret key
2524
2524
  * @param {string} value - value to encrypt
2525
+ * @param {string} _iv - optional initial vector for tests
2525
2526
  * @returns {string}
2526
2527
  */
2527
2528
  async function encrypt(key, value, _iv) {
@@ -2534,25 +2535,22 @@ async function encrypt(key, value, _iv) {
2534
2535
  return value;
2535
2536
  }
2536
2537
 
2537
- if (!/^[0-9a-f]{64}$/.test(key)) {
2538
+ if (!/^[0-9a-f]{48}$/.test(key)) {
2538
2539
  // key length is not matching for AES-192-CBC or key is no valid hex - fallback to old encryption
2539
2540
  return encryptLegacy(key, value);
2540
2541
  }
2541
2542
 
2542
- var valueBytes = new TextEncoder().encode(value);
2543
2543
  var iv;
2544
2544
  if (_iv) {
2545
- iv = hex2array(_iv);
2545
+ iv = CryptoJS.enc.Hex.parse(_iv);
2546
2546
  } else {
2547
- iv = new Uint8Array(16);
2548
- window.crypto.getRandomValues(iv);
2547
+ iv = CryptoJS.lib.WordArray.random(128 / 8);
2549
2548
  }
2550
2549
 
2551
- var _key = await window.crypto.subtle.importKey('raw', hex2array(key), { name: 'AES-CBC' }, true, ['encrypt', 'decrypt']);
2552
- var enc = await window.crypto.subtle.encrypt({name: 'AES-CBC', iv}, _key, valueBytes);
2553
- var encBytes = new Uint8Array(enc);
2550
+ var _key = CryptoJS.enc.Hex.parse(key);
2551
+ var encrypted = CryptoJS.AES.encrypt(value, _key, { iv: iv }).ciphertext;
2554
2552
 
2555
- return `$/aes-256-cbc:${array2hex(iv)}:${array2hex(encBytes)}`;
2553
+ return `$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(iv)}:${encrypted}`;
2556
2554
  }
2557
2555
 
2558
2556
  // current Theme Style for Adapter CSS settings
@@ -0,0 +1,234 @@
1
+ ;(function (root, factory, undef) {
2
+ if (typeof exports === "object") {
3
+ // CommonJS
4
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ // AMD
8
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
9
+ }
10
+ else {
11
+ // Global (browser)
12
+ factory(root.CryptoJS);
13
+ }
14
+ }(this, function (CryptoJS) {
15
+
16
+ (function () {
17
+ // Shortcuts
18
+ var C = CryptoJS;
19
+ var C_lib = C.lib;
20
+ var BlockCipher = C_lib.BlockCipher;
21
+ var C_algo = C.algo;
22
+
23
+ // Lookup tables
24
+ var SBOX = [];
25
+ var INV_SBOX = [];
26
+ var SUB_MIX_0 = [];
27
+ var SUB_MIX_1 = [];
28
+ var SUB_MIX_2 = [];
29
+ var SUB_MIX_3 = [];
30
+ var INV_SUB_MIX_0 = [];
31
+ var INV_SUB_MIX_1 = [];
32
+ var INV_SUB_MIX_2 = [];
33
+ var INV_SUB_MIX_3 = [];
34
+
35
+ // Compute lookup tables
36
+ (function () {
37
+ // Compute double table
38
+ var d = [];
39
+ for (var i = 0; i < 256; i++) {
40
+ if (i < 128) {
41
+ d[i] = i << 1;
42
+ } else {
43
+ d[i] = (i << 1) ^ 0x11b;
44
+ }
45
+ }
46
+
47
+ // Walk GF(2^8)
48
+ var x = 0;
49
+ var xi = 0;
50
+ for (var i = 0; i < 256; i++) {
51
+ // Compute sbox
52
+ var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
53
+ sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
54
+ SBOX[x] = sx;
55
+ INV_SBOX[sx] = x;
56
+
57
+ // Compute multiplication
58
+ var x2 = d[x];
59
+ var x4 = d[x2];
60
+ var x8 = d[x4];
61
+
62
+ // Compute sub bytes, mix columns tables
63
+ var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
64
+ SUB_MIX_0[x] = (t << 24) | (t >>> 8);
65
+ SUB_MIX_1[x] = (t << 16) | (t >>> 16);
66
+ SUB_MIX_2[x] = (t << 8) | (t >>> 24);
67
+ SUB_MIX_3[x] = t;
68
+
69
+ // Compute inv sub bytes, inv mix columns tables
70
+ var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
71
+ INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
72
+ INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
73
+ INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
74
+ INV_SUB_MIX_3[sx] = t;
75
+
76
+ // Compute next counter
77
+ if (!x) {
78
+ x = xi = 1;
79
+ } else {
80
+ x = x2 ^ d[d[d[x8 ^ x2]]];
81
+ xi ^= d[d[xi]];
82
+ }
83
+ }
84
+ }());
85
+
86
+ // Precomputed Rcon lookup
87
+ var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
88
+
89
+ /**
90
+ * AES block cipher algorithm.
91
+ */
92
+ var AES = C_algo.AES = BlockCipher.extend({
93
+ _doReset: function () {
94
+ var t;
95
+
96
+ // Skip reset of nRounds has been set before and key did not change
97
+ if (this._nRounds && this._keyPriorReset === this._key) {
98
+ return;
99
+ }
100
+
101
+ // Shortcuts
102
+ var key = this._keyPriorReset = this._key;
103
+ var keyWords = key.words;
104
+ var keySize = key.sigBytes / 4;
105
+
106
+ // Compute number of rounds
107
+ var nRounds = this._nRounds = keySize + 6;
108
+
109
+ // Compute number of key schedule rows
110
+ var ksRows = (nRounds + 1) * 4;
111
+
112
+ // Compute key schedule
113
+ var keySchedule = this._keySchedule = [];
114
+ for (var ksRow = 0; ksRow < ksRows; ksRow++) {
115
+ if (ksRow < keySize) {
116
+ keySchedule[ksRow] = keyWords[ksRow];
117
+ } else {
118
+ t = keySchedule[ksRow - 1];
119
+
120
+ if (!(ksRow % keySize)) {
121
+ // Rot word
122
+ t = (t << 8) | (t >>> 24);
123
+
124
+ // Sub word
125
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
126
+
127
+ // Mix Rcon
128
+ t ^= RCON[(ksRow / keySize) | 0] << 24;
129
+ } else if (keySize > 6 && ksRow % keySize == 4) {
130
+ // Sub word
131
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
132
+ }
133
+
134
+ keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
135
+ }
136
+ }
137
+
138
+ // Compute inv key schedule
139
+ var invKeySchedule = this._invKeySchedule = [];
140
+ for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
141
+ var ksRow = ksRows - invKsRow;
142
+
143
+ if (invKsRow % 4) {
144
+ var t = keySchedule[ksRow];
145
+ } else {
146
+ var t = keySchedule[ksRow - 4];
147
+ }
148
+
149
+ if (invKsRow < 4 || ksRow <= 4) {
150
+ invKeySchedule[invKsRow] = t;
151
+ } else {
152
+ invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
153
+ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
154
+ }
155
+ }
156
+ },
157
+
158
+ encryptBlock: function (M, offset) {
159
+ this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
160
+ },
161
+
162
+ decryptBlock: function (M, offset) {
163
+ // Swap 2nd and 4th rows
164
+ var t = M[offset + 1];
165
+ M[offset + 1] = M[offset + 3];
166
+ M[offset + 3] = t;
167
+
168
+ this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
169
+
170
+ // Inv swap 2nd and 4th rows
171
+ var t = M[offset + 1];
172
+ M[offset + 1] = M[offset + 3];
173
+ M[offset + 3] = t;
174
+ },
175
+
176
+ _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
177
+ // Shortcut
178
+ var nRounds = this._nRounds;
179
+
180
+ // Get input, add round key
181
+ var s0 = M[offset] ^ keySchedule[0];
182
+ var s1 = M[offset + 1] ^ keySchedule[1];
183
+ var s2 = M[offset + 2] ^ keySchedule[2];
184
+ var s3 = M[offset + 3] ^ keySchedule[3];
185
+
186
+ // Key schedule row counter
187
+ var ksRow = 4;
188
+
189
+ // Rounds
190
+ for (var round = 1; round < nRounds; round++) {
191
+ // Shift rows, sub bytes, mix columns, add round key
192
+ var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
193
+ var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
194
+ var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
195
+ var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
196
+
197
+ // Update state
198
+ s0 = t0;
199
+ s1 = t1;
200
+ s2 = t2;
201
+ s3 = t3;
202
+ }
203
+
204
+ // Shift rows, sub bytes, add round key
205
+ var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
206
+ var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
207
+ var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
208
+ var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
209
+
210
+ // Set output
211
+ M[offset] = t0;
212
+ M[offset + 1] = t1;
213
+ M[offset + 2] = t2;
214
+ M[offset + 3] = t3;
215
+ },
216
+
217
+ keySize: 256/32
218
+ });
219
+
220
+ /**
221
+ * Shortcut functions to the cipher's object interface.
222
+ *
223
+ * @example
224
+ *
225
+ * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
226
+ * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
227
+ */
228
+ C.AES = BlockCipher._createHelper(AES);
229
+ }());
230
+
231
+
232
+ return CryptoJS.AES;
233
+
234
+ }));
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "crypto-js",
3
+ "version": "4.1.1",
4
+ "description": "JavaScript library of crypto standards.",
5
+ "license": "MIT",
6
+ "homepage": "http://github.com/brix/crypto-js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "http://github.com/brix/crypto-js.git"
10
+ },
11
+ "keywords": [
12
+ "security",
13
+ "crypto",
14
+ "Hash",
15
+ "MD5",
16
+ "SHA1",
17
+ "SHA-1",
18
+ "SHA256",
19
+ "SHA-256",
20
+ "RC4",
21
+ "Rabbit",
22
+ "AES",
23
+ "DES",
24
+ "PBKDF2",
25
+ "HMAC",
26
+ "OFB",
27
+ "CFB",
28
+ "CTR",
29
+ "CBC",
30
+ "Base64",
31
+ "Base64url"
32
+ ],
33
+ "main": "index.js",
34
+ "dependencies": {},
35
+ "browser": {
36
+ "crypto": false
37
+ },
38
+ "ignore": []
39
+ }