This repository contains a simple web application for text encryption and decryption using the AES-GCM encryption algorithm. The project is designed for educational purposes and demonstrates the basic principles of encryption and decryption in the browser.
- Text Encryption: Enter a text in the provided textarea and encrypt it using the AES-GCM encryption algorithm.
- Text Decryption: Decrypt the encrypted text and view the original message.
Before running the code, make sure you have the following installed:
- Node.js: Download
- npm (Node Package Manager): Typically installed with Node.js
- Python (for local server hosting): Download
-
Clone the repository to your local machine:
https://github.com/Yogeshhyogi/Text-Encryption.git
-
Navigate to the project directory:
cd Text-Encryption.git -
Install dependencies:
npm install
-
Client-side: Open a terminal and navigate to the
clientdirectory:cd src/client -
Start a local server:
python -m http.server
-
Open a web browser and go to
http://localhost:8000to access the application.
-
Open IntelliJ IDEA and import the project by selecting the
Text-Encryption.gitdirectory. -
Ensure that Node.js and npm are properly configured in IntelliJ IDEA.
-
Open the
index.htmlfile located insrc/clientand run it using a live server or by opening it in a web browser.
To host the webpage locally or make it accessible over the internet, follow these steps:
-
Hosting Locally: Follow the steps mentioned above in "Local Development."
-
Accessing Locally: Open a web browser and enter the local server's URL (e.g.,
http://localhost:8000). -
Hosting with Ngrok: Follow the instructions provided in the previous README file under the "Ngrok" section.
-
Host the Page Locally:
-
Make sure you have a simple web server installed on your machine. If you have Python installed, you can use the following command to start a basic server:
python -m http.server
This will start a server on port 8000 by default.
-
Place your HTML file and any associated assets (like images) in the directory where you run the command.
-
-
Find Your Local IP Address:
-
Open a command prompt or terminal.
-
Run the following command:
- On Windows:
ipconfig - On macOS/Linux:
ifconfigorip addr
- On Windows:
-
Look for an entry labeled "IPv4 Address" (Windows) or "inet" (macOS/Linux). It will look something like
192.168.x.xor10.x.x.x.
-
-
Access the Page Locally:
- Open a web browser on your machine.
- Enter the following address in the address bar:
Replace
http://localhost:80008000with the port number if you used a different one.
-
Access the Page from Another Device:
- Ensure that your machine's firewall allows incoming connections on the chosen port.
- Provide your friend with your local IP address and the port number.
- Your friend can access the page using the following address:
Replace
http://your-local-ip:8000your-local-ipwith the actual local IP address you found earlier, and8000with the port number.
Note: Keep in mind that this setup allows access only within the same local network. If you want to make it accessible over the internet, you'll need to consider port forwarding and potentially use services like Ngrok for tunneling.
After installed Ngrok , you can use it to make your locally hosted website accessible over the internet. Here are the steps:
-
Run Your Local Server:
- Start your local server (e.g.,
live-serveror any other server you are using) in the directory where your HTML file is located.
- Start your local server (e.g.,
-
Open a Terminal or Command Prompt:
- Navigate to the directory where Ngrok is installed or make sure the Ngrok executable is in your system's PATH.
-
Run Ngrok:
- Use the following command to start Ngrok and expose your local server to the internet. Replace
YOUR_PORTwith the port number your local server is running on (e.g., 8000):ngrok http YOUR_PORT
- Ngrok will generate a public URL (something like
https://randomstring.ngrok.io).
- Use the following command to start Ngrok and expose your local server to the internet. Replace
-
Share the Ngrok URL:
- Copy the generated Ngrok URL from the terminal.
- Share this URL with your friend, and they should be able to access your locally hosted website.
Now your friend can open the Ngrok URL in a web browser, and it will forward the requests to your local server.
Note:
- The Ngrok URL is temporary and may change every time you restart Ngrok. If you need a fixed subdomain, you might consider upgrading to Ngrok's paid plans.
- Keep the terminal running with Ngrok as long as you want the public access to your local server. Closing the terminal will stop the Ngrok tunnel.
Make sure to test the setup to ensure everything is working as expected. If you encounter any issues or have further questions, feel free to ask Feel free to explore, experiment, and contribute to this project! If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request.