Member-only story

Encryption in React JS and Native and Node js using node-forge

Anshu Sharma
3 min readSep 17, 2024

Choose the right module for encryption

Introduction

I would like to share a very interesting problem that i faced in my recent project regarding encryption and how I came up with a solution. First let me explain the encryption methodology used and dive deeper into the challenges. Important point to consider when developing a web and mobile application is compatibility. Whenever we design a feature or choose module or think about the solution, it need to have a holistic approach.It should be designed in such a way that it should work across all platforms.

Architecture of Encryption

  1. Generate AES encryption key in frontend (React, React native)
  2. Generate RSA public and private keys in backend (Node.js)
  3. Share the RSA public key with frontend
  4. Encrypt the AES key with RSA public key
  5. Encrypt the data to send with AES key
  6. Send the encrypted data and encrypted AES key to backend
  7. Backend will use RSA private key to decrypt encrypted AES key to retrieve AES key
  8. Use the retrieved AES key to decrypted the encrypted request data.

Backend will follow similar process to send the response back to the frontend. I will not be covering the entire process of what kind of cryptographical techniques are used to generate keys…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

Write a response