Skip to content

Encryption Service

Build Status MIT License


Features


Clone the Repository

To get started, clone this repository to your local machine using Git:

git clone https://github.com/PostgresCraft/encryption_service.git
cd encryption_service

Quick clone-the-repository

๐Ÿ“ฝ๏ธ Quick Clone of the Encryption Service Tools in action


Quick Start

1. Create Virtual Environment

# Windows
py -3.12 -m venv venv
.\env\Scripts\Activate

Encryption Service Tools Windows

๐Ÿ“ฝ๏ธ Quick Windows of the Encryption Service Tools in action


# macOS / Linux
python3 -m venv venv
source venv/bin/activate

Before installing dependencies, it's recommended to upgrade pip to the latest version to avoid compatibility issues.

python -m pip install --upgrade pip

Upgrade pip Tools Windows

๐Ÿ“ฝ๏ธ Upgrading pip on Windows (recommended)


Install Dependencies

pip install -r requirements.txt

Encryption Service Tools install

๐Ÿ“ฝ๏ธ Quick install of the Encryption Service Tools in action


Project Structure

The following is the current structure of the project files:

Project file structure

๐Ÿ“ธ Project file structure overview

๐Ÿ“„ Click to view the text version
encryption_service/
โ”œโ”€โ”€ encryption.py           # Core encryption/decryption logic
โ”œโ”€โ”€ keys_manager.py         # Key generation and key handling
โ”œโ”€โ”€ requirements.txt        # List of dependencies
โ””โ”€โ”€ README.md               # Project documentation

๐Ÿงช Integration Guide

Want to use encryption_service inside other projects?
Here's how to integrate it in 3 simple steps...

  1. Import keys_manager and encryption from the module.
  2. Load or generate your encryption key.
  3. Use encrypt() and decrypt() wherever needed in your project.

โœ… Ready for PostgreSQL, APIs, Flask projects and more.


Brute-Force Simulation โ€” Why Fernet is Secure

The script brute_force_simulation.py demonstrates the strength of Fernet encryption by attempting to decrypt a message using 100,000+ random keys.

As expected, none succeed โ€” showcasing the impracticality of brute-force attacks.

Fernet uses 256-bit symmetric keys. That means 2^256 possible keys, which is more than the number of atoms in the universe.
Brute-forcing such a key is computationally unfeasible.

โ–ถ๏ธ Run the simulation:

py tests\brute_force_simulation.py

Encryption Service Tools brute_force_simulation

๐Ÿ“ฝ๏ธ It reinforces why using strong encryption like Fernet is essential.


License

This project is licensed under the MIT License.
See the LICENSE file for details.


Author

Tamer Hamad Faour
GitHub: @TamerOnLine