Skip to content

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Encryption & Decryption Tool (Java Swing)

Java Swing AES PBKDF2 SHA-256 License

A secure Java desktop application for encrypting and decrypting text and files using modern cryptographic standards.


πŸ“Œ Overview

The Encryption & Decryption Tool is a desktop application developed in Java Swing that enables users to securely encrypt and decrypt both text and binary files using password-based encryption.

Unlike many academic encryption projects that only support text files, this application is designed to work with virtually any file type including:

  • PDF
  • DOCX
  • ZIP
  • PNG
  • JPG
  • EXE
  • MP4
  • MP3
  • TXT
  • and many more.

The project combines a user-friendly graphical interface with modern cryptographic techniques such as AES-256 GCM, PBKDF2, and SHA-256 to provide confidentiality, authentication, and integrity verification.


✨ Features

πŸ”’ Text Encryption

  • Encrypt plain text
  • Decrypt encrypted text
  • Password-based encryption
  • AES-GCM authenticated encryption
  • Base64 encoded encrypted output

πŸ“ File Encryption

Supports encryption and decryption of almost every file type:

  • πŸ“„ PDF
  • πŸ–Ό JPG
  • πŸ–Ό PNG
  • πŸ“¦ ZIP
  • πŸ“„ DOCX
  • 🎡 MP3
  • 🎬 MP4
  • βš™ EXE
  • πŸ“ƒ TXT
  • Any binary file

πŸ›‘ Security Features

  • AES-256 GCM Encryption
  • PBKDF2 Password Key Derivation
  • 120000 PBKDF2 Iterations
  • Random Salt Generation
  • Random Initialization Vector (IV)
  • SHA-256 Integrity Verification
  • Authentication Failure Detection
  • Password-Based Encryption
  • Binary-Safe Encryption
  • Secure Encrypted File Container

πŸ–₯ GUI Features

  • Java Swing Interface
  • Input Text Area
  • Output Text Area
  • Password Field
  • Encrypt Text Button
  • Decrypt Text Button
  • Encrypt File Button
  • Decrypt File Button
  • Copy Output Button
  • Clear Button
  • Status Bar
  • File Chooser Integration

πŸ“Έ Screenshots

Main Application

Replace these screenshots with your latest screenshots if necessary.

Main Window

Main GUI


Image Encryption

Image Encryption


PDF Encryption

PDF Encryption


ZIP Encryption

ZIP Encryption


πŸ— Project Architecture

                +--------------------+
                |   Java Swing GUI   |
                +---------+----------+
                          |
                          |
                          β–Ό
                 EncryptionFrame.java
                          |
                          |
                          β–Ό
            FileEncryptionService.java
                          |
                          |
                          β–Ό
                 CryptoUtils.java
                          |
      +-------------------+------------------+
      |                                      |
      β–Ό                                      β–Ό
 AES-256 GCM                         PBKDF2 Key Derivation
 Encryption                           SHA-256 Integrity

πŸ“‚ Project Structure

encryption-decryption-tool-java-gui
β”‚
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ phase7.png
β”‚   β”œβ”€β”€ imagenc.png
β”‚   β”œβ”€β”€ pdfenc.png
β”‚   └── zip.png
β”‚
β”œβ”€β”€ sample_files/
β”‚   β”œβ”€β”€ test.txt
β”‚   β”œβ”€β”€ test.txt.enc
β”‚   └── test.txt.enc.dec
β”‚
β”œβ”€β”€ src/
β”‚   β”‚
β”‚   β”œβ”€β”€ crypto/
β”‚   β”‚     β”œβ”€β”€ CryptoUtils.java
β”‚   β”‚     β”œβ”€β”€ CryptoException.java
β”‚   β”‚     └── DecryptedData.java (if separated)
β”‚   β”‚
β”‚   β”œβ”€β”€ service/
β”‚   β”‚     └── FileEncryptionService.java
β”‚   β”‚
β”‚   β”œβ”€β”€ gui/
β”‚   β”‚     └── EncryptionFrame.java
β”‚   β”‚
β”‚   β”œβ”€β”€ main/
β”‚   β”‚     β”œβ”€β”€ Main.java
β”‚   β”‚     └── CryptoTest.java
β”‚   β”‚
β”‚   └── utils/
β”‚         └── (Optional logging utilities)
β”‚
β”œβ”€β”€ README.md
└── LICENSE

πŸ›  Technology Stack

Category Technology
Language Java
GUI Java Swing
Encryption AES-256 GCM
Key Derivation PBKDF2WithHmacSHA256
Integrity SHA-256
Randomness SecureRandom
Build Tool javac
IDE VS Code / IntelliJ IDEA
Platform Windows / Linux / macOS

πŸ” Cryptography Used

AES-256 GCM

AES (Advanced Encryption Standard) is one of the world's most trusted symmetric encryption algorithms.

This project uses:

  • AES-256
  • GCM Mode
  • NoPadding

AES-GCM provides:

  • Confidentiality
  • Authentication
  • Integrity Protection

PBKDF2

Instead of directly using the password as an encryption key, this project derives a secure key using:

  • PBKDF2WithHmacSHA256
  • 120000 iterations
  • Random 16-byte salt
  • 256-bit key generation

This significantly improves resistance against brute-force and dictionary attacks.


SHA-256

SHA-256 is used to verify file integrity after decryption.

The application detects:

  • File tampering
  • Data corruption
  • Authentication failures
  • Wrong passwords

πŸš€ Key Highlights

  • Modern AES-GCM authenticated encryption
  • Binary-safe encryption for any file type
  • Password-based key derivation with PBKDF2
  • SHA-256 integrity verification
  • User-friendly Java Swing desktop interface
  • Clean modular project structure
  • Suitable for educational and portfolio purposes

βš™ Installation

Prerequisites

Before running the project, ensure the following software is installed:

  • Java JDK 17 or later
  • Git
  • VS Code / IntelliJ IDEA (Recommended)

Verify Java installation:

java -version
javac -version

πŸ“₯ Clone Repository

git clone https://github.com/vyawaha/encryption-decryption-tool-java-gui.git

Move into the project directory:

cd encryption-decryption-tool-java-gui

β–Ά Compile Project

Open Terminal / PowerShell inside the src directory.

cd src

javac crypto/*.java service/*.java gui/*.java main/*.java

β–Ά Run Application

java main.Main

The Java Swing GUI will launch.


πŸš€ How to Use

1️⃣ Text Encryption

  1. Launch the application.
  2. Enter plain text into the Input Text area.
  3. Enter a password.
  4. Click Encrypt Text.
  5. The encrypted output is displayed in the Output Text area.

2️⃣ Text Decryption

  1. Paste encrypted text into the Input Text area.
  2. Enter the same password used during encryption.
  3. Click Decrypt Text.
  4. The original text appears in the Output Text area.

3️⃣ File Encryption

  1. Click Encrypt File.
  2. Select any supported file.
  3. Enter a password.
  4. The encrypted file is saved with:
filename.ext.enc

Example:

report.pdf

becomes

report.pdf.enc

4️⃣ File Decryption

  1. Click Decrypt File.
  2. Select the encrypted file.

Example:

report.pdf.enc
  1. Enter the correct password.
  2. The decrypted file is restored.

πŸ“ Supported File Types

The application supports virtually every binary and text file format.

Category Examples
Documents PDF, DOC, DOCX, TXT
Images PNG, JPG, JPEG, BMP
Archives ZIP, RAR (as binary data)
Audio MP3, WAV
Video MP4, AVI
Executables EXE
Source Code Java, Python, C, C++, HTML
Others Any binary file

πŸ”„ Encryption Workflow

User Input
     β”‚
     β–Ό
Password
     β”‚
     β–Ό
PBKDF2 Key Derivation
     β”‚
     β–Ό
AES-256 GCM Encryption
     β”‚
     β–Ό
Encrypted Container
     β”‚
     β–Ό
Save .enc File

πŸ”“ Decryption Workflow

Encrypted File
      β”‚
      β–Ό
Read Container
      β”‚
      β–Ό
Verify Header
      β”‚
      β–Ό
Generate AES Key
      β”‚
      β–Ό
AES-GCM Authentication
      β”‚
      β–Ό
SHA-256 Integrity Check
      β”‚
      β–Ό
Restore Original File

πŸ“¦ Secure Encrypted File Format

Each encrypted file stores the following information:

+------------------------------------------------------+
| MAGIC HEADER                                         |
+------------------------------------------------------+
| VERSION                                               |
+------------------------------------------------------+
| ORIGINAL FILE NAME                                    |
+------------------------------------------------------+
| ORIGINAL FILE SIZE                                    |
+------------------------------------------------------+
| SHA-256 HASH                                          |
+------------------------------------------------------+
| RANDOM SALT                                            |
+------------------------------------------------------+
| RANDOM IV                                              |
+------------------------------------------------------+
| AES-GCM ENCRYPTED DATA                                 |
+------------------------------------------------------+

This design allows the application to validate encrypted files before decryption and detect corruption or incorrect passwords.


πŸ§ͺ Example Test Cases

βœ… Text Encryption

Input:

Hello Encryption Tool

Password:

password123

Output:

RU5DUg...

βœ… File Encryption

Input:

photo.jpg

Output:

photo.jpg.enc

βœ… PDF Encryption

Input:

document.pdf

Output:

document.pdf.enc

βœ… ZIP Encryption

Input:

archive.zip

Output:

archive.zip.enc

❌ Wrong Password

Attempting to decrypt with an incorrect password results in an authentication failure, preventing unauthorized access to the original data.


πŸ“ˆ Project Progress

Phase Status
Project Setup βœ…
Java Swing GUI βœ…
AES Encryption Module βœ…
GUI Integration βœ…
File Encryption βœ…
Binary Safe Encryption βœ…
Secure File Workflow βœ…
Secure Encryption Container βœ…

πŸ’‘ Design Principles

This project was built with the following objectives:

  • Modular architecture
  • Separation of GUI and cryptographic logic
  • Reusable encryption utilities
  • Binary-safe file processing
  • Password-based security
  • Clean and maintainable Java code
  • Beginner-friendly project structure suitable for learning and portfolio demonstration

πŸ“‚ Project Structure

encryption-decryption-tool-java-gui/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ crypto/
β”‚   β”‚   β”œβ”€β”€ CryptoUtils.java
β”‚   β”‚   β”œβ”€β”€ CryptoException.java
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ gui/
β”‚   β”‚   β”œβ”€β”€ EncryptionFrame.java
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ FileEncryptionService.java
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   └── main/
β”‚       β”œβ”€β”€ Main.java
β”‚       └── CryptoTest.java
β”‚
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ phase1.png
β”‚   β”œβ”€β”€ phase2.png
β”‚   β”œβ”€β”€ phase3.png
β”‚   β”œβ”€β”€ phase4.png
β”‚   β”œβ”€β”€ phase5.png
β”‚   β”œβ”€β”€ phase6.png
β”‚   β”œβ”€β”€ phase7.png
β”‚   β”œβ”€β”€ imagenc.png
β”‚   β”œβ”€β”€ pdfenc.png
β”‚   └── zip.png
β”‚
β”œβ”€β”€ sample_files/
β”‚
β”œβ”€β”€ README.md
β”‚
└── LICENSE

βš™οΈ Installation

Clone Repository

git clone https://github.com/vyawaha/encryption-decryption-tool-java-gui.git

Open Project

Open in

  • IntelliJ IDEA
  • Eclipse
  • VS Code

Compile

cd src

javac crypto/*.java service/*.java gui/*.java main/*.java

Run

java main.Main

πŸ’» Application Workflow

Text Encryption

  1. Enter plain text
  2. Enter password
  3. Click Encrypt Text
  4. Copy encrypted text

Text Decryption

  1. Paste encrypted text
  2. Enter same password
  3. Click Decrypt Text
  4. Original text is restored

File Encryption

  1. Click Encrypt File
  2. Select any file
  3. Choose password
  4. Encrypted file (.enc) is created

File Decryption

  1. Click Decrypt File
  2. Select encrypted file
  3. Enter correct password
  4. Original file is restored

πŸ›‘ Security Features

  • AES-256 Encryption
  • GCM Authenticated Encryption
  • PBKDF2-HMAC-SHA256
  • Random Salt
  • Random IV
  • SHA-256 Integrity Verification
  • Password-Based Key Derivation
  • Authentication Failure Detection
  • Binary Safe Encryption
  • Secure Container Format
  • Base64 Support for Text Encryption
  • Cross Platform Compatibility

πŸ–₯ GUI Features

  • Java Swing Interface
  • Dual Text Panels
  • Password Field
  • Encrypt Button
  • Decrypt Button
  • Copy Output
  • Clear Output
  • Encrypt File
  • Decrypt File
  • Status Bar
  • Error Dialogs
  • Success Notifications
  • File Chooser Integration

πŸ“„ Supported File Types

This application supports encryption of virtually any file because it works directly with binary data.

Examples include:

  • TXT
  • PDF
  • DOC
  • DOCX
  • XLS
  • XLSX
  • PPT
  • PPTX
  • JPG
  • JPEG
  • PNG
  • GIF
  • BMP
  • MP3
  • WAV
  • MP4
  • AVI
  • ZIP
  • RAR
  • 7Z
  • EXE
  • DLL
  • ISO
  • CSV
  • JSON
  • XML
  • HTML
  • CSS
  • Java Files
  • Python Files
  • C++
  • Any Binary File

πŸ“Έ Project Screenshots

Application

Phase 1

Phase 2

Phase 3

Phase 4

Phase 5

Phase 6

Phase 7


Binary File Encryption

Image Encryption

Image Encryption


PDF Encryption

PDF Encryption


ZIP Encryption

ZIP Encryption


Crypto Module Testing

Successful Encryption and Decryption

Crypto Success

Wrong Password Detection

Authentication Failure

πŸ§ͺ Testing

The application has been tested with multiple text inputs and binary file formats to verify correctness, integrity, and authentication.

Text Encryption Tests

  • βœ… Plain text encryption
  • βœ… Plain text decryption
  • βœ… Unicode text support
  • βœ… Large text encryption
  • βœ… Empty input validation
  • βœ… Wrong password detection
  • βœ… Authentication failure handling

File Encryption Tests

  • βœ… TXT Files
  • βœ… PDF Files
  • βœ… JPG Images
  • βœ… PNG Images
  • βœ… ZIP Archives
  • βœ… Java Source Files
  • βœ… Binary Files

Security Tests

  • βœ… Random Salt Generation
  • βœ… Random IV Generation
  • βœ… AES-GCM Authentication Tag Verification
  • βœ… SHA-256 Integrity Verification
  • βœ… Password-Based Key Derivation
  • βœ… Tampered File Detection

πŸš€ Future Improvements

The project can be extended with several enterprise-grade capabilities.

Planned Features

  • Dark Mode UI
  • Drag & Drop File Support
  • Batch File Encryption
  • Folder Encryption
  • Recursive Directory Encryption
  • Progress Bar
  • Multi-threaded Encryption
  • Secure File Deletion
  • Compression Before Encryption
  • Digital Signatures
  • Public Key (RSA/ECC) Encryption
  • Hardware Security Module (HSM) Support
  • Cloud Storage Integration
  • Automatic Update Checker
  • Cross-Platform Installer
  • Command Line Interface (CLI)
  • Logging Dashboard
  • Plugin Architecture
  • Internationalization (i18n)
  • Unit Testing with JUnit

πŸ“š Concepts Demonstrated

This project demonstrates practical implementation of several important computer science and cybersecurity concepts.

Cryptography

  • Symmetric Encryption
  • AES-256
  • AES-GCM
  • PBKDF2
  • Secure Random Number Generation
  • SHA-256 Hashing
  • Authentication Tags
  • Password-Based Encryption

Java Programming

  • Object-Oriented Programming
  • Exception Handling
  • File I/O
  • Byte Streams
  • Swing GUI Development
  • Event Handling
  • Java NIO
  • Modular Architecture

Software Engineering

  • Layered Architecture
  • Separation of Concerns
  • Reusable Utility Classes
  • Service Layer Design
  • Error Handling
  • Maintainable Code Structure

🎯 Learning Outcomes

Through this project, the following skills were applied:

  • Java Swing GUI Development
  • Cryptography Fundamentals
  • Secure Password-Based Encryption
  • Binary File Processing
  • Java NIO File Operations
  • Exception Handling
  • Secure Coding Practices
  • Desktop Application Development
  • Software Architecture
  • Git & GitHub Workflow

🀝 Contributing

Contributions are welcome.

If you would like to improve this project:

  1. Fork the repository.
  2. Create a new feature branch.
  3. Commit your changes.
  4. Push the branch.
  5. Open a Pull Request.

⭐ Support

If you found this project helpful:

⭐ Star the repository

🍴 Fork the repository

🐞 Report bugs

πŸ’‘ Suggest new features


πŸ‘¨β€πŸ’» Author

Muktai Vyawahare

Computer Science Engineering Student

GitHub: https://github.com/vyawaha/encryption-decryption-tool-java-gui.git


πŸ“œ License

This project is licensed under the MIT License.

You are free to use, modify, and distribute this software in accordance with the terms of the license.


πŸ™ Acknowledgements

This project was inspired by modern encryption utilities and built using Java's standard cryptography libraries.

Special thanks to the Java community and open-source ecosystem for providing excellent documentation and APIs.


⭐ If you like this project, please consider giving it a Star! ⭐

Made with ❀️ using Java, Swing, and AES-256 Cryptography

About

A Java Swing based encryption and decryption desktop application using AES-GCM, PBKDF2 key derivation, secure file handling, and GUI-based text and binary file protection.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages