title: RSA library with angular
body: <p>Hello I am trying to implement encryption in my application. I am using angular (angular-4) for the frontend and node js for the backend. Communication is done through socket.io through custom commands. But basically what I am stuck at is finding an appropriate library for RSA encryption in client side. client will first request server for an RSA public key. Server responds with key but now I cannot find any library suitable to encrypt data with RSA using this public key. I have tried node-rsa. Following is a code sn</p>
  
  <pre><code>import * as NodeRSA from 'node-rsa';
  
  @Injectable()
  
  export class SecurityService {
      RSA: any
      initializeRSA(key: string) {
          this.RSA = new NodeRSA();
          this.RSA.importKey(key)
          console.log(this.RSA.encrypt('Hello World'));
      }
  </code></pre>
  
  <p>But I am receiving this error.</p>
  
  <pre><code>Error during encryption. Original error: TypeError: crypt.createHash is not a function
  at NodeRSA.webpackJsonp.../../../../node-rsa/src/NodeRSA.js.module.exports.NodeRSA.$$encrypt
  </code></pre>
  
  <p>Help would be very much appreciated.</p>