title: Angular 7 AES encrypting password with crypt-js
body: <p>I am trying to encrypt the password using AES technique and sending it to api which is developed on .net. Issue I am facing is I am getting error: </p>
  
  <p>I am using Crypto-JS typed version: <a href="https://github.com/brix/crypto-js" rel="nofollow noreferrer">Crypto-JS Doc</a> </p>
  
  <blockquote>
    <p>Padding is invalid and cannot be removed.</p>
  </blockquote>
  
  <p>My typescript code is :</p>
  
  <pre><code>let encrypted = CryptoJS.AES.encrypt('Coll@123', '16ad55fd-598b-45d7-a371-a1e011ec1345', {iv: '6fcc45cc3a8a4764'}).ciphertext.toString();
  console.log("Encrypted: ", encrypted);
  let decrypted = CryptoJS.AES.decrypt(encrypted, "16ad55fd-598b-45d7-a371-a1e011ec1345", {iv: '6fcc45cc3a8a4764'}).toString(CryptoJS.enc.Base64)
  console.log("Decrypted: ", decrypted);
  </code></pre>
  
  <p>My .net code is :</p>
  
  <pre><code>public static string encrypt(string encryptString, string EncryptionKey)
  {
      Cryptography cript = new Cryptography();
      string ivString = AppConstants.EncryptionKey_IV_Default; //16 character IV
      string key = cript.getHashSha256(EncryptionKey, 32);
      string cipherText = cript.Encrypt(encryptString, key, ivString);
      return cipherText;
  }
  </code></pre>
  
  <p>Note: I have not developed the .net code I am consuming someone else API.</p>
  
  <p>Please help I dont know what I am doing wrong here. Is there something which I am missing here.</p>