title: How to encrypt & decrypt amazon seller api report document using nodejs
body: <p>seller api
  /reports/2020-09-04/documents/amzn1.tortuga.3.18666cbf-dfdf-dsfsd-bf4b-sdfdsfsdfsdf.TBWRJF481G44N</p>
  <p>response</p>
  <p>{
  &quot;payload&quot;: {
  &quot;reportDocumentId&quot;: &quot;amzn1.tortuga.3.18666cbf-dfdf-dsfsd-bf4b-sdfdsfsdfsdf.TBWRJF481G44N&quot;,
  &quot;encryptionDetails&quot;: {
  &quot;standard&quot;: &quot;AES&quot;,
  &quot;initializationVector&quot;: &quot;nG2rSrj1Ra9e03IStEBkdg==&quot;,
  &quot;key&quot;: &quot;9CT0qwtzUHLXlFTh0aLxk4qSQYAJ7texG8KDIZ0JSy8=&quot;
  },
  &quot;url&quot;: &quot;https://tortuga-prod-eu.s3-eu-west-1.amazonaws.com/%2FNinetyDays/amzn1.tortuga.3.18666cbf-e671-asds-sdfs-dsfdsfdsfds.sdvfdsdssdfsd?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Date=20201208T192515Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Expires=300&amp;X-Amz-Credential=dscfdsfsdfsdfdsfsdf%2F20201208%2Feu-west-1%2Fs3%2Faws4_request&amp;X-Amz-Signature=45hjkkjkjdfdsfsd4545jkkjhkj4554j&quot;
  }
  }</p>
  <hr />
  <p>decryption nodejs code</p>
  <hr />
  <p>const crypto = require('crypto');</p>
  <p>const algorithm = 'AES';</p>
  <p>const key = '9CT0qwtzUHLXlFTh0aLxk4qSQYAJ7texG8KDIZ0JSy8=';
  const iv = 'nG2rSrj1Ra9e03IStEBkdg==';</p>
  <p>const decipher = crypto.createDecipheriv(algorithm, key, iv);</p>
  <hr />
  <p>Error - Invalid IV length</p>
  <hr />