A Java project with a modern Swing desktop app and a deploy-ready web API for encryption/decryption with multiple algorithms.
Report Bug
Β·
Request Feature
- Overview
- Technologies Used
- Features
- Demo
- Project Structure
- API Endpoints
- API Examples
- Deploy to Render
- Testing
- Getting Started
- Usage
- Roadmap
- Contributing
- License
- Contact
Encryption-and-Decryption includes:
- A Java Swing desktop UI for interactive demos
- A tiny JSON web API for deployment (Render-ready)
Users can:
- Select an algorithm
- Generate encryption keys
- Encrypt/decrypt text via UI or HTTP API
- Copy output instantly
- Toggle dark/light theme
- Java
- Swing (Desktop GUI)
- Java
HttpServer(Web API) - Java Cryptography APIs (
javax.crypto,java.security) - Maven
- JUnit 4
- Checkstyle
- π Encrypt/decrypt text using AES, DES, RSA, and Caesar
- π Algorithm dropdown for fast switching
- π One-click key generation
- π₯ Live web UI demo at
/(interactive browser client) - π Tiny JSON API:
/api/key,/api/encrypt,/api/decrypt - βοΈ JDK-only backend (
HttpServer+ Java crypto APIs) - π Render deployment via
render.yaml - π Copy output button for shareable demo results
- π Dark/light theme toggle
- β Status feedback for success/error states
π Live: https://encryption-api-4yib.onrender.com/
encryption-and-decryption/
βββ README.md
βββ LICENSE
βββ pom.xml
βββ Dockerfile
βββ render.yaml
βββ checkstyle.xml
βββ .github/
β βββ workflows/
β βββ ci.yml
βββ src/
βββ main/
β βββ java/
β βββ ApiServer.java
β βββ CryptoService.java
β βββ JsonUtil.java
β βββ Main.java
β βββ MyFrame.java
βββ test/
βββ java/
βββ ButtonActionsTests.java
βββ CryptoServiceTests.java
βββ FunctionalityTests.java
βββ GuiRenderingTests.javaGET /- interactive live demo UIGET /health- health checkGET /api/info- API metadata + endpoint listPOST /api/key- generate algorithm-specific key materialPOST /api/encrypt- encrypt plaintextPOST /api/decrypt- decrypt ciphertext
Example request payload:
{
"algorithm": "AES",
"text": "Hello World",
"key": "optional-base64-key",
"publicKey": "optional-base64-rsa-public-key",
"privateKey": "optional-base64-rsa-private-key",
"shift": 7
}Quick curl flow:
# 1) Generate an AES key
curl -X POST http://localhost:8080/api/key \
-H "Content-Type: application/json" \
-d '{"algorithm":"AES"}'
# 2) Encrypt with AES key (replace KEY_VALUE)
curl -X POST http://localhost:8080/api/encrypt \
-H "Content-Type: application/json" \
-d '{"algorithm":"AES","text":"Hello API","key":"KEY_VALUE"}'AES round-trip:
# Generate key
curl -s -X POST http://localhost:8080/api/key \
-H "Content-Type: application/json" \
-d '{"algorithm":"AES"}'
# => {"success":true,"algorithm":"AES","key":"..."}
# Encrypt
curl -s -X POST http://localhost:8080/api/encrypt \
-H "Content-Type: application/json" \
-d '{"algorithm":"AES","text":"portfolio-ready","key":"<AES_KEY_BASE64>"}'
# => {"success":true,"algorithm":"AES","result":"<IV_BASE64>:<CIPHERTEXT_BASE64>","key":"..."}
# Decrypt
curl -s -X POST http://localhost:8080/api/decrypt \
-H "Content-Type: application/json" \
-d '{"algorithm":"AES","text":"<IV_BASE64>:<CIPHERTEXT_BASE64>","key":"<AES_KEY_BASE64>"}'
# => {"success":true,"algorithm":"AES","result":"portfolio-ready"}RSA note:
- If
publicKeyis omitted on/api/encrypt, the API generates a new RSA key pair and returns both keys. /api/decryptrequiresprivateKeyfor RSA payloads.
This repo includes a Render Blueprint file (render.yaml).
- Push this project to GitHub.
- In Render, choose
New +->Blueprint. - Select the repo and deploy.
- Render builds and runs from
Dockerfile(runtime: dockerinrender.yaml). - Verify deployment at:
https://<your-render-service>.onrender.com/
https://<your-render-service>.onrender.com/health
Local Docker run (optional):
docker build -t encryption-api .
docker run --rm -p 8080:10000 -e PORT=10000 encryption-apiEnvironment:
- Render injects
PORT; locally the API defaults to8080.
Automated tests are included for:
- GUI rendering
- Button actions
- Core encryption/decryption flows
Run tests:
mvn test- JDK 21
- Maven 3.9+
- macOS, Linux, or Windows with Java GUI support
- Clone the repo:
git clone https://github.com/SpencerVJones/Encryption-and-Decryption.git- Move into the project:
cd Encryption-and-Decryption- Build:
mvn clean compileBuild and launch:
mvn clean compile
java -cp target/classes Main- Click
Generate Key - Enter text in the input box
- Click
EncryptorDecrypt - Use
Copyto copy results
Build a runnable jar and start the API:
mvn clean package -DskipTests
java -jar target/EncrptionProgram-1.0-SNAPSHOT.jarThen test:
curl http://localhost:8080/api/info
curl http://localhost:8080/healthOpen http://localhost:8080/ in your browser for the live UI.
Use this project for:
- Live browser demos hosted on Render
- Desktop demonstrations of encryption workflows
- Backend/API demos with deployable crypto endpoints
- Portfolio projects showing full-stack delivery (local app + cloud API)
- Add file encryption/decryption support
- Add key export/import options
- Add persistence for recent operations
- Expand automated test coverage
- Package native installers for macOS/Windows/Linux
See open issues for a full list of proposed features (and known issues).
Contributions are welcome! Feel free to submit issues or pull requests with bug fixes, improvements, or new features.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Spencer Jones
π§ jonesspencer99@icloud.com
π GitHub Profile
π Project Repository