Member-only story
Encryption in React JS and Native and Node js using node-forge
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
- Generate AES encryption key in frontend (React, React native)
- Generate RSA public and private keys in backend (Node.js)
- Share the RSA public key with frontend
- Encrypt the AES key with RSA public key
- Encrypt the data to send with AES key
- Send the encrypted data and encrypted AES key to backend
- Backend will use RSA private key to decrypt encrypted AES key to retrieve AES key
- 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…