How prilily/file-encryption-system works
Main Components
• User Interface Layer (JavaSwing GUI):
• Components: Login, Register, and UserHome screens.
• Purpose: Handle user authentication and allow users to choose between encrypting and decrypting files.
• Encryption/Decryption Module:
• Classes: Encrypt.java, Decrypt.java, and Algo.java.
• Purpose: Contain the AES encryption/decryption logic and processing of files.
• Exception Handling:
• Class: CryptoException.java.
• Purpose: Manage errors related to cryptographic operations.
• Persistence/Database Component:
• MySQL Connector: mysql-connector-j-8.0.31.jar.
• Role: Interface with a MySQL database, where encrypted files can be stored.
• External Libraries / Frameworks:
• JavaSwing: For building the user interface.
• MySQL JDBC driver: For database interactions.
• AES Cipher Algorithm: To provide the cryptographic functionality.
Relationships and Interactions
• The UI layer initiates the authentication process (Login/Register) and then presents the file selection options (UserHome).
• When a user chooses to perform encryption or decryption:
• The UI layer calls the corresponding Encrypt or Decrypt component.
• These modules then use the shared Algo class to execute the AES algorithm.
• Should an error occur during the cryptographic process, the CryptoException is thrown.
• After encryption, if the user selects to save the file, the encryption module interacts with the MySQL database via the JDBC driver.
• Data flows are clearly directional—from UI actions to business logic (encryption/decryption) and optionally to persistence (database storage).
Architectural Patterns and Principles
• Layered Architecture: Distinct separation between the UI (presentation) and the business logic (encryption/decryption) layers.
• Exception Handling: Centralized error management via the CryptoException class.
• Modular Design: Each Java class (e.g., Encrypt, Decrypt, Login, Register) handles a focused responsibility.
Elements
• Clear Labels:
• “User Interface (JavaSwing)” with sub-components (Login, Register, UserHome).
• “Encryption/Decryption Module” with Encrypt, Decrypt, and Algo classes.
• “Exception Handling” highlighted via CryptoException.
• From UI elements (Login/Register/UserHome) to the appropriate encryption/decryption functionalities.
• From encryption/decryption components to the Algo class.
• From encryption/decryption components to the Database component when persisting data.
• Inside, split into two paths: one for Encrypt and another for Decrypt operations.
• Relate both components back to the shared “Algo” utility.
• Optionally, note exception handling (CryptoException) alongside the encryption/decryption flow.