CryptoLock is a secure Java-based authentication system that demonstrates the implementation of RSA Asymmetric Encryption for user management. It features both a Command Line Interface (CLI) and a Graphical User Interface (GUI), providing a robust way to register and authenticate users without ever storing passwords in plain text.
- Asymmetric Cryptography: Utilizes RSA (1024-bit) to encrypt and decrypt user passwords.
- Dual Interface: - GUI Mode: A clean Java Swing interface for a modern desktop experience.
- CLI Mode: A lightweight terminal-based menu for quick operations.
- Automated Key Generation: Generates unique Public/Private key pairs for every registered user.
- Persistent Storage: Saves user data and cryptographic keys in a structured text-based format (
users.txt).
- Registration: The system generates an RSA KeyPair. The password is encrypted using the Public Key and stored along with the Private Key (encoded in Base64).
- Authentication: When a user logs in, the system retrieves the stored Private Key to decrypt the saved password and compares it to the input.
- Java Development Kit (JDK) 8 or higher.
-
Clone the repository:
https://github.com/masum184e/crypto_lock cd crypto_lock -
Compile the source files:
javac *.java
To run the Graphical Interface (GUI):
java CryptoLockGUITo run the Command Line Interface (CLI):
java CryptoLockCryptoLockGUI.java: The Java Swing entry point.CryptoLock.java: The terminal-based entry point.Auth.java: Core logic for user registration, login, and file I/O.RSA.java: Cryptographic utility class for key generation and encryption logic.users.txt: The database (auto-generated upon first registration).
This project uses the javax.crypto and java.security libraries. By utilizing RSA, the system ensures that even if the users.txt file is accessed by an unauthorized party, the passwords remain encrypted and require the corresponding Private Key for decryption.