title: Use node crypto in angular 9
body: <p>My project was in Angular 6 and it had following lines of code</p>
  
  <pre><code>const crypto = require('crypto-js');
  const Buffer = require('buffer').Buffer;
  const decrypt = new Buffer(data.result.encr, 'base64');
  const privatekey = Buffer.from(data.result.pk, 'base64');
  this.decrypted = crypto.privateDecrypt(privatekey, decrypt).toString('utf-8');
  return this.decrypted;
  </code></pre>
  
  <p>Which was working fine.</p>
  
  <p>Now I migrated my code to Angular 9. And I find out that <code>crypto</code> has no longer support from NPM</p>
  
  <p><a href="https://www.npmjs.com/package/crypto" rel="nofollow noreferrer">https://www.npmjs.com/package/crypto</a></p>
  
  <p>It says that I have to use inbuild library of crypto. But I have no idea how to use it.</p>
  
  <p>I thought <code>crypto-js</code> would help me. But it didn't.</p>
  
  <p>If someone knows how to use <code>crypto</code> in Angular 9 or how to convert upper lines for <code>crypto-js</code> then it would be great.</p>
  
  <p>Note: Encryption is happening on server side using crypto only as they have nodejs.</p>
  
  <p>Thanks in advance.</p>