A lightweight Java implementation of the Advanced Encryption Standard (AES) algorithm for encrypting and decrypting data. This project demonstrates symmetric-key cryptography using Java's built-in javax.crypto library.
- About the Project
- Features
- Project Structure
- Prerequisites
- Getting Started
- How It Works
- AES Overview
- Technologies Used
- Contributing
- License
The Java AES Encryption Engine provides a clean and straightforward implementation of AES encryption and decryption in Java. It is ideal for learning cryptographic concepts, prototyping secure data handling, or integrating encryption into Java-based applications.
- AES-based symmetric encryption and decryption
- Encodes encrypted output in Base64 for safe text representation
- Uses Java's standard
javax.cryptoandjava.securitylibraries (no external dependencies) - Modular package structure with clear separation of concerns (
main,key_management,cryptography_engine,file_io) - Eclipse-compatible project setup (
.classpathand.projectincluded)
Java-AES-Encryption-Engine/
├── src/com/aes
│ ├── main/
│ │ └── ApplicationMain.java # The Orchestrator — entry point, ties all modules together
│ │
│ ├── key_management/
│ │ └── KeyGeneratorUtil.java # The Vault — handles AES key generation and management
│ │
│ ├── cryptography_engine/
│ │ └── AESGCMCipher.java # The Grinder — performs AES-GCM encryption & decryption
│ │
│ └── file_io/
│ └── SecureFileStreamer.java # The Pipeline — manages secure file reading and writing
│
├── .classpath # Eclipse classpath configuration
├── .project # Eclipse project configuration
└── README.md
- Java JDK 8 or higher — Download here
- Eclipse IDE (optional, for IDE-based setup) — Download here
Verify your Java installation:
java -version
javac -versiongit clone https://github.com/harshraj005/Java-AES-Encryption-Engine.git
cd Java-AES-Encryption-Engine- Open Eclipse IDE.
- Go to File → Import → Existing Projects into Workspace.
- Browse to the cloned project folder and click Finish.
- Right-click
ApplicationMain.javainsidesrc/main/and select Run As → Java Application.
# Navigate to the src directory
cd src
# Compile all Java files across all packages
javac main/ApplicationMain.java key_management/KeyGeneratorUtil.java cryptography_engine/AESGCMCipher.java file_io/SecureFileStreamer.java
# Run the application
java main.ApplicationMainThe engine is split into four focused modules, each with a single responsibility:
| Module | Class | Role |
|---|---|---|
main |
ApplicationMain.java |
The Orchestrator — entry point that wires all modules together and drives the flow |
key_management |
KeyGeneratorUtil.java |
The Vault — generates and manages the AES secret key securely |
cryptography_engine |
AESGCMCipher.java |
The Grinder — performs AES-GCM authenticated encryption and decryption |
file_io |
SecureFileStreamer.java |
The Pipeline — handles reading plaintext input and writing encrypted output to files |
Encryption flow:
Input File → [SecureFileStreamer] → [KeyGeneratorUtil] → [AESGCMCipher] → Encrypted Output File
Decryption flow:
Encrypted File → [SecureFileStreamer] → [AESGCMCipher] → [KeyGeneratorUtil] → Decrypted Output File
AES-GCM (Galois/Counter Mode) provides both confidentiality (encryption) and integrity (authentication tag), making it more secure than plain AES-ECB or AES-CBC modes.
AES (Advanced Encryption Standard) is a symmetric block cipher adopted by the U.S. National Institute of Standards and Technology (NIST). Key characteristics:
| Property | Details |
|---|---|
| Type | Symmetric block cipher |
| Key sizes | 128, 192, or 256 bits |
| Block size | 128 bits |
| Standard | FIPS PUB 197 |
| Common modes | ECB, CBC, GCM ✅ (used here) |
AES operates through multiple rounds of substitution, permutation, and mixing steps to produce ciphertext that is computationally infeasible to reverse without the correct key.
- Java — Core language
- javax.crypto — Cipher, SecretKeySpec
- java.security — Key management
- java.util.Base64 — Encoding/decoding encrypted output
- Eclipse IDE — Development environment
Contributions are welcome! To contribute:
- Fork the repository
- Create a new branch:
git checkout -b feature/your-feature-name - Make your changes and commit:
git commit -m "Add your message" - Push to the branch:
git push origin feature/your-feature-name - Open a Pull Request
This project is open source. Feel free to use, modify, and distribute it for educational or personal use.
Author: harshraj005
Repository: Java-AES-Encryption-Engine