title: how to properly decrypt text via Subtle Crypto which was encrypted via CryptoJS
body: <p>I have code that encrypts user's data using CryptoJS.AES, stores key, iv and encrypted content in different places.
  Also it decrypts encrypted content using stored key and iv by user demand.</p>
  <p>I want to use Subtle Crypto browser API for encryption,which is done.</p>
  <p>But I also want to have possibility to decrypt old data (that was ecnrypted using CryptoJS.AES) using Subtle Crypto.</p>
  <p>old data was generated with following code</p>
  <pre class="lang-js prettyprint-override"><code>  var CryptoJS = require(&quot;crypto-js/core&quot;);
    CryptoJS.AES = require(&quot;crypto-js/aes&quot;);
  
    let encKey = generateRandomString();
    let aesEncrypted = CryptoJS.AES.encrypt(content, encKey);
    let encrypted = {
      key: aesEncrypted.key.toString(),
      iv: aesEncrypted.iv.toString(),
      content: aesEncrypted.toString()
    };
  </code></pre>
  <p>and I've tried to decrypt it as following</p>
  <pre class="lang-js prettyprint-override"><code>  let keyArrayBuffer = hexArrayToArrayBuffer(sliceArray(encrypted.key, 2));
    let decKey = await importKey(keyArrayBuffer);
    let decIv = hexArrayToArrayBuffer(sliceArray(encrypted.iv, 2));
    let encContent = stringToArrayBuffer(encrypted.content);
    let decryptedByteArray = await crypto.subtle.decrypt(
      { name: &quot;AES-CBC&quot;, iv: decIv },
      decKey,
      encContent
    );
    let decrypted = new TextDecoder().decode(decrypted);
  </code></pre>
  <p>I receive <code>DOMException</code> error without backtrace on <code>await crypto.subtle.decrypt</code></p>
  <p>complete reproduction can be found at <a href="https://codesandbox.io/s/crypto-js-to-subtle-crypto-u0pgs?file=/src/index.js" rel="nofollow noreferrer">https://codesandbox.io/s/crypto-js-to-subtle-crypto-u0pgs?file=/src/index.js</a></p>